Been trying out the serial commands as per other posts. Need to send output to a serial lcd that requires 9600 baud, no parity, and ttl input. Per previous post, have adjusted the r9600 value from 9 to 13-40/mhz with no conclusive results other than invalid charactor(s) showing up. Any ideas? The code:
#define SendAHigh SET PORTB.7 ON
#define SendALow SET PORTB.7 OFF
#define Led PortB.3
dir PortB.7 Out
dir PortB.3 Out
dim hello as string
InitSer (1, r9600, 1+WAITForStart, 8, 1, none, normal)
Main:
Set Led On
wait 1 s
hello$ = "hello"
SerPrint(1,hello$)
wait 1 s
temp = 99
SerSend(1, temp)
wait 1 s
Set Led Off
wait 1 s
goto Main
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Been trying out the serial commands as per other posts. Need to send output to a serial lcd that requires 9600 baud, no parity, and ttl input. Per previous post, have adjusted the r9600 value from 9 to 13-40/mhz with no conclusive results other than invalid charactor(s) showing up. Any ideas? The code:
'Serial LCD routine
#chip 16F648A,20
#mem 256
#config _CP_OFF & _DATA_CP_OFF &_WDT_OFF & _BODEN_OFF & _PWRTE_ON & _HS_OSC & _LVP_OFF
#define SendAHigh SET PORTB.7 ON
#define SendALow SET PORTB.7 OFF
#define Led PortB.3
dir PortB.7 Out
dir PortB.3 Out
dim hello as string
InitSer (1, r9600, 1+WAITForStart, 8, 1, none, normal)
Main:
Set Led On
wait 1 s
hello$ = "hello"
SerPrint(1,hello$)
wait 1 s
temp = 99
SerSend(1, temp)
wait 1 s
Set Led Off
wait 1 s
goto Main
Thanks to Steve for posting hardware Usart code. Can now transmit strings @9600 baud to the serial LCD.
Kent