Author Topic: Need programming help for serial LCD in Basic  (Read 4156 times)

0 Members and 1 Guest are viewing this topic.

Offline BANETopic starter

  • Supreme Robot
  • *****
  • Posts: 639
  • Helpful? 4
  • E=roboticsC^2
Need programming help for serial LCD in Basic
« 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

Offline airman00

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 3,650
  • Helpful? 21
  • narobo.com
    • Narobo.com - Mechatronics and related
Re: Need programming help for serial LCD in Basic
« Reply #1 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
Check out the Roboduino, Arduino-compatible board!


Link: http://curiousinventor.com/kits/roboduino

www.Narobo.com

Offline BANETopic starter

  • Supreme Robot
  • *****
  • Posts: 639
  • Helpful? 4
  • E=roboticsC^2
Re: Need programming help for serial LCD in Basic
« Reply #2 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

Offline airman00

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 3,650
  • Helpful? 21
  • narobo.com
    • Narobo.com - Mechatronics and related
Re: Need programming help for serial LCD in Basic
« Reply #3 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.
Check out the Roboduino, Arduino-compatible board!


Link: http://curiousinventor.com/kits/roboduino

www.Narobo.com

Offline BANETopic starter

  • Supreme Robot
  • *****
  • Posts: 639
  • Helpful? 4
  • E=roboticsC^2
Re: Need programming help for serial LCD in Basic
« Reply #4 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

Offline airman00

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 3,650
  • Helpful? 21
  • narobo.com
    • Narobo.com - Mechatronics and related
Re: Need programming help for serial LCD in Basic
« Reply #5 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. )
Check out the Roboduino, Arduino-compatible board!


Link: http://curiousinventor.com/kits/roboduino

www.Narobo.com

 

SMF spam blocked by CleanTalk