Now, I am really confused. How come this program worked but the other one didn't?
DEFINE OSC 20
INCLUDE "LCDbar_INC.bas" ' Include the BARgraph routines
' Set LCD Data port
DEFINE LCD_DREG PORTB
' Set starting Data bit (0 or 4) if 4-bit bus
DEFINE LCD_DBIT 4
' Set LCD Register Select port
DEFINE LCD_RSREG PORTB
' Set LCD Register Select bit
DEFINE LCD_RSBIT 2
' Set LCD Enable port
DEFINE LCD_EREG PORTB
' Set LCD Enable bit
DEFINE LCD_EBIT 3
' Set LCD bus size (4 or 8 bits)
DEFINE LCD_BITS 4
' Set number of lines on LCD
DEFINE LCD_LINES 2
' Set command delay time in us
DEFINE LCD_COMMANDUS 2000
' Set data delay time in us
DEFINE LCD_DATAUS 100.
DEFINE ADC_BITS 8 ' Number of bits in ADCIN result
ADCON1.7 = 1 ' Right Justify AD result
Value VAR WORD ' Must be a WORD even though AD is 8bit
pause 1000
LCDOUT $FE, 1, " "
loop1:
adcin 2,value
LCDOUT $FE,2,"Value = ",DEC Value," "
; syntax- BARgraph Value, Row, Col, Width, Range, Style
@ BARgraph _Value, 2, 0, 16, 255, lines
goto loop1
The only thing I adjusted was the pause commands and I moved the include file to the top of the program. I'm happy that it's working but I'd like to know for future reference incase it happens again. Thanks for the help Darrel.
Bookmarks