View previous topic :: View next topic |
Author |
Message |
Tim Moody
Joined: 30 Sep 2005 Posts: 17
|
New SBC44B and simple blinking LED HELP |
Posted: Thu Oct 20, 2005 12:16 pm |
|
|
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
|
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Thu Oct 20, 2005 12:37 pm |
|
|
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
|
|
Posted: Thu Oct 20, 2005 1:18 pm |
|
|
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
|
|
Posted: Thu Oct 20, 2005 1:26 pm |
|
|
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
|
|
|
Tim Moody
Joined: 30 Sep 2005 Posts: 17
|
|
Posted: Thu Oct 20, 2005 2:04 pm |
|
|
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
|
|
Posted: Thu Oct 20, 2005 2:09 pm |
|
|
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
|
|
Posted: Thu Oct 20, 2005 2:20 pm |
|
|
Good. I always download the full install. |
|
|
Tim Moody
Joined: 30 Sep 2005 Posts: 17
|
|
Posted: Thu Oct 20, 2005 2:28 pm |
|
|
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
|
|
|
Tim Moody
Joined: 30 Sep 2005 Posts: 17
|
|
Posted: Thu Oct 20, 2005 2:57 pm |
|
|
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
|
|
Posted: Thu Oct 20, 2005 3:00 pm |
|
|
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
|
|
Posted: Thu Oct 20, 2005 3:14 pm |
|
|
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
|
|
Posted: Thu Oct 20, 2005 3:25 pm |
|
|
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
|
|
Posted: Thu Oct 20, 2005 3:52 pm |
|
|
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 |
|
|
|