LCD and driver recommandations

Hmm, :question: This code has compiling errors. It doesn’t like the “goto” commands. Was this code done with a Atom Pro? Because I have just a Atom 28 pin.

Bane

It was for the Pro. Note: I did not compile it before, but have since extracted it and compiled it on the Atom and sent it to you in a private message.

Hello again, I don’t know if you have any experience with Lynxmotion PS2 controller, but i can’t seem to run my PS2 controller and LCD at the same time. I did have the change the variable CMD to CME because the LCD part of the program is using CMD. I don’t think this should have made a difference though.

Also, how do you display a variable or something. I want to display the value of by Sharp GP12. And Ideas?

Bane

I am not at my robots right now, but I did have the LCD working with my HEX which has the PS2. I assume that if you changed a variable name, that you also changed all of the references to it as well.

I did or do at times have problems with the LCD on the Brat with the TV remote control as interrupt processing could through off the bit bang serial timings and sometimes you would get garbage at 9600 baud. It usually worked reasonably well at 2400. If you need 9600 or higher and your program services interrupts, you may need/want to try to disable them during the serial processing

that makes sense, i’ve noticed some random movements from time to time. I can put the LCD on 2400 since updating it isn’t so critical as having my SSC-32 making my biped doing backflips :open_mouth:. How are you disabling the LCD, I thought that when ever your program gets out of the LCD_print gosub command that its not recieving anymore signal?

Bane

Sorry, I may not explained it very well. What I meant to say was in order to make the LCD work properly (or for that fact any other device that relies on the bit bang functions) you may need to disable any external interrupts during the Serout command. then again I don’t think very many Atom programs use interrupts…

good luck
Kurt

I sent you a personal message, i don’t know it you received it or not but here it is.

Any ideas?

Bane

Yes, I received it and did a response. Maybe the response was lost. It was done on anotehr machine while I was on a trip.

It should not be hard to switch it to go to a 20x4 LCD. I don’t have the spec of your display in front of me right now, but the main LCD display function could be modified to maybe something like:

[code] Main LCD output function
;
line var sbyte
fPad var byte
LCD_Print[line, fPad]
; DISABLE WKPINT_3
; DISABLE TIMERAINT

if line = 1 then
gosub LCD_WriteCommand[0x80]
elseif line = 2
gosub LCD_WriteCommand[0xC0]
elseif line = 3
gosub LCD_WriteCommand[0x94]
elseif line = 4
gosub LCD_WriteCommand[0xD4]
endif

Pause(1)

for line = 0 to 18 ; try now to write to last position as it appears to autoscroll…
if fPad <> 2 and LCD_String(line) > 0 and LCD_String(line) <> “|” then
serout LCDPIN, LCD_BAUD, [LCD_String(line)]
else
if fPad = 0 then
goto LCDP_Enable
endif
fPad = 2
serout LCDPIN, LCD_BAUD, " "]
endif
Pause(1)
next
LCDP_Enable
; ENABLE WKPINT_3
; ENABLE TIMERAINT

return

;
;DISPLAY DATA RAM ADDRESSES
;CHARACTER 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
; + – -- – -- – -- – -- – -- – -- – -- – --
;LINE 1 | 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F
;LINE 2 | C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF
;
ich var byte
iline var byte
LCD_SetPos[ich, iline]
if iline = 1 then
gosub LCD_WriteCommand[0x80+ich]
elseif line = 2
gosub LCD_WriteCommand[0xC0+ich]
elseif line = 3
gosub LCD_WriteCommand[0x94+ich]
else
gosub LCD_WriteCommand[0xD4+ich]
endif

pause 10
return

[/code]

If my memory served me correctly I think I may have gotten the correct starting addresses in for lines 3 and 4 in both the main LCD print function as well as the set position. If not look at the PDF up on Sparkfuns web site. I also increased the displaying to try to use the next 4 positions. In my function I did not try to write to the last column of the display as it appeared to make the LCD autoscroll, which I did not want. There may be a way to turn off autoscroll. If so you might expand the loop to allow it to get to column 19.

Good Luck

Hey, look at all that text on 20 x 4 LCD :smiley: (sorry i’m tried) Man, your awesome. Here something else, I was just trying to stream a variable from my sharp IR. Instead of putting “__” to display text, do you just set printlcd to a variable?

bane

I have the one function: LCDConvertNumToString[iOut] that was included earlier that I used to convert a number to decimal in the LCD output string, which you can call the LCD_Print function. If you pass 0 for the line and fPad to the print function it will output at the current position.

So you can output a number with a header like:

LCD_String = "Val:",0 gosub LCD_Print[1,0] gosub LCDConvertNumToString[myVal] gosub LCD_Print[0,0]
This assumes the variable myVal has the value you want to dump. This could be any variable you have…

Another way to do the conversion is to use the basic built-in conversion functions (manual page 77 for pro). The only complication is that these functions do not automatically null terminate a string. The Null(0) is used by the LCD_Print function to know when to stop outputing. It appears like the version I posted above also terminates on a “|”…

So another way I have used to dump several variables in hex is to write the code like:

LCD_String = "Val:",0 gosub LCD_Print[1,0] LCD_String = HEX2 myval\2 LCD_String(2) = 0 gosub LCD_Print[0,0]
In the above example I use this if I know the value is in the range of 0-255 and I simply want to output 2 hex bytes.

I hope this makes sense

Kurt

P.S. - I did not try compiling the examples I just showed so your millage may differ. Also I again am mainly used to the Pro so not 100% sure if the builtin conversion functions are available on the non-pro…

thanks, i had ot make some modifications to make it workmain: adin ax0,1,ad_ron,ir LCD_String = "IR range value: |",0 gosub LCD_Print[1,0] LCD_String = dec3 ir\3 LCD_String(3) = 0 gosub LCD_Print[0,0] PAUSE 200 goto main

However, i still can’t do math with the ir variable to display in inches. I’ve tried both codes and they just get stuck on the first value

Bane

I am not sure from your last post if the problem is in the LCD displaying stuff or if the problem is with the adin not updating with new values…

You might want to try outputing the value to a debug terminal and see if the value is what you are expecting…

Kurt

Is this the one you talk about ?
sparkfun.com/products/9568

Yes, he did post the same link at page two…

Hrmm… sorry, i missed it :blush:

… and talking about robotstuff, , can you rekommend some shop who has “everything” and possibly alittle nearer than USA or HongKong, and who maby has this LCD ??? (you and me being scandinavian…)

So far I’ve not found any web-shop that can match them. I’ve used ELFA.se and electrokit.se sometimes though. Also active-robots.com.

BTW, I just found that LCD display at lawicel-shop.se/shop/ (sparkfun/LCD’s) for 202 SEK eks moms.

good
Ive just orderd it from lawicel-shop, and i am hoping for great support from the community if i am going to get it working… :mrgreen:

I got it now
and if you do as i do: order a nice display :laughing:
dont do as i do: think you have a conector at home just because you have a bunch of JST-conectors :unamused:

The display had the JST S3B-PH connector with just 2mm between the pins … and NOT 0.1 as all other
(its the same connector as the Sharp sensors have)