added some code into the Instant Interrupt version, to get control of HPWM for the backlight of the LCD. Running a 16F628A @ 20Mhz
Here is the *working* version ...so far
I made it to behave like my other LCDs, so to control the backlight it wants to see code like:
$14$FF 'full power
$14$00 'off
I also upped a little program that I use to test the LCD.
http://www.flipperdesign.com/FlipLCD_control.rar
Code:
getbuf: ' move the next character in buffer to bufchar
@ INT_DISABLE RX_INT
index_out = (index_out + 1) ' Increment index_out pointer (0 to 63)
' Reset pointer if outside of buffer
IF index_out > (buffer_size-1) Then index_out = 0
bufchar = buffer[index_out] ' Read buffer location
if skipLCDComm>0 then
skipLCDComm=skipLCDComm-1
endif
;Routine for buffering LCD commands
if (GrabBkLt=1) then
; WE have signal to watch for value for LCD backlight next
; LCDOut $FE,$94,"BACKLIGHT set:<",#bufchar,">" ; for debug only
HPWM 1,bufchar ,1250 ; Setting Pulse Mod to desired value
' Observe minimum FREQ for given OSC speed. 20Mhz is 1221Hz
' Next set bufchar to a null char, so I wont be seen/displayed
bufchar = 24
Low LedPort ; Debug only
GrabBkLt=0 ; All is done, signal to close the loop
;Re-Enable Int and go back up, to skip displaying this char
@ INT_ENABLE RX_INT
goto display
endif
;Following will trigger the routine up here on the next chr received
; but if skip if $fe has been called 2 shots ago
if (bufchar=20) and (skipLCDComm=0) then ; 14h, trigger for special LCD command
HIGH LedPort ; Debug only
GrabBkLt=1 ; Signal to get the value of backlight level
;Re-Enable Int and go back up, to skip displaying this char
@ INT_ENABLE RX_INT
goto display
endif
;Prevent value of 14h to be trapped for other command, we memorize previous call of $FE (254)
if bufchar=254 then
skipLCDComm=2 ;
endif
@ INT_ENABLE RX_INT
Return
Bookmarks