Society of Robots - Robot Forum

Software => Software => Topic started by: BANE on July 15, 2008, 07:03:53 PM

Title: Need programming help for serial LCD in Basic
Post by: BANE on July 15, 2008, 07:03:53 PM
Hello, I have a serial LCD 20 x 4 that i'm trying to display my sharp ir variable.  I can display text but can't figure out how to stream a variable.  Any ideas?  I'm program with BasicMicro IDE 5.3.



I'll post my code if anyone wants to see it

Bane
Title: Re: Need programming help for serial LCD in Basic
Post by: airman00 on July 16, 2008, 07:14:54 AM
always post your code

To stream a variable you just say ( in pseudo code ) send serial at whatever baud and string to send is the variable

In PICBASIC you use the Serout command, but I;m not familiar with your compiler

Anyways  here are some common problems when controlling LCDs :
1. Wrong baud rate
2. Wrong connections
3. Loose connections
4. Sending noninverted signal instead of inverted ( or vice versa)
5. LCD is broken
6. Not sending serial
There are more but thats all I can think of right now.....


You know what , I think I'll write a short tutorial on controlling LCDs ... maybe later today if I have time
Title: Re: Need programming help for serial LCD in Basic
Post by: BANE on July 16, 2008, 04:19:15 PM
Quote
You know what , I think I'll write a short tutorial on controlling LCDs ... maybe later today if I have time
That would be awesome.

Code: [Select]
LCD_String = "Val:",0
gosub LCD_Print[1,0]
LCD_String = HEX2 myval\2
LCD_String(2) = 0
gosub LCD_Print[0,0]
this is only the part that prints the LCD
Is code will only display up to 2 characters?  I'm trying to display a byte, any ideas

Bane
Title: Re: Need programming help for serial LCD in Basic
Post by: airman00 on July 16, 2008, 04:24:15 PM
the byte might need conversion to a string for LCD_String to work - just a guess , I haven't worked with your compiler ever.
Title: Re: Need programming help for serial LCD in Basic
Post by: BANE on July 16, 2008, 04:40:44 PM
figured it out
 :D
Code: [Select]
main:
 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 50
   goto main

I change 2 to 3 in some places and made a dec3 instead of hex2
Title: Re: Need programming help for serial LCD in Basic
Post by: airman00 on July 17, 2008, 11:23:22 AM
BANE , may I use your code in my LCD tutorial ?

I plan to have examples of controlling LCDs in many different languages ( Assembly, BASIC, C, etc. )