CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

New SBC44B and simple blinking LED HELP
Goto page 1, 2  Next
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Tim Moody



Joined: 30 Sep 2005
Posts: 17

View user's profile Send private message

New SBC44B and simple blinking LED HELP
PostPosted: Thu Oct 20, 2005 12:16 pm     Reply with quote

This has to be a simple newbie mistake
OK, I have the SBC44B with a 18F458, ICD2 and PGM06 cable. I can connect to the SBC44B. I have an LED and 330ohm resistor from B0 to GND. The LED will light up but never blink. Here is what I do, using MPLab 7.
Here is the code I found
Code:
#include <18F458.h>
#use delay(clock=20000000)
#fuses HS, NOLVP, NOWDT, NOPUT

void main(void)
 {
int i;
set_tris_b(0x00);
for(i=0; i<10; i++)
   {
   output_high(PIN_B0);
   delay_ms(1000);
   output_low(PIN_B0);
   delay_ms(1000);
   }
}


Next I compile and MPLab claims success as shown in the ouput below
Clean: Deleting intermediary and output files.
Clean: Deleted file "TestIO.$$$".
Clean: Deleted file "TestIO.ERR".
Clean Warning: File "C:\Eng\PIC\Test1\TestIO.o" doesn't exist.
Clean: Deleted file "TestIO.HEX".
Clean: Deleted file "TestIO.SYM".
Clean: Deleted file "TestIO.LST".
Clean: Deleted file "TestIO.PJT".
Clean: Deleted file "TestIO.TRE".
Clean: Deleted file "TestIO.COF".
Clean: Done.
Executing: "C:\Program files\Picc\CCSC.exe" "TestIO.c" +FH +DF +LN +T -A +M +Z +Y=9 +EA
Memory usage: ROM=0% RAM=0% - 1%
Loaded C:\Eng\PIC\Test1\TestIO.cof
BUILD SUCCEEDED: Thu Oct 20 11:05:19 2005

Next I program see output below.
Connecting to MPLAB ICD 2
...Connected
Setting Vdd source to target
Target Device PIC18F458 found, revision = c0
...Reading ICD Product ID
Running ICD Self Test
...Passed
MPLAB ICD 2 Ready
Programming Target...
...Erasing Part
...Programming Program Memory (0x0 - 0x7F)
Verifying...
...Program Memory
...Verify Succeeded
Programming Configuration Bits
.. Config Memory
Verifying configuration memory...
...Verify Succeeded
...Programming succeeded
MPLAB ICD 2 Ready

Next I select the Debugger, see the output below
Connecting to MPLAB ICD 2
...Connected
Setting Vdd source to target
Target Device PIC18F458 found, revision = c0
...Reading ICD Product ID
Running ICD Self Test
...Passed
MPLAB ICD 2 Ready

Next I do a F9, Run and get the following.
ICD0083: Target not in debug mode, unable to perform operation
ICDWarn0015: Program memory has changed since last program operation? Continue with Debug operation?
Running Target
ICD0083: Target not in debug mode, unable to perform operation
ICD0069: Unable to run target
MPLAB ICD 2 Ready

It has to be a simple newbie mistake.
Tim


Code:
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Oct 20, 2005 12:37 pm     Reply with quote

First, you don't have to start a new thread. You could have tacked
this onto your existing SBC44B thread.

Read my post in the following thread. It explains how to use MPLAB
in debugger mode with the ICD2. Just make sure that everything
is done within the "Debugger" menu. Don't go over to the "Programmer"
menu in MPLAB. Try to do everything in the exact order that I give
in my post.
http://www.ccsinfo.com/forum/viewtopic.php?t=23151
Tim Moody



Joined: 30 Sep 2005
Posts: 17

View user's profile Send private message

PostPosted: Thu Oct 20, 2005 1:18 pm     Reply with quote

PCM,
I thought this was different enough(get the SBC44 running versus toggling an LED with it) to start a new thread, sorry. I read thru the sugested links and I am doing everything correctly(well not everything, it doesn't work) but I still get an error, but it's is different due to running out of the debugger. See below I'm sure it is something fundamental that I am not setting, like a fuse or config bit.
Tim

Programming Target...
...Erasing Part
...Programming Program Memory (0x0 - 0x7F)
...Loading DebugExecutive
...Programming DebugExecutive
...Programming Debug Vector
...Programming RSBUG
Verifying...
...Program Memory
...Debug Executive
...Debug Vector
...Verify Succeeded
Programming Configuration Bits
.. Config Memory
Verifying configuration memory...
...Verify Succeeded
Connecting to debug executive
ICD0083: Target not in debug mode, unable to perform operation
MPLAB ICD 2 Ready
Tim Moody



Joined: 30 Sep 2005
Posts: 17

View user's profile Send private message

PostPosted: Thu Oct 20, 2005 1:26 pm     Reply with quote

One thing I cannot find that has been mentioned several times is the Configuration Bits setting of Background Debug. I cannot find that setting. I am using MPLAB 7.00 and CCS C version 3.234, and a PIC18F458. Even the users manual says to check this setting when you get a "ICD0083: Target not in debug mode, unable to perform operation" error
Tim
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Oct 20, 2005 1:32 pm     Reply with quote

Quote:
I am using MPLAB 7.00

Don't use that version. Get rid of it right away. Use vs. 7.20.
I'm using it, and it works fine.

Download it at the bottom of the following page:
http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=1406&dDocName=en019469&part=SW007002
Tim Moody



Joined: 30 Sep 2005
Posts: 17

View user's profile Send private message

PostPosted: Thu Oct 20, 2005 2:04 pm     Reply with quote

OK, I went from bad to worse. I went to install MPLab 7.20 as suggested. The install suggests you un-install previous version of MPLab, so I did. The install of 7.20 crashed and burned with the error, "Error -2 Transform Package" So now I have no MPLab environment. I paid pretty good money for the ICD2.
Tim Moody
Tim Moody



Joined: 30 Sep 2005
Posts: 17

View user's profile Send private message

PostPosted: Thu Oct 20, 2005 2:09 pm     Reply with quote

Opps. Let me try the coorect installation. What I downloaded before was the "Components Download" I am trying the full zipped version
Tim
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Oct 20, 2005 2:20 pm     Reply with quote

Good. I always download the full install.
Tim Moody



Joined: 30 Sep 2005
Posts: 17

View user's profile Send private message

PostPosted: Thu Oct 20, 2005 2:28 pm     Reply with quote

OK, I downloaded and installed 7.20. Rebooted and everything is done. I run MPLab 7.2, open my project, compile successfully, and I get the following. The target is still not in debug mode. Also I still cannot find the Background Debug setting in the config bits. Maybe I'll chuck this mess and buy a BASIC Stamp
Tim


Programming Target...
...Validating configuration fields
...Erasing Part
...Programming Program Memory (0x0 - 0x7F)
...Loading DebugExecutive
...Programming DebugExecutive
...Programming Debug Vector
...Programming RSBUG
Verifying...
...Program Memory
...Debug Executive
...Debug Vector
...Verify Succeeded
Programming Configuration Bits
.. Config Memory
Verifying configuration memory...
...Verify Succeeded
Connecting to debug executive
ICD0083: Target not in debug mode, unable to perform operation
MPLAB ICD 2 Ready
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Oct 20, 2005 2:35 pm     Reply with quote

Try to use ICD2 as a programmer only. Don't try Debug mode for now.
There are instructions in the following thread:
http://www.ccsinfo.com/forum/viewtopic.php?t=21415
Tim Moody



Joined: 30 Sep 2005
Posts: 17

View user's profile Send private message

PostPosted: Thu Oct 20, 2005 2:57 pm     Reply with quote

PCM,
Thanks for all you help.
I read thru the link and did what you said there. Everything appeared good, but when I powered down the SBC and unplugged the PGM06, and powered it back up, I have a solid on LED. I posted my code here before, and it looks pretty simple. Blink the LED on and off at one second intervals ten times. So know that I know I have gotten a program into it, I am assuming I am still doing something fundamentally wrong.
Tim
Tim Moody



Joined: 30 Sep 2005
Posts: 17

View user's profile Send private message

PostPosted: Thu Oct 20, 2005 3:00 pm     Reply with quote

Just FYI, I am thinking maybe the LED is blinking ten times and I am missing it due to timing. Maybe it is happening faster than I can see.
Tim
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Oct 20, 2005 3:14 pm     Reply with quote

I notice on their webpage that a crystal is an option. (down at the bottom)
http://www.modtronix.com/product_info.php?products_id=109
Did you order it with a crystal installed, and what frequency is it ?

Also, I didn't like the way you did your loop, but I didn't say anything
because you have fairly long delays, and I assumed you would be able
to see the LED flash before the program shuts down.

Try this program instead. It has an infinite loop, and it also has the
PUT and BROWNOUT fuses, which can help if you're using a "wall wart"
power supply.

Just comment out your other program, and copy and paste this one into MPLAB.
Code:

#include <18F458.H>
#fuses HS, NOWDT, PUT, BROWNOUT, NOLVP
#use delay(clock=20000000)

void main()
{

while(1)
  {
   output_high(PIN_B0);
   delay_ms(500);
   output_low(PIN_B0);
   delay_ms(500);
  }

}
Tim Moody



Joined: 30 Sep 2005
Posts: 17

View user's profile Send private message

PostPosted: Thu Oct 20, 2005 3:25 pm     Reply with quote

Mr Wizard,
Got it, but I cannot see "much" difference in the code. I know I had a crappy loop, but I am looking at the fuse compiler directive. Must be one of the fields.
Thanks again
Tim Moody
Humberto



Joined: 08 Sep 2003
Posts: 1215
Location: Buenos Aires, La Reina del Plata

View user's profile Send private message

PostPosted: Thu Oct 20, 2005 3:52 pm     Reply with quote

Quote:

ICD0083: Target not in debug mode, unable to perform operation


I guess there is not a code problem. Add ICD=TRUE directive.
The mssge gives some clue that there is a hardware fault.
1)Check the jumpers on board. J1 (close to the ICSP connector)
2)Check continuity from ICSP connector to RB7, RB6 and MCLR Pins

Humberto
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group