OS v5.22 will not compile the if and functions in the same line...
Define ADC_CLOCK = 3 'default value is 3
Define ADC_SAMPLEUS = 20 'default value is 20
Define LCD_BITS = 8 'allowed values are 4 and 8 - the number of data interface lines
Define LCD_DREG = PORTD
Define LCD_DBIT = 0 '0 or 4 for 4-bit interface, ignored for 8-bit interface
Define LCD_RSREG = PORTC
Define LCD_RSBIT = 0
Define LCD_EREG = PORTC
Define LCD_EBIT = 1
Define LCD_RWREG = 0 'set to 0 if not used, 0 is default
Define LCD_RWBIT = 0 'set to 0 if not used, 0 is default
Define LCD_COMMANDUS = 2000 'REM'' 'delay after LCDCMDOUT, default value is 5000
Define LCD_DATAUS = 50 'REM' 'delay after LCDOUT, default value is 100
Define LCD_INITMS = 2 'REM''' 'delay used by LCDINIT, default value is 100
'the last three Define directives set the values suitable for simulation; they should be omitted for a real device
Dim an0 As Word
Dim abc As Byte
Dim suman0 As Word
Dim lit As Byte
Dim dec As Byte
TRISA = 0xff 'set all PORTA pins as inputs
ADCON1 = 0 'set all PORTA pins as analog inputs
Lcdinit 0 'initialize LCD module; cursor is blinking
Lcdcmdout LcdHome
Lcdout "****************"
Lcdcmdout LcdLine2Home
Lcdout "****************"
WaitMs 2000
loop:
abc = 0
suman0 = 0
avrg:
Adcin 0, an0
suman0 = suman0 + an0
abc = abc + 1
If abc < 10 Then Goto avrg
an0 = suman0 / 10
If an0 < 102 Then
an0 = 102
Endif
If an0 >= 757 Then
an0 = 757
Endif
an0 = an0 - 102
an0 = an0 * 100
an0 = an0 / 327
lit = an0 / 10
dec = an0 Mod 10
Lcdcmdout LcdClear 'clear LCD display
If lit >= 5 Then
Lcdout "Fuel Level" 'text for the line 1
Endif
If lit < 5 Then
Lcdout "LOW FUEL: <25%"
Endif
If lit <= 5 And lit > 2
Then Lcdout "Low Fuel: <25%"
Endif
'If lit >= 5 And lit < 10 Then
'Lcdout "Fuel Level: <50%"
'Endif
Lcdcmdout LcdLine2Home 'set cursor at the beginning of line 2
Lcdout "Volume: ",
If lit < 10 Then Lcdout " ",
Lcdout #lit, ".", #dec, " L" 'formatted text for line 2
WaitMs 150 'larger value should be used in real device
Goto loop 'loop forever
can't see why it won't compile... any chance u can just post the text of the hex file on here for me?
Thanks
P.S, hardware engineers on the way as we speak, already defeated 2 of them