As depicted in the 16F88 data sheet, port B 5 have the built in hardware UART function which made serial transmission easier.
**broken link removed**
However I am new to assembly language. To have RB5 send serial data, I am trying to modify the code shown as below:
I declare the variable for settling time for start up:
and the serial transmission is called:
The AmpHour is stored previously as:
How about the tem1 timing for a baud rate of 9.6kbps suggested? Thanks
**broken link removed**
However I am new to assembly language. To have RB5 send serial data, I am trying to modify the code shown as below:
I declare the variable for settling time for start up:
Code:
;----------------------
; DECLARE VARIABLES
;----------------------
cblock 0x20
tmp1
endc
Code:
Ser_sent:
banksel SPBRG
movlw 2580 ; 9.6kbps
movwf SPBRG
movlw b'00100000' ; brgh = high (2)
movwf TXSTA ; enable Async Transmission, set brgh
; Provide a settling time for startup
banksel tmp1
clrf tmp1
settle
decfsz tmp1, f
goto settle
; Send a character through the UART
loop
movlw AmpHours
call send
goto $
;----------------------
; SEND function
;----------------------
send
banksel TXREG
movwf TXREG ; Send data which has been stored in W
trans_wt
banksel TXSTA
btfss TXSTA, TRMT ; Loop until data is sent
goto trans_wt
return
end
Code:
store_Ah:
mov16 dd+2,AmpHours