PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Wed Mar 04, 2009 2:47 pm |
|
|
I suggest that you start with a simple program that doesn't use the RTOS.
Make that program work first. Here's an example:
Code: | #include <16F877A.h>
#fuses XT, NOWDT, NOPROTECT, BROWNOUT, PUT, NOLVP
#use delay(clock=4000000)
#use rs232(baud=2400,xmit=PIN_E0,rcv=PIN_E1)
//===================================
void main()
{
while(1)
{
if(input(PIN_C0)) // Read the switch pin.
putc('1'); // Display the state of the pin.
else
putc('0');
delay_ms(100);
}
} |
Make sure that pin C0 has a pull-up resistor on it. You can use 4.7K or
10K. |
|