#include "D:\MyDocuments\Isdelia\test\pic12.h"
#int_ext
ext_irs()
{
if(getc()==('a'))
{
output_high(pin_a0);
delay_ms(300);
output_low(pin_a0);
}
}
void main()
{
setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
setup_timer_1(T1_DISABLED);
setup_comparator(NC_NC);
setup_vref(VREF_LOW|-2);
enable_interrupts(int_ext);
enable_interrupts(global);
while(1)
{
delay_ms(500);
putc('b');
output_high(PIN_A3);
delay_ms(500);
output_low(PIN_A3);
}
}
.h file
#include <12F675.h>
#FUSES NOWDT //No Watch Dog Timer
#FUSES HS //Internal RC Osc
#FUSES NOCPD //No EE protection
#FUSES NOPROTECT //Code not protected from reading
#FUSES MCLR //Master Clear pin enabled
#FUSES NOPUT //No Power Up Timer
#FUSES BROWNOUT //Reset when brownout detected
#use delay(clock=4000000)
#use rs232(baud=9600,parity=N,xmit=PIN_A1,rcv=PIN_A2,bits=9)
this is a simple program that every 1 s send byte ASCI b to the serial port /software serial port/ and flashing LED 500/500 ms.
edit: also this progrm wait for a recive byte, if this byte is equal to ASCII a then flashing led in port A0.
p.s. this is for the CCS IDE