Hello Sir,
i m sending u my code. I m using RS-485 bus network. I m using serial interrupt for 16f876A.
I m sending serially data 2 times from PC and get only 1 time on PIC16Fxx controller.
code:
DEFINE HSER_CLROERR 1
goto Main
DEFINE INTHAND myint
asm
; Save W, STATUS and PCLATH registers
myint
movwf wsave
swapf STATUS, W
clrf STATUS
movwf ssave
movf PCLATH, W
movwf psave
; Insert interrupt code here
; Save and restore FSR if used
bsf _LED ; Turn on LED (for example)
GOTO _Serial
; Restore PCLATH, STATUS and W registers
movf psave, W
movwf PCLATH
swapf ssave, W
movwf STATUS
swapf wsave, F
swapf wsave, W
retfie
endasm
'''''''''''''''''''''''''''''''''''''''''''''''''' ''''''''''''''''''''''''''''''''
Main:
LOW LED
INTCON.6 = 1
INTCON.7 = 1
hserout [dec x," ", dec y]
lcdout $FE,1,#x," ",#y
here: goto here
Serial:
hserin [dec x,dec y]
' x = RCREG
' y = RCREG
low led
goto Main
'Resume
Bookmarks