Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Define LCD_BITS = 8 'allowed values are 4 and 8 - the number of data interface lines
Define LCD_DREG = PORTB
Define LCD_DBIT = 0 '0 or 4 for 4-bit interface, ignored for 8-bit interface
Define LCD_RSREG = PORTD
Define LCD_RSBIT = 1
Define LCD_EREG = PORTD
Define LCD_EBIT = 3
Define LCD_RWREG = PORTD 'set to 0 if not used, 0 is default
Define LCD_RWBIT = 2 'set to 0 if not used, 0 is default
Define LCD_COMMANDUS = 2000 'delay after LCDCMDOUT, default value is 5000
Define LCD_DATAUS = 50 'delay after LCDOUT, default value is 100
Define LCD_INITMS = 2 '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
AllDigital 'configure all pins for digital use
ADCON1 = 0x0e 'configure AN0 input for analog use
Lcdinit 1 'initialize LCD module; cursor is blinking
loop:
Adcin 0, an0
Lcdcmdout LcdClear 'clear LCD display
Lcdout "Analog input AN0" 'text for the line 1
Lcdcmdout LcdLine2Home 'set cursor at the beginning of line 2
Lcdout "Value: ", #an0 'formatted text for line 2
WaitMs 1 'larger value should be used in real device
Goto loop 'loop forever
Burt... To simulate you NEED to include this line "Define SIMULATION_WAITMS_VALUE = 1" then the simulation is relatively fast... If your simulating in ISIS you dont need it or set it to 0.
Eric... I very rarely use oshonsoft's simulator as I have the full version of ISIS... But when I simulate ANY program that uses the LCD it takes a long time for anything to happen (I mean visually) so the simulation wait value helps when you need to see something happen.
I assume burt is running this on the sim!!
What's happening is the micro view it is not showing port pins changing from high to low and input to output and the LCD simulator doesn't show any values.
I'm using a 18f452 I don't think the alldigital is setting the pins right
hi,
Tried with a 18F452 using 4Mhz and 20MHz xtals, no problems,,,, with and without the Define Sim Waitus