LCD serial backpacks


Closed Thread
Results 1 to 40 of 68

Hybrid View

  1. #1
    Join Date
    Oct 2006
    Location
    Cape Town SA
    Posts
    23

    Default Much simpler for newbie like me

    That code with interupts and all is pretty hot, but going back to the very first question all he wanted to do was emulate a serial LCD, ie PIC is doing nothing else. I knocked this up yesterday and it works, and doesn't miss anything, very simple - like me! Go on eat me alive!

    A back space key tells pic next char is a command - see commands in the select case area
    A double back space makes it spit out a pangram back at you.


    DEFINE LCD_DREG PORTC 'DATA PORT
    DEFINE LCD_DBIT 4 'STARTING BIT (0 OR 4)
    DEFINE LCD_RSREG PORTC 'REGISTER SELECT PORT
    DEFINE LCD_RSBIT 1 'REGISTER SELECT BIT
    DEFINE LCD_RWREG PORTC 'READ/WRITE SELECT PORT
    DEFINE LCD_RWBIT 2 'READ/WRITE SELECT BIT
    DEFINE LCD_EREG PORTC 'ENABLE PORT
    DEFINE LCD_EBIT 0 'ENABLE BIT
    DEFINE LCD_BITS 4 'BUS SIZE (4 OR 8)
    DEFINE LCD_LINES 2 'LINES IN DIPLAY
    DEFINE LCD_COMMANDUS 2000 'CMD DELAY TIME IN uS
    DEFINE LCD_DATAUS 50 'Data DELAY TIME IN uS
    define Osc 4
    '************************************************* ***********
    ADCON1 = 7 'disable A/d work digital
    TRISB = %00000000 'unused port b set to o/p
    TRISA = %00000000 ' PortA outputs
    TRISC = %00000000 ' PortC outputs
    OPTION_REG.7 = 0 ' Enable PORTB pull-ups

    'T2400 con 16780 '2400bd, driven, inverted, no parity
    T2400 con 396 '2400bd, driven, true, no parity
    'will need to use rs232 inverter
    comsout var PORTA.0
    comsin var PORTA.1
    datarray var byte[1] 'incoming array on rs232
    '************************************************* ***********
    start:
    Pause 500 ' Wait for LCD to startup
    Lcdout $FE, $0C 'turn cursor off


    Lcdout $fe, 1 ' Clear LCD screen
    Lcdout $fe, 2 ' go home
    Lcdout "GPL PIC System"
    Lcdout $FE, $C0 'move cursor to begin of line 2
    Lcdout "Serial in at ",DEC T2400

    Pause 1000 ' Wait 1 second
    Lcdout $fe, 1 ' Clear LCD screen
    '************************************************* ***********
    main: while 1 'forever loop
    serin2 comsin, T2400, [ datarray[0]] 'get a char
    if datarray[0] = 8 then 'next byte is a LCD command after BS received
    serin2 comsin, T2400, [ datarray[0]]
    select case datarray[0]
    case 48 '0 = Clear LCD screen
    Lcdout $fe, 1
    case 49 '1 = move cursor to begin of line 1
    Lcdout $fe, 2
    case 50 '2 = move cursor to begin of line 2
    Lcdout $fe, $C0
    case 51 '3 = move cursor to begin of line 3
    Lcdout $fe, $94
    case 52 '4 = move cursor to begin of line 4
    Lcdout $fe, $D4
    case 8 'BS again so transmit a pangram
    gosub send
    case else 'do nothing
    end select
    else
    Lcdout str datarray\1 'show 1 char to LCd
    endif
    wend

    send: serout2 comsout,T2400,["How quickly daft jumping zebras vex",13,10]
    return
    '************************************************* ***********

    END
    '************************************************* ***********

  2. #2
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818

    Default Now Why Would Anybody Do That ?

    Quote Originally Posted by websmith
    Go on eat me alive!
    THERE ALWAYS MULTIPLE WAYS OF DOING ANYTHING. There is nothing wrong with brewing an alternative, I will study your code and learn something from it, therefore I am grateful for your post. Thank You, JS

  3. #3

    Wink

    hey joe! almost started singing that hendrix song. lol. Did you ever finish polishing off the bells and whistles? i'm a newbie and already tired of all the display wires, which keep getting pulled out of the breadboard! weeeeeeee

  4. #4
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818

    Default

    Quote Originally Posted by nomad View Post
    hey joe! almost started singing that hendrix song. lol. Did you ever finish polishing off the bells and whistles?
    Ya' Know, it works really well as is, after Darrel converted it to instant interrupts, and I have been doing everything but. What I intend to add is really just some unimportant fluff anyway, take the code off Darrel's post #16, it works quite well as is.
    JS
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  5. #5
    Join Date
    Jul 2007
    Posts
    65

    Default

    Nice to find some code already made for serial LCD, I just burned the backpack on my cool Serial LCD

    no prob, I had 4 LCDs waiting for me to drive them with a16F628

    I just tried the code with INstant interupt, which took me an hour to setup the whole thing to compile(not bad actually), but now I see only stranges characters appearing on the LCD.

    like I send "b" char, and the dipslay will do '

    do I need to create a map of matching characters, or is there a tweak to get the correct display?

    in attached picture, I've sent AAAAAAAAAAAAaaaaaaaaaa using the serial communicator from Mecanique,
    it displayed ___________________000000000000000 on the LCD?


    it's driven by a 16F628a, running at 20mhz
    Display is 4x20 from Orient Display, saying it's requiring a S6A0069 and is compatible with HD44780 4/8bit.
    http://character-lcd-lcds.shopeio.co...haracter%20Lcd

    I've blanked all define to run from default except for
    DEFINE LCD_LINES 4
    because I ain't know how to tweaks all the parameters.
    Started to play with other defines but not luck yet.

    maybe the answer is in there?
    Attached Images Attached Images  

  6. #6
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818

    Default

    Quote Originally Posted by flipper_md View Post
    Nice to find some code already made for serial LCD, I just burned the backpack on my cool Serial LCD

    no prob, I had 4 LCDs waiting for me to drive them with a16F628

    I just tried the code with INstant interupt, which took me an hour to setup the whole thing to compile(not bad actually), but now I see only stranges characters appearing on the LCD.

    like I send "b" char, and the dipslay will do '

    do I need to create a map of matching characters, or is there a tweak to get the correct display?

    in attached picture, I've sent AAAAAAAAAAAAaaaaaaaaaa using the serial communicator from Mecanique,
    it displayed ___________________000000000000000 on the LCD?


    it's driven by a 16F628a, running at 20mhz
    Display is 4x20 from Orient Display, saying it's requiring a S6A0069 and is compatible with HD44780 4/8bit.
    http://character-lcd-lcds.shopeio.co...haracter%20Lcd

    I've blanked all define to run from default except for
    DEFINE LCD_LINES 4
    because I ain't know how to tweaks all the parameters.
    Started to play with other defines but not luck yet.

    maybe the answer is in there?
    You have to send the data true, if you send it inverted for some reason then invert it again with a transistor to get true. If you change the defines for the LCD this code will work with the PC boards sold by wulfden too.
    here is a snippet to give you an idea of how to format your code
    serout PortB.4,T9600,[254,128,"9600 baud line 1 T~"] '128 so as not to add space
    serout PortB.4,T9600,[254,192,"9600 baud line 2~"]
    pause 100
    Last edited by Archangel; - 13th October 2008 at 10:17.
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  7. #7
    Join Date
    Jul 2007
    Posts
    65

    Default

    well, for some esoteric reasons the thing started to work by itself after a few restart... this I hate
    I noticed one time i've got one capacitor disconnected on the Xtal... and it seems the PIC woulndt bother?? replugged it live and it kept working.


    since I was sending data from a PC, I assume it was regular RS232.
    Tried to get data from my PIC heartbeat system(which is using N9600) and as you said this format is not ok as is, text was garbaged. I'll need a max232 one day to invert signal.

    In the little time I had to play with the thing, I wondered how I could send data to drive other functions, else than display text?
    Can I do custom characters?
    clear screen? etc

    Another weird thing is that the LCD believe it's second line is the 3rd, when I send a long text. It start filling 1st, then 3rd, then 2nd, and finally 4th one?

    anyways I was just sooooo happy to see some text scrolling


    BUT, this morning it doesn't wan't to behave again, showing garbage text with the same steup! arg :/
    I suspect power problem from my regulator, although it's rated for 1amp.
    it's running way too hot when I plug the backlight of this 4lines monster. I guess this may cause some power problems.
    Actually, this is what fried my other LCD! PLugged in too many things, the regulator busted and started shooting 10V or so...smoke show B]

    for now I just keep doing short tests.

    thanks for the infos!

Similar Threads

  1. 16f688 LCD what have I done wrong
    By spitfiredriver in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 8th August 2009, 20:54
  2. Please help with EDE702 - Serial to LCD interface
    By Tomexx in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 30th October 2008, 03:48
  3. Play with LCD on PICDEM
    By The IceMan in forum mel PIC BASIC
    Replies: 5
    Last Post: - 22nd August 2008, 17:56
  4. Serial LCD
    By Tobias in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 15th November 2007, 09:31
  5. Need help with LCD number display.
    By Steve Matson in forum mel PIC BASIC
    Replies: 8
    Last Post: - 27th June 2007, 00:07

Members who have read this thread : 2

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts