Pic 28x1 and LCD corrupt characters

dmsvenom

New Member
Hi
I have just discovered the world of PICAXE after wanting to make a digital dasboard for my car.
I have bought a prebuilt 28x1 darlington board (ext resonator) from Rev-Ed and a serial LCD display and driver (ext resonator) from P Anderson.
When i attach the 2 together the sample program supplied by P Anderson appears 'garbled' by the time it displays on the screen.
I have tried using 4.5 and 6 volt batteries and 5.0v from a regulated PSU. This seems to make no difference (except to the contrast on the display).
There is an 18 pin chip on the LCD display.
Any ideas greatly welcomed as this is all very new to me.
Cheers
Kevin
 

BCJKiwi

Senior Member
Depending on the Anderson unit you purchased , and the serial out you are using, their could be a serial speed mismatch.

I have a PHAnderson LCD kit (with the driver board etc) but chose the #117 that runs at a fixed 9600 baud so have to run the 14m I use for testing at 8MHz using the standard (programming connection) terminal output. The #118 runs at 2400 baud.

With the #117 I find some characters appear garbled but seem mostly to do with the character set.

I also found the regulated 5V supply rail is very noisy when this unit is connected.
 

BeanieBots

Moderator
Also worth double checking the serial polarity.
Try using the other polarity even if just to eleiminate it.

Who's going to start the bit about using micros in cars?
I'm fed up with it now!
 

dmsvenom

New Member
Thanks for the replies.
I specifically bought the picaxe 118? version that runs at 2400 as it was marketted as a compliment to the picaxe.
This is only to display 'useless info' on the dash, so it is non critical if it is unstable.
I did a search through the forums before posting, and the most common prob seems to be resonator frequency, temp, voltage or dry joints.
Seeing as the kits were proffessionally made hopefully dry joints/bad design can be ruled out. I have tried several power sources all seem to be the same. I have nothing to check frequencies with, and i have not heated/cooled anything up/down as if this is a prob indoors, i hate to think what it will be like in an open topped car (it will be weather protected :) ).
I am new to this subject, so can you clarify what you mean by changing the polarity (don't presume you mean battery connections for 1 minute). Seeing as there is only 1 wire feeding between the out0 and serial lcd, even i can't get that wrong.
The garbled info always seems to come as the same garbled characters.
Thanks so far.
Kevin
 

BCJKiwi

Senior Member
Check the serout command on page 142 of section 2 of the manual.

Use the format that suits the clock speed of the chip and delivers 2400 baud e.g. T2400_8 (change the 8 to suit the speed).
You could try both N and T if you are not sure which is correct.
 

dmsvenom

New Member
I have tried the code below (downloaded from P Anderson website) and it brings up ' yen symbol 3. There is something awry with this.

High 0 ' Be sure Tx Pin is idle for some time
Pause 5000 ' wait for PICAXE LCD to boot


SerOut 0, T2400_4, ("?G420") ' configure LCD as 4 X 20
SerOut 0, T2400_4, ("?f") ' clear the LCD and home the cursor

Pause 100

Cheers
Kevin
PS Website :-

http://www.phanderson.com/lcd106/lcd108.html
 

dmsvenom

New Member
I have tried the N2400 and i am getting closer. I can now output anything in " " to the screen and it appears fine. I am now trying to get to grips with serout 0, n2400, (b1) where b1 is a numerical value. All i seem to get is text coming up on the screen (looks like the top row of a pc keyboard !"£$%^&*()0123456789 etc) instead of the numerical value.
One step closer tho :), so thankyou all so far.
Cheers
Kevin
 

lbenson

Senior Member
dmsvenom--a "#" in front of your register will give you the ascii (printable, displayable) representation of the number in your register, e.g.,
serout 0, n2400, ("This is the value: ", #b1)
 

Tom2000

Senior Member
If your garbled characters are random, it's probably a timing issue. Try a 'pause 50' after each write to the LCD118 chip, or a 'pause 1000' after every write to the LCD118's EEPROM.

If the garble is determinate, carefully check the data that you're sending the LCD118 to make sure that the character is the one you expect, and that it falls within the 118's character set.

Review the LCD118's data sheet to ensure that you've wired the option pins correctly.

When initializing the 118, pause at least 1000 mSec between writes to the 118. (I've included a sample LCD118 initialization routine below.)

Good luck!

Tom


Code:
InitLCD118:

  ;  I think the only configuration command that's really necessary is the one that
  ;  matches the LCD-118 to your display geometry.  Refer to the cited web page for
  ;  the accepted geometry syntax
  
  ;  I've found that these initialization pauses need to be longer than expected
  ;  to avoid failed initializations.

  write BootLCD,1                     ; Suppress future LCD init calls
  
  serout 7,T2400,("?G216")            ; 16 x 2 LCD geometry  
  pause 1000
  serout 7,T2400,("?B00")             ; Backlight off.  ?B00 through ?BFF range
  pause 1000
  serout 7,T2400,("?c0")              ; Cursor off.  ?c3 = blinking cursor
  pause 1000
  serout 7,T2400,("?C0  LCD-118 Demo  ")    ; Set custom signon message:  1st line (16 char)
  pause 1000
  serout 7,T2400,("?C1  tjl 6/26/07   ")    ; Set custom signon message:  2nd line (16 char)
  pause 1000
  serout 7,T2400,("?S2")              ; Display custom message at boot  
  pause 1000
  
return
 

dmsvenom

New Member
Thanks everyone
I have now tried the N2400 command and all seems fine. It appears that the code that P Anderson suggests on his website was wrong in the first place as all the serout commands read T2400.
One other weird thing is that if you run his demo (corrected for N2400) then it gets to the PWM demo part of the program, the LCD brightness starts to step up, then it completely blanks the screen. Even a power cycle of the LCD makes the display light up briefly but then goes straight off again.
It appears the LCD remembers the setting it was given from his demo program and shuts the screen off completely.
I have re run the program and quickly disconnected the LCD screen as it gets to the part of the program when it starts to change the brightness of the screen.
Thanks again everyone, i am a happy bunny till the next problem :).
Cheers
Kevin
 

pha555

Senior Member
You have the strap set on the LCD #118 unit for inverted operation, and thus use N2400. But, if you moved the strap, T2400 would be correct.

Yes, in the demo, I run the backlight up to max and then turn it off. The last backlight setting is saved to EEPROM.

On startup, simply;

serout 7,N2400,("?B40")

or whatever setting you desire. This need be done only once.

P H Anderson, http://www.phanderson.com/picaxe/
 

dmsvenom

New Member
Thanks for the reply.
I have been playing with the screen and now i am geting the swing of things i am enjoying it (as apposed to getting frustrated playing with something i have little knowledge of).
The 'tone' of the post was not supposed to be one of moaning about your product, i was just frustrated i could not get it working properly.
Cheers
Kevin
 
Top