View previous topic :: View next topic |
Author |
Message |
SparkyEE
Joined: 15 Jun 2007 Posts: 7
|
example program EX_SQW works with one pin, but not another |
Posted: Thu Jun 21, 2007 8:50 am |
|
|
The EX_SQW.c example code included with the CCS compiler works just fine on my PICkit2 debug express demo board (16F887), if I leave the pin at PIN_B0, It does NOT work when simply changing the output pin to PIN_A5.
I have also tried including the line: #use standard_io, it makes no difference.
I'm lost as to why this simple change breaks the program.. Any thoughts?
Thanks.
void main() {
printf("Press any key to begin\n\r");
getc();
printf("1 khz signal activated\n\r");
while (TRUE) {
output_high(PIN_B0);
delay_us(500);
output_low(PIN_B0);
delay_us(500);
}
} |
|
|
treitmey
Joined: 23 Jan 2004 Posts: 1094 Location: Appleton,WI USA
|
|
Posted: Thu Jun 21, 2007 11:54 am |
|
|
I got a nice square wave with the PICDEM 2 plus and rev3.249
NOTE THAT THIS IS 16F877 NOT 16F887.. but software seems OK
Code: | #include <16F877.h>
#device *=16
#use delay(clock=10000000)
#fuses hs,nowdt,nolvp,protect,put,nobrownout
#use rs232(baud=19200,xmit=PIN_E0,INVERT,stream=DEBUG) // STDERR(same as DEBUG)
#case
#zero_ram
void main() {
setup_adc_ports(NO_ANALOGS);
fprintf(DEBUG,"Press any key to begin\n\r");
fprintf(DEBUG,"1 khz signal activated\n\r");
while (TRUE) {
output_high(PIN_A5);
delay_us(500);
output_low(PIN_A5);
delay_us(500);
}
} |
Last edited by treitmey on Fri Jun 22, 2007 7:36 am; edited 2 times in total |
|
|
kender
Joined: 09 Aug 2004 Posts: 768 Location: Silicon Valley
|
|
Posted: Thu Jun 21, 2007 6:24 pm |
|
|
I had a similar problem recently. See this thread http://www.ccsinfo.com/forum/viewtopic.php?t=31075. The discussion began with an interrupt problem, but them PCM suggested interrupt itself was not the source of the problem. _________________ Read the label, before opening a can of worms. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Thu Jun 21, 2007 8:29 pm |
|
|
Quote: | It does NOT work when simply changing the output pin to PIN_A5. |
1. Post your compiler version. You can find it at the start of the .LST
file for your project. The .LST file is in your project directory.
The compiler version is a 4-digit number such as 3.249, 4.041, etc.
2. Confirm the PIC that you're using. Is it 16F877 or 16F887 ? |
|
|
|