Quantcast
Viewing all articles
Browse latest Browse all 20639

BASCOM-AVR : Running LCD Display 4 Bit Mode Libraries ? Init ? : REPLY

i changed your code a bit. first of all, the delays are not necessary. only 1 delay should be placed so the lcd has time to show the info. (at the end of the loop). Otherwise the result would be erased by the next value. here is your code: [code:1:74d68eb882]$regfile = "m168def.dat" ' specify the used micro $crystal = 6000000 ' used crystal frequency $baud = 19200 ' use baud rate $hwstack = 90 ' default use 32 for the hardware stack $swstack = 60 ' default use 10 for the SW stack $framesize = 40 Config Lcd = 16*2 Config Lcdpin = Pin , Db4 = Portd.6 , Db5 = Portd.4 , Db6 = Portd.7 , Db7 = Portb.0 , E = Portd.3 , Rs = Portd.2 initlcd Dim i as integer dim Line_1 as string*16 dim Line_2 as string*16 dim dummystring as string*3 i=0 line_1 = "thisisline#" cls lcd line_1 line_2 ="QWERTZYXASDY" 'wait 1 lowerline lcd line_2 'waitms 1000 Cursor Off Noblink do dummystring = str(i) dummystring = " " + dummystring locate 1, 12 'position to line 1 Pos 12 ' waitms 50 'give time for executing command lcd dummystring 'write short string to line 1 'waitms 1000 '<-- no information visible locate 2,12 'position to line 2 Pos 12 ' waitms 50 'give time for executing command lcd dummystring ' write short string to defined position ' locate 1, 12 '<---- if removed then no information visible on LCD waitms 1000 '<------ this works if locate command is prior ' ^^ you need a delay to be able to read the text !!! i=i+1 'wait 1 if i=100 then i=0 loop[/code:1:74d68eb882] i removed the last waitms 1000 because i simulated the code. in a real processor you need to include it. The code works as expected. i can only assume there is a problem with the hardware. there can be several reasons. I assume you run on 5V ? And that the LCD is a 5V too? Do you have a link to the PDF of the LCD ? Did you tried a different LCD ? Did you wired on a breadboard or is this a ready made board? Do you have the circuit? And last : if you update the LCD in a loop, you continuously are updating the lcd with command and or data. Some displays might not show the data while they are updated. So even while you do not use a CLS command, you might need a delay so the lcd is readable. I suspect that different lcd's will handle this different. Instead of using a delay you could use an interval to update the LCD.

Viewing all articles
Browse latest Browse all 20639

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>