OK, I got it working, after I commented out the line below it worked. Took me a while to understand why, then I saw it...
The gosub wait1 is to wait for the ACK from the LCD display. If no ACK, it reboots the display. Well I jump to a routine that waits for the ACK, then return and wait again without sending another command to the display. Stupid little mistake trying to shrink the program to save some flash space.
Code:
shutdown:
serout2 tx, baud, ["s", 0, 2, 2, white1, white2, "- GOOD BYE -", $00] : gosub wait1
; gosub ln3blank : gosub wait1 ;PORTB.0 CAN GO LOW WITH THIS LINE COMMENTED OUT??????
serout2 tx, baud, [$59, $03, $00] : gosub wait1
pause 500
PORTB.0=0 'shutdown main power relay NOT GOING LOW??????????
pause 5000 'wait for relay to drop out
goto start 'if processor is still running, then reboot
ln3blank:
serout2 tx, baud, ["s", 0, 3, 2, white1, white2, " ", $00] : gosub wait1
return
wait1: 'WAIT FOR ACK FROM DISPLAY
serin2 rx, baud, 500, initdisp, [a] 'wait 500ms for serin, else goto wait2
if a<>6 then waitfail '???? 'check for ACK, if not then reinitialize display
return
Bookmarks