Try this instead....
@ device hs_OSC, wdt_on, pwrt_on, protect_off
define osc 20
Include "modedefs.bas"
RCSTA = %10010000:SPBRG = 31:INTCON = %11000000:PIE1.5=1:trisc.6=0
TRISC.7=1:TRISA.0=0:test var porta.0:counter var word:BAUD CON 16390
---------------------------------jump over your interrupt routines
goto main
-----------------------------------------------------------------
on interrupt goto myroutine
disable
myroutine:
if PIR1.5=1 then
serout2 test,BAUD,[dec rcreg,10,13] 'send the value to com2
serout2 test,BAUD,["PIR1.5=",BIN PIR1.5,10,13]
IF RCSTA.1=1 THEN
serout2 test,BAUD,["BUFFER OVERRUN",10,13] 'Just to see if overflow occured
ENDIF
-------------------read the serial port input register and reset the input interrupt flag
x=rcreg : PIR1.5 = 0
endif
resume
enable
main:
if counter= 5000 THEN 'just to keep the pic busy to make sure the
toggle portd.0:counter=0 ' interrupts are working.
else
counter=counter+1
endif
goto main
end
You're program organization was messed up a bit. Also, you have to read RCREG and reset the flag manually when using the serial port, just like the datasheet says.
Which version of PBP are you using?
Bookmarks