Putting robotics at your service™

Free shipping on orders over $200

BBII with 4x20 LCD

Print view Share :
Previous topicNext topic

Page 1 of 1 [ 5 posts ]

Expert ( offline )
Posts: 260
Posted: 2011-09-09 16:23 
 Post subject: BBII with 4x20 LCD
Hi,
I have a 4X20 LCD that I would to use with my BBII. I just keep getting jibberish on the screen. Any one have any luck with this LCD?

This is what I tried
Code:
SEROUT 8, i19200,  [254,12 , 2, 1, "HELLOS"] '[$FE,$0C,2,1]


They had some sample code for a basic stamp

Code:
   'Brightness/Contrast
'Parameter     Length   Description
'[brightness]  1 Byte   Set backlight brightness (0 – 250)      $FE, $03
'[contrast]    1 byte   Set LCD contrast (0 – 100)              $FE, 04

'Set Cursor Position  $FE $0C [col] [row]  (0-3) AND col (0-19)
'Example:   SEROUT 1, 84, 25, [$FE, $0C, 2, 1, "text"]
'= transmit On PIN1, 9600 Baud, 25 type speed, row 3, col 2, LCD shows "text" On screen

'Clear Screen $FE $14
'Example: SEROUT 1, 84, [$FE $14]   where 1 is the pin and 84 is the baud rate

'<<<<<<<<<<<<<<<<< BEGIN TEXT CODE >>>>>>>>>>>>>>>>>>>>>>
PAUSE 2000    'I like to give the LCD 2 seconds to initialize
SEROUT 1, 84, [$FE, $0A]   'Ensures that the display is on
PAUSE 100
SEROUT 1, 84, [$FE, $14]    'Ensures that the screen is cleared
PAUSE 100
SEROUT 1, 84, [$FE, $03, 150] 'Sets the brightness (0-250)  *currently at 150
PAUSE 200
SEROUT 1, 84, 85, ["Hello World!"]    'Some text sent to the LCD, defaults to row 0, col 0
PAUSE 1500
SEROUT 1, 84, 25, [$FE, $0C, 1, 0, "This LCD is awesome"]  'Moves the cursor to row 2, col 1
PAUSE 1000
SEROUT 1, 84, 25, [$FE, $0C, 3, 1, "and easy to use"]      'Moves the cursor to row 4, col 2
PAUSE 1500        'waits 1.5 seconds
SEROUT 1, 84, [$FE, $14]  'Clears the screen
SEROUT 1, 84, 95, [$FE, $0C, 1, 2, "SLOW TEXT HERE"]     'the "95" is the type speed  (higher value = slower)
PAUSE 4000        'waits 4 seconds
SEROUT 1, 84, [$FE, $14]  'Clears the screen
PAUSE 200
'<<<<<<<<<<<<<<<<< END TEXT CODE >>>>>>>>>>>>>>>>>>>>>>


User avatar
Guru ( offline )
Posts: 4868
Posted: 2011-09-09 17:06 
 Post subject: Re: BBII with 4x20 LCD
Might help to know which LCD.

Also would help to know what else is running on the processor... Things like HSERVO, HSERIAL, or any other interrupts... I would suspect things like this if you say you sometimes get OK output and other times not.

I know that different processors and the like have a different idea what inverted versus non-inverted is. So if nothing is coming up correct, I would probably also try N19200 as well as I19200.

Kurt


Expert ( offline )
Posts: 260
Posted: 2011-09-09 17:23 
 Post subject: Re: BBII with 4x20 LCD
Kurte,
on power up I get a quick "web4robot" splash screen, then i get scrolling characthers.
In not sure of the LCD. I purchased it looking at the serial controller. this is the link to the LCD http://web4robot.com/SerialLCD.html and the controller http://web4robot.com/LCDCtrl.html
I'm just jusing it on a empty BBII with BASIC Atom Pro . I wanted to just do a plain "Hello" screen to see if it works. Then exchange the 2x16 with it.
I'll try using N19200 when i get home tonight

Thanks
Phil


Last edited by Philtkp on 2011-09-09 22:46, edited 1 time in total.

User avatar
Guru ( offline )
Posts: 4868
Posted: 2011-09-09 18:17 
 Post subject: Re: BBII with 4x20 LCD
Taking a quick look through their manual, it looks like the LCD defaults to 9600 baud rate. Can not tell from my quick look through the manual, that when you change the baud rate, it saves the new one away or if you always need to do so... But anyway try 9600 and see if you have any better luck. (Both Normal and Inverted)

Kurt


Expert ( offline )
Posts: 260
Posted: 2011-09-09 22:54 
 Post subject: Re: BBII with 4x20 LCD
Kurte
I was finally able to get it working. You were correct, I needed to first connect at 9600 baud. Then I was able to change the baudrate to 19200.
It seems to be running fine

here's my test code

Code:
serout 8, i9600, [254, 10] 'Turn on display
serout 8, i9600, [254, 20] 'clear screen
pause 200

serout 8, i9600, [254, 2, 4] 'change baud rate to 19200
pause 200                    ' 1 = 2400
                             ' 2 = 4800
                             ' 3 = 9600
                             ' 4 = 19200
Main

serout 8, i19200, [254, 20] 'clear screen
pause 200
serout 8, i19200, [254, 7]  'Display Baudrate
pause 2000
serout 8, i19200, [254, 20] 'clear screen
pause 200
'serout 8, i19200, [$FE, $0C, 0, 0, "Coloum 0 Row 0"] 'position cursor ,col, row "FORMAT WORKS"
'serout 8, i19200, [0xFE, 0x0C, 0, 0, "Coloum 0 Row 0"] 'position cursor ,col, row "FORMAT WORKS"
serout 8, i19200, [254, 12, 0, 0, "Coloum 0 Row 0"] 'position cursor ,col, row "FORMAT WORKS"
pause 2000
serout 8, i19200, [254, 12, 1, 1, "Coloum 1 Row 1"]
pause 2000
serout 8, i19200, [254, 12, 2, 2, "Coloum 2 Row 2"]
pause 2000
serout 8, i19200, [254, 12, 3, 3, "Coloum 3 Row 3"]
pause 2000
Goto Main

Thanks for the help
Phil


 

All times are UTC - 5 hours [ DST ]. It is currently 2014-07-23 14:04
Feedback Form
Feedback Form