Hello all,
My first post, please be gentle
I'm trying to adapt Mike's PIC 16F819 full duplex software uart code to an 18F, but it's not working yet, but it's crashing in the IRQ handler. Wonder if someone can take at this code snipped.
The baud rate I need is 7812.5 and it's XTAL is at 8MHz.
I've changed some instructions like FSR, to FSR0L and FSR0H and saving those including PCLATH and PCLATU etc. I've not updated the timing information per instruction yet, but I calculated the value of 85 for PR2 for 7812.5 baud.
Also, I think I've fixed up the jump table correctly by doing RLNCF WREG, W before loading PCL.
Does this look right ?
Thanks.
My first post, please be gentle
I'm trying to adapt Mike's PIC 16F819 full duplex software uart code to an 18F, but it's not working yet, but it's crashing in the IRQ handler. Wonder if someone can take at this code snipped.
The baud rate I need is 7812.5 and it's XTAL is at 8MHz.
I've changed some instructions like FSR, to FSR0L and FSR0H and saving those including PCLATH and PCLATU etc. I've not updated the timing information per instruction yet, but I calculated the value of 85 for PR2 for 7812.5 baud.
Also, I think I've fixed up the jump table correctly by doing RLNCF WREG, W before loading PCL.
_ISR movwf _W_ISR ; save W-reg |B?
swapf STATUS,W ; doesn't change STATUS bits |B?
movwf _S_ISR ; save STATUS reg |B?
clrf STATUS ; bank 0 |B0
movf PCLATH,W ; get PCLATH |B0
movwf _P_ISR ; save PCLATU |B0
movf PCLATU,W ; get PCLATU |B0
movwf _P_ISRU ; save PCLATU |B0
bcf PIR1,TMR2IF ; clear TMR2 interrupt flag |B0
;
; enter the TX state machine
;
;
clrf PCLATH ; |B0
clrf PCLATU ; |B0
movf _TX_SM,W ; get TX state machine |B0
RLNCF WREG, W ; 18f ?
addwf PCL,f ; off we go |B0
Does this look right ?
Thanks.