Author: jsuijs
Date: Tue Mar 24 11:24:58 2009
New Revision: 880
Modified:
trunk/include/external/lcd/lcd_backlight.jal
trunk/include/external/lcd/lcd_hd44780_serial_sw.jal
trunk/project/lcd_interface/lcd_interface.jal
Log:
Modified: trunk/include/external/lcd/lcd_backlight.jal
==============================================================================
--- trunk/include/external/lcd/lcd_backlight.jal (original)
+++ trunk/include/external/lcd/lcd_backlight.jal Tue Mar 24 11:24:58 2009
@@ -34,6 +34,9 @@
pwm_max_resolution(1)
pwm1_on()
+ --
----------------------------------------------------------------------------
+ -- lcd_backlight_variable - set backlight level
+ --
----------------------------------------------------------------------------
procedure lcd_backlight_variable(byte in value) is
pragma inline
if (lcd_bl_inverted == false) then
@@ -124,7 +127,7 @@
end if
end if
-
+
;procedure lcd_backlight_variable(byte in value) is
;end procedure
Modified: trunk/include/external/lcd/lcd_hd44780_serial_sw.jal
==============================================================================
--- trunk/include/external/lcd/lcd_hd44780_serial_sw.jal (original)
+++ trunk/include/external/lcd/lcd_hd44780_serial_sw.jal Tue Mar 24
11:24:58 2009
@@ -125,3 +125,30 @@
-- init the API
_hd44780_init()
end procedure
+
+
+
+ procedure lcd_backlight_variable(byte in value) is
+
+--
----------------------------------------------------------------------------
+-- lcd_backlight_variable - set backlight level
+--
----------------------------------------------------------------------------
+procedure lcd_backlight_variable(byte in value) is
+
+ value = value / 8 -- only use lower 5 bits
+ value = value | (1<<5) -- command 1 (in higher 3 bits)
+ serial_sw_write(0x20 | (value/8)) -- interrupts are disabled by lib
+end procedure
+-- ------------
+
+--
----------------------------------------------------------------------------
+-- lcd_backlight - turn backlite on/off
+--
----------------------------------------------------------------------------
+procedure lcd_backlight(bit in onoff) is
+ if (onoff) then
+ lcd_backlight_variable(255)
+ else
+ lcd_backlight_variable(0)
+ end if
+end if
+
Modified: trunk/project/lcd_interface/lcd_interface.jal
==============================================================================
--- trunk/project/lcd_interface/lcd_interface.jal (original)
+++ trunk/project/lcd_interface/lcd_interface.jal Tue Mar 24 11:24:58 2009
@@ -48,6 +48,13 @@
var volatile bit cmdfield at inchar : 5
var volatile bit*5 datafield at inchar : 0
+; setup pwm for backlight
+pin_ccp1_direction = output
+pwm_max_resolution(1)
+pwm1_on()
+pwm1_set_dutycycle(0) -- backlight off
+
+
forever loop
if (serial_hw_read(inchar) == true) then
@@ -57,6 +64,7 @@
__lcd_write_nibble(datafield)
elsif (cmdfield == 1) then
-- 5 bit pwm value in datafield
+ pwm1_set_dutycycle(datafield * 8)
end if
end if
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"jallib" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/jallib?hl=en
-~----------~----~----~----~------~----~------~--~---