Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Hseropen 9600
'set up interrupts
PIE1.RCIE = 1
INTCON.PEIE = 1
INTCON.GIE = 1
'main loop
'******************************************************************************
main:
If outptr > 0 Then ; a valid packet has arrived
led = 1
WaitMs 100
led = 0
outptr = 0
Endif
WaitMs 100
Goto main
End
'******************************************************************************
On High Interrupt
Save System
If rcsta.oerr = True Then ; any error reboot serial module..
rcsta.cren = 0
rcsta.cren = 1
Goto finish
Endif
buffer(inptr) = rcreg 'get data and store in buffer (reading clears the rcif)
If buffer(inptr) = "#" Then outptr = inptr 'flag when # received
inptr = inptr + 1
If inptr = 10 Then inptr = 0 'buffer reset
finish:
Resume
I've been trawling the microchip site... Pic16f675 isn't a chip... Are you using the pic12f675???
Hseropen 9600
'set up interrupts
PIE1.RCIE = 1
INTCON.PEIE = 1
INTCON.GIE = 1
'main loop
'******************************************************************************
main:
If outptr > 0 Then ; a valid packet has arrived
led = 1
WaitMs 100
led = 0
outptr = 0
Endif
WaitMs 100
Goto main
End
'******************************************************************************
On High Interrupt
Save System
If rcsta.oerr = True Then ; any error reboot serial module..
rcsta.cren = 0
rcsta.cren = 1
Goto finish
Endif
buffer(inptr) = rcreg 'get data and store in buffer (reading clears the rcif)
If buffer(inptr) = "#" Then outptr = inptr 'flag when # received
inptr = inptr + 1
If inptr = 10 Then inptr = 0 'buffer reset
finish:
Resume
Obviously a timing thing!!! The pic16f62a has a precision internal 4mhz oscillator... If you are using an external crystal then I would suspect you have an oscilator running faster than 4mhz but selected XT in the OSC config.... I have run chips at 8mhz on the XT setting but it is unreliable... Any crystal larger than 4mhz must be set to HS...Works perfectly with some 16f628A and some it does not read the incoming msg on RX pin