lerameur
- 30th April 2012, 18:09
Hi,
I am trying to use the sleep command (assembler way) with and without the LCD as shown in my code. Either way it does not seem to work because without the LCD I always get 22mA from my 12v batteries and with the LCd module about 85mA . Can someone tell me why the sleep command do not work.
I know I dont have any interrupt to get out of sleep, but first thing first
Thanks
ken
'using a pic16F88
' MPASM Header
INCLUDE "modedefs.bas"
OSCCON = %01110000 '8 Mhz
Define OSC 8
'///////////////////////////
'// Interrupt section //
'///////////////////////////
'ON INTERRUPT Goto MyInterrupt
' INTCON = %10010000
CMCON = 7 : ANSEL = 0 : ADCON1 = 7
'/////////////////////////
'// LCD configuration //
'/////////////////////////
DEFINE LCD_DREG PORTA ' Set LCD Data port
DEFINE LCD_DBIT 0 ' Set starting Data bit (0 or 4) if 4-bit bus
DEFINE LCD_RSREG PORTA ' Set LCD Register Select port
DEFINE LCD_RSBIT 4 ' Set LCD Register Select bit
DEFINE LCD_EREG PORTA ' Set LCD Enable port
DEFINE LCD_EBIT 7 ' Set LCD Enable bit
DEFINE LCD_BITS 4 ' Set LCD bus size (4 or 8 bits)
DEFINE LCD_LINES 2 ' Set number of lines on LCD
DEFINE LCD_COMMANDUS 2500
DEFINE LCD_DATAUS 250
DEFINE CHAR_PACING 2000
pause 500
Mainloop:
lcdout $FE,1, "Test: ", dec 22
PAUSE 3000
@sleep
goto Mainloop
end
I am trying to use the sleep command (assembler way) with and without the LCD as shown in my code. Either way it does not seem to work because without the LCD I always get 22mA from my 12v batteries and with the LCd module about 85mA . Can someone tell me why the sleep command do not work.
I know I dont have any interrupt to get out of sleep, but first thing first
Thanks
ken
'using a pic16F88
' MPASM Header
INCLUDE "modedefs.bas"
OSCCON = %01110000 '8 Mhz
Define OSC 8
'///////////////////////////
'// Interrupt section //
'///////////////////////////
'ON INTERRUPT Goto MyInterrupt
' INTCON = %10010000
CMCON = 7 : ANSEL = 0 : ADCON1 = 7
'/////////////////////////
'// LCD configuration //
'/////////////////////////
DEFINE LCD_DREG PORTA ' Set LCD Data port
DEFINE LCD_DBIT 0 ' Set starting Data bit (0 or 4) if 4-bit bus
DEFINE LCD_RSREG PORTA ' Set LCD Register Select port
DEFINE LCD_RSBIT 4 ' Set LCD Register Select bit
DEFINE LCD_EREG PORTA ' Set LCD Enable port
DEFINE LCD_EBIT 7 ' Set LCD Enable bit
DEFINE LCD_BITS 4 ' Set LCD bus size (4 or 8 bits)
DEFINE LCD_LINES 2 ' Set number of lines on LCD
DEFINE LCD_COMMANDUS 2500
DEFINE LCD_DATAUS 250
DEFINE CHAR_PACING 2000
pause 500
Mainloop:
lcdout $FE,1, "Test: ", dec 22
PAUSE 3000
@sleep
goto Mainloop
end