Shop OBEX P1 Docs P2 Docs Learn Events
SX28 Parallel to 2X40 LCD — Parallax Forums

SX28 Parallel to 2X40 LCD

John BondJohn Bond Posts: 369
edited 2006-07-03 10:48 in General Discussion
Hi Guys

Does anyone have some simple SXBasic code to write a line of text from an SX28 to a 4 or 8 bit parallel 2X20 LCD. I’ve been battling with the example in the help menu as well as two of the VPs. I am a simple soul and I'm getting·very confused.

I need to display a couple of different messages depending on three inputs. I'll store the messages as DATA

Kind regards from Kwa Dukuza
John Bond

Comments

  • DigitalManDigitalMan Posts: 42
    edited 2006-06-29 12:48
    I've done it with a BS2,·I assume it wouldn't be much different for an SX. Assuming it's using the standard LCD controller chip, you just need to time the Enable, RS, and RW lines correctly with your parallel output. Specifically, make sure the data is ready before triggering the read sequence. As far as I know, the screens use standard ASCII codes for the characters, so just grabbing a character from your data array and dropping it straight into the parallel I/O port ought to work for that.

    As for actual code, I'll have to check for differences between PBASIC and SX/B, maybe I can give you mine. It's not exactly optimized, though.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chicks dig nerds... but not until after the prom.
  • BeanBean Posts: 8,129
    edited 2006-06-29 13:20
    John,
    Look in the SX/B help under Example Project->Serial LCD

    It's kind of misleading, the project is a serial interface to a parallel LCD.

    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Cheap 4-digit LED display with driver IC·www.hc4led.com

    Low power SD Data Logger www.sddatalogger.com

    "I reject my reality, and substitute yours." NOT Mythbusters
    ·
  • DunnseptDunnsept Posts: 115
    edited 2006-06-29 13:21
    John Couture wrote an example program for a 4x20. His code is nicely commented and it shouldn't take much to change it to the 2x20
    http://forums.parallax.com/showthread.php?p=591741

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    stand back! I have a slide rule and I know how to use it!
  • John BondJohn Bond Posts: 369
    edited 2006-06-29 14:12
    Hi Guys

    Thanks for your quick response...

    1. The SX is a bit different to BS2. For starters, it seems like you pass veriable to your SUBs rather than just using variables I regard myself as very proficiant on Stamp2s and LCDs, thats why I'm so frustrated...
    2. I said in my intro - I’ve been battling with the example in the help menu - I meant the SXHelp Menu examples. Ive stripped out the UART from the example and the remaining code doesn't work.
    3. Dunnsept, thanks for the pointer to that code. The code is for LCDs with a totally different interface from the traditional LCD (2 reset pins but only 3 data pins!) but this may give me some direction on how to do it. The code is VERY WELL DOCUMENTED

    Thanks John Couture for such well documented code - 17 pages in all

    Kind regards
    John Bond
  • BamseBamse Posts: 561
    edited 2006-06-29 15:07
    John,

    I converted the Parallax 2x16 BS2 code to my 2x12 LCD.
    Keep in mind you need to hook up the LCD for 4 bits as in the Parallax documentation...

    Besides that E goes to RB.0, RW to RB.2, RS to RB.3 and the four databits are RB.4 to RB.7...

    Have fun...

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Living on the planet Earth might be expensive but it includes a free trip around the sun every year...

    Experience level:
    [noparse][[/noparse] ] Let's connect the motor to pin 1, it's a 6V motor so it should be fine.
    [noparse][[/noparse] ] OK, I got my resistors hooked up with the LEDs.
    [noparse][[/noparse]X] I got the Motor hooked up with the H-bridge and the 555 is supplying the PWM.
    [noparse][[/noparse] ] Now, if I can only program the BOE-BOT to interface with he Flux Capacitor.
    [noparse][[/noparse] ] I dream in SX28 assembler...

    /Bamse
  • DunnseptDunnsept Posts: 115
    edited 2006-06-29 15:49
    One thing that tripped me up at first when I ported the BS2 code to SX/B is that in sx/b the serout command can only send a byte. in Pbasic you can basically send an entire string and not worry about it.
    also just in case I missed it, all of the code, as far as I know, is going to be for a hitachi HD44780 controller. as long as your LCD has that chip or a compatible one, you should be set.
    bamse's code is similar to mine and should work just fine for you as we both converted existing pbasic code

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    stand back! I have a slide rule and I know how to use it!
  • John BondJohn Bond Posts: 369
    edited 2006-06-30 08:44
    Hey Bamse - Clean, understandable and 4 bit into the bargain!!!

    As the Zulus round here would say "You are a mamba, Ngiabonga baba". It seems strange to pay you a compliment by calling you a snake and then thank you as an ancient man (baba) but I assure you it's the highest compliment I can pay you.

    Hey Dunnsept, Do you really have a slide rule... I chucked mine out about 5 years ago but I still have my 50 year old Facit crank (mechanical) calculator. I've forgotten how to devide on it though.

    Thanks for all the help and kind regards from Darkest Africa
    John Bond
  • John BondJohn Bond Posts: 369
    edited 2006-07-03 10:48
    Hey Guys,

    I'm not as stupid as I thought - The LCD is a NoNameBrand of a type I've not used before and the protocol is a bit different (We never get the spec sheets...). The moment I had code that I knew worked, it took me 15 minutes to find the problem.

    Maybe I should have got it working on a BS2 first.

    Thanks again
    John
Sign In or Register to comment.