View previous topic :: View next topic |
Author |
Message |
bsolas
Joined: 13 Jun 2005 Posts: 1
|
Newbee question |
Posted: Tue Jun 14, 2005 2:16 am |
|
|
I'm a (complete) newbee to hardware programming. I bought a prototyping kit (description may be found on: "http://www.ccsinfo.com/ace.shtml") with a PIC16F877A processor.
When I try to follow the step-by-step excercise book, I can't get the programs to work. Everything seems to work though. I connect through the debugger, and the program runs normally according to the debugger status messages. However, the LED's that are supposed to blink does not show any reaction. When I power up the card all LED's are on, but no flashing occurs when the program runs. The excercise book refers to a prototyping board called "16F877A Mini-proto board", but my card is the one depicted in the URL above. I noticed that my card has two rows (a green and a red) of 5 LED's, and the "16F877A Mini-proto board" has three single LED's, a red, green and yellow. Is there a syntactical diffrence in how to make the LED's blink on these two cards?
The code used is:
Code: |
#include <16f877A.h>
#device ICD=TRUE
#fuses HS,NOLVP,NOWDT,PUT
#use delay (clock=20000000)
#define GREEN_LED PIN_A5
main() {
while (TRUE) {
output_low(GREEN_LED);
delay_ms(1000);
output_high(GREEN_LED);
delay_ms(1000);
}
}
|
The code is copy/paste from the execercise book.
Any help would be much appreciated. |
|
|
Guest
|
|
Posted: Tue Jun 14, 2005 5:09 am |
|
|
It appears that a space has happened between your "f" and "uses" on fuses? |
|
|
bsolas
Joined: 13 Jun 2005 Posts: 1
|
|
Posted: Tue Jun 14, 2005 5:26 am |
|
|
I agree, there seems to be an extra space between the "f" and the "u" in "fuses". However, if you copy/paste the code to an editor (ie. notepad) you'll see that it's only an illusion... |
|
|
valemike Guest
|
|
Posted: Tue Jun 14, 2005 8:21 am |
|
|
i've never used the statment "ICD=true" in the past. When I debug with the ICD, somehow MPLAB sets it all for me.
But doesn't ICD=true force the dependence of an ICD debugger to be used? That would explain why it won't work in standalone mode. Try commenting that out. |
|
|
valemike Guest
|
|
Posted: Tue Jun 14, 2005 8:25 am |
|
|
i read your original post again, and just realized that I was too hasty in writing a response.
I don't have your specific demo board, but if you say that your program runs normally but w/o the LEDs flashing, then you should check if there are any jumpers that need to be plugged in to get your LED rows to flash.
For example, I use the PICDEM-2+ board. If i want to flash the LEDs, i have to install a two-pin jumper. Otherwise, if i want to use those i/o pins for something else, i pop off the jumper and i now can use the prototyping area on the board for other things. |
|
|
bsolas
Joined: 13 Jun 2005 Posts: 1
|
|
Posted: Wed Jun 15, 2005 12:19 am |
|
|
Hi valemike
Thanks a lot for your answers. Setting the correct jumper(s) seems like the answer I'm looking for. However the card wasn't shipped with any documentation on which jumpers to set when and where (and there are a lot of possibilities). Maybe I'm supposed to know this...?
I realize that the "#define GREEN_LED PIN_A5" statement refers to an address/pin on the card and that this pin probably needs to be connected somwhere else. I just don't know where...
I should probably keep looking for the documentation on the card. |
|
|
bsolas
Joined: 13 Jun 2005 Posts: 1
|
|
Posted: Wed Jun 15, 2005 12:19 am |
|
|
Hi valemike
Thanks a lot for your answers. Setting the correct jumper(s) seems like the answer I'm looking for. However the card wasn't shipped with any documentation on which jumpers to set when and where (and there are a lot of possibilities). Maybe I'm supposed to know this...?
I realize that the "#define GREEN_LED PIN_A5" statement refers to an address/pin on the card and that this pin probably needs to be connected somwhere else. I just don't know where...
I should probably keep looking for the documentation on the card. |
|
|
sseidman
Joined: 14 Mar 2005 Posts: 159
|
|
Posted: Wed Jun 15, 2005 9:01 am |
|
|
bsolas wrote: | Hi valemike
Thanks a lot for your answers. Setting the correct jumper(s) seems like the answer I'm looking for. However the card wasn't shipped with any documentation on which jumpers to set when and where (and there are a lot of possibilities). Maybe I'm supposed to know this...?
I realize that the "#define GREEN_LED PIN_A5" statement refers to an address/pin on the card and that this pin probably needs to be connected somwhere else. I just don't know where...
I should probably keep looking for the documentation on the card. |
The breakout for the proto-board lives on a sticker on the front edge of the protoboard, and this sticker provides just about all the info you'll ever need. On my proto-kit The LED's occupy spaces 42-46 (clearly labeled), and A0-A5 live in spaces 15-20. Assuming your board is the same, you need to run your jumper from space 20 to space 42 to make the first LED flash.
If this sticker is missing, give ccs support a jingle, and I'm sure they'll fix you right up.
Scott |
|
|
|