Shop OBEX P1 Docs P2 Docs Learn Events
Using the #27977 dislay — Parallax Forums

Using the #27977 dislay

elabuddeelabudde Posts: 6
edited 2009-03-15 15:22 in BASIC Stamp
Hi all, newbie here. I just purchased a #27977 LCD display because it has a one wire interface.

I have programmed a 16F88 with Great Cow Basic see: http://gcbasic.sourceforge.net/

It has syntax similar to Pic Basic.
I use this to set up the USART: InitSer 1, r2400, 1, 8, 1, none, invert.

I use invert so as to reproduce the waveform shown here for the letter “K” (see: http://en.wikipedia.org/wiki/RS-232).
I can send this data using sersend 1, 75 (dec value for “K&#8221[noparse];)[/noparse] or serprint 1, “K” . I have verified that both commands are identical and exactly the same as see on Wiki

The LCD display prints out mostly HiHiHi and a few * and \. The funny thing is that it never puts out the same character twice! Question: is the format for the display normal or inverted? Is it 2400, 1, 8, 1 no parity? I have tried all combinations of parity (none, even, odd) and normal and inverted nothing works! Any suggestions as to what I am doing wrong?

Much thanks, Ed.

Here is the code:
#chip 16F88, 8
#config INTRC_IO



#define SendAHigh Set PORTB.2 on
#define SendALow Set PORTB.2 off
#define Button PORTA.0

Dir Button In 'pin 17
Dir PORTB.2 Out 'pin 8
Wait 150 ms

InitSer 1, r2400, 1, 8, 1, none, invert

Do

SerSend 1, 75
wait 100 ms
serprint 1, "K"
Wait 100 ms
Loop

Comments

  • ZootZoot Posts: 2,227
    edited 2009-02-24 22:17
    The LCD is TTL level serial, so don't invert. RS-232 is inverted with neg/pos voltages for transmission to PCs and the like over long wires.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    When the going gets weird, the weird turn pro. -- HST

    1uffakind.com/robots/povBitMapBuilder.php
    1uffakind.com/robots/resistorLadder.php
  • elabuddeelabudde Posts: 6
    edited 2009-02-24 22:25
    Zoot, Thank you for the speedy reply. Now I know the standard. I tried normal , however, it does not work right either.
    Still ket a bunch of erratic nonsense on the screen! Regards, Ed.
  • ZootZoot Posts: 2,227
    edited 2009-02-24 22:43
    OK

    1. For reals, have you read the datasheet and manual for the serial display? If not, hit the books, then come back.

    2. Triple-check the no-brainer stuff -- are your connections correct, power correct, etc. Hook up an LED to your serial pin (LCD disconnected) and load some code to toggle the led on and off (in other words, makes sure the pin works).

    3. can't help with PIC code, sorry, but are you sure your uart is correct? Seems to be on pin1 but you set pin2 to be the output for serial in your defs? Maybe someone else w/PIC experience can chime in here.

    4. check your dipswitch baud setting on the LCD (see step 1).

    5. convert the sample parallax code (it's Stamp-based but should be simple to change). Note that the serial pin is set high immediately and then the program waits, before trying to send any serial code. Note also the Parallax example is 19.2k baud (not sure what default settings ship on the baud dipswitch).
     
     
      HIGH TxPin                      ' Set pin high to be a serial port 
      PAUSE 100                       ' Pause for Serial LCD to initialize 
     
      SEROUT TxPin, Baud19200, [noparse][[/noparse]"Hello, this text will wrap."]
    
    

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    When the going gets weird, the weird turn pro. -- HST

    1uffakind.com/robots/povBitMapBuilder.php
    1uffakind.com/robots/resistorLadder.php
  • elabuddeelabudde Posts: 6
    edited 2009-02-24 23:06
    zoot said: OK

    1. For reals, have you read the datasheet and manual for the serial display? If not, hit the books, then come back.

    Read it 2-3 times!!

    2. Triple-check the no-brainer stuff -- are your connections correct, power correct, etc. Hook up an LED to your serial pin (LCD disconnected) and load some code to toggle the led on and off (in other words, makes sure the pin works).

    Have used this pic for numerous experiments, The pin works, I have an oscilloscope hooked up to it and can see it sending out the bits very 100 ms

    3. can't help with PIC code, sorry, but are you sure your uart is correct? Seems to be on pin1 but you set pin2 to be the output for serial in your defs? Maybe someone else w/PIC experience can chime in here.

    I am using the sample code from the GCBasic help file That is the way they set it up. PortB.2 is serial channel 1

    4. check your dipswitch baud setting on the LCD (see step 1).

    Checked it several times!

    5. convert the sample parallax code (it's Stamp-based but should be simple to change). Note that the serial pin is set high immediately and then the program waits, before trying to send any serial code. Note also the Parallax example is 19.2k baud (not sure what default settings ship on the baud dipswitch).

    "SEROUT TxPin, Baud19200, [noparse][[/noparse]"Hello, this text will wrap."]

    GCBasic for this command is serprint 1, "Hello, this test will wrap" The baud is set by the initser command to 2400

    This does not work either!! I am really stumped! regards, Ed.
  • ZootZoot Posts: 2,227
    edited 2009-02-24 23:21
    Somebody said...
    4. check your dipswitch baud setting on the LCD (see step 1).

    Checked it several times!

    And it is set to 2400 baud to match your UART? Yeh, seems like it should work, then. I'll presume you have a resonator/crystal or other accurate clock source for the PIC?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    When the going gets weird, the weird turn pro. -- HST

    1uffakind.com/robots/povBitMapBuilder.php
    1uffakind.com/robots/resistorLadder.php
  • elabuddeelabudde Posts: 6
    edited 2009-02-24 23:29
    Zoot, thanks for the reply. Yes they are both set to 2400 (switch 1=on, 2=off). I have been seaching the net and found that one has to send a high to the LCD for 100 ms as in:
    From here: http://hades.mech.northwestern.edu/wiki/index.php/C_Example:_Serial_LCD

    Turn on the LCD by placing the communication pin high for 100mS
    output_high(PIN_A0);
    delay_ms(100);

    Send the LCD a character to initialize the screen. A list of characters (0-255) and what they do appears in the manual. It is a good idea to add a slight delay after outputting to the LCD to avoid the LCD missing signals.
    putc(25); //turn lcd on, cursor on and character blink
    delay_ms(1);
    putc(17); //backlight on
    delay_ms(1);

    I will try this tomorrow, I put my stuff away, and it is Gin & Tonic time! Best regards, Ed.
  • elabuddeelabudde Posts: 6
    edited 2009-02-26 22:12
    Sorry for the delay, forgot I had to attend a furneral yesterday. Any way I have verified that the resonator is 19.9988 MHz.
    I have verified the pulse train sent out is for the commands is correct to the RS-232 protocol for the command numbers I am sending out, and the timing (pulse time) is correct as well. I send it the 100 ms high before transmitting: serprint 1, "Hello World"

    Still does not work! BTW is it necessary to send out the high for 100 ms for evry write or just the first one?

    I can not proceed as my programmer went on the fritz!

    When I get more data I will reprt back. Ed.
  • ZootZoot Posts: 2,227
    edited 2009-02-26 23:59
    So it's all correct, but it doesn't work? Hmm. (half a joke there). Unless you have reasons to suspect defective hardware, something must be amiss. I don't have spec in front of me; a longer pause at startup is certainly indicated, and I would say putting in a 5ms pause after each command would be wise *until you get it working*. You are not inverting the serial signal? Can you post current code AND schematic/photo of your wiring?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    When the going gets weird, the weird turn pro. -- HST

    1uffakind.com/robots/povBitMapBuilder.php
    1uffakind.com/robots/resistorLadder.php
  • elabuddeelabudde Posts: 6
    edited 2009-03-15 15:01
    Hi all, finally got an LCD to work! After wasting three days on the 27977, I gave up and bought at Scott Edwards, BPI-216. It worked on the first try! I am happy now. Ed.
  • Mike GreenMike Green Posts: 23,101
    edited 2009-03-15 15:22
    The #27977 is a very nice, very reliable LCD that's been around for quite a few years. Like most of Parallax's products, it was designed for use primarily with the Stamps. It's tested that way and the documentation is very thorough for that use. It should be usable with any other microcontroller that can do serial I/O at TTL levels as described in the documentation. That said, the problems you've encountered are not uncommon when trying to combine hardware and software from different vendors. Sometimes one vendor doesn't tell you something that doesn't matter with their other hardware. Sometimes the programming language's assumptions are not fully stated. Sometimes you've misread an item in the documentation. There are all sorts of reasons for things not to work or to require some kind of magic that's not obvious from the manual or other documentation. Good that you've found something that works for you.
Sign In or Register to comment.