Shop OBEX P1 Docs P2 Docs Learn Events
Trouble using serial lcd, probably just due to my lack of experience. — Parallax Forums

Trouble using serial lcd, probably just due to my lack of experience.

P!-RoP!-Ro Posts: 1,189
edited 2008-10-07 00:01 in Propeller 1
I've been trying over and over again to get the Debug_Lcd object to work but I can't seem to get anywhere. Since I have no other source of output right now, I've been using leds to tell me where I'm having problems in the code. For some reason every time I try turning the display on, I don't have it come back again. Or, in other words, it just hits a dead end when I try turning·the lcd·on instead of it going back to the pub and turning on the second led. I've checked and re-checked on the variable inputs, but it just won't work. Any help would be appreciated as I wrap my head around the concept of doing everything manually instead of the quick n' easy serout command.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
The Pi Guy

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2008-10-05 04:28
    It's pretty impossible to advise you on either the LCD problem or the LED problem without a lot more information. I suggest you post a schematic of your setup or a detailed description at least along with a copy of your source program as an attachment to your message.
  • P!-RoP!-Ro Posts: 1,189
    edited 2008-10-05 04:41
    I've tried both using a 1k resistor from pin 15 to the lcd, and just directly connecting the two. I wasn't exactly sure if it was necessary, so I tried it any way. The leds are connected to pin 5 and 6, with one of them going on when it starts, going off after running pub init, and *supposedly* going on again after the lcd turns on again. I was also going to try and display characters (if I can figure out how to) and change the cursor position, but I would at least like it to go back to the original pub first before I try adding any more commands.

    P.S., congrats Mike on your recent achievement! past·and present


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    The Pi Guy

    Post Edited (I LIKE PI) : 10/5/2008 7:24:18 PM GMT
  • P!-RoP!-Ro Posts: 1,189
    edited 2008-10-05 19:25
    Do any of you at least have a working lcd program that will display some text? It would at least be nice to see if my problem is just my programming, and nothing with my circuit or electronics.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    The Pi Guy
  • TimmooreTimmoore Posts: 1,031
    edited 2008-10-05 20:03
    You are going to have to explain what you have wired up and post your code. The serial lcd, has 3 pins, rx which should be connected to a prop pin, +5 and gnd which should be connected to power. You mention leds about what are they and what are you trying to do with them? How is that related to the lcd?
  • SuperCricketSuperCricket Posts: 17
    edited 2008-10-05 20:11
    The debug LCD code should work good. Are you using the 4 line LCD from Parallax? If so it has two jumpers on the back for a test mode. You can flip them both up and get the screen to display Parallax, Inc.

    Also note, I fried one of our LCDs by picking it up the other day. Must have been static discharge. They seem to be VERY easy to kill with ESD.
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2008-10-05 21:15
    I just happen to be working on that chapter this afternoon.

    Perhaps I'll peel off a sneakpeek of that section and post it with some code.

    Couple questions: Which Propeller setup are you using? PPDB, demoboard, PEkit, protoboard?
    and I assume you are working with the newer 4 line unit?

    OBC

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    New to the Propeller?

    Getting started with a Propeller Protoboard?
    Check out: Introduction to the Proboard & Propeller Cookbook 1.4
    Updates to the Cookbook are now posted to: Propeller.warrantyvoid.us
    Got an SD card connected? - PropDOS
  • Bobb FwedBobb Fwed Posts: 1,119
    edited 2008-10-05 21:36
    An early mistake I made was not having the clock speed high enough for 9600 baud (you need 40MHz -- PLLX8 with 5MHz xtal1) or 19.2K baud (80MHz -- PLLX16). Also, be sure (if you aren't using a parallax proto board) to have your regulated power to have a decent size capacitor on there, because noisy power can cause the high PLL (X8 or X16) to not function.
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2008-10-05 21:45
    Here's a rough draft of my Cookbook text on the subject.

    Let me know if it helps

    OBC

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    New to the Propeller?

    Getting started with a Propeller Protoboard?
    Check out: Introduction to the Proboard & Propeller Cookbook 1.4
    Updates to the Cookbook are now posted to: Propeller.warrantyvoid.us
    Got an SD card connected? - PropDOS
  • P!-RoP!-Ro Posts: 1,189
    edited 2008-10-05 23:21
    Sorry OBC, but the code isn't working. I changed the 4 to a 2, like I was supposed to (my screen just displays two lines) and I double-checked the baud, but it still isn't working. It still works well when I show the test, though, but it won't show words. Just the cursor_in home position.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    The Pi Guy
  • sylvie369sylvie369 Posts: 1,622
    edited 2008-10-06 00:20
    This is some simple code that uses the LCD (Parallax 4x20 Serial). It's the start of a little piece I put together to learn to use the mouse. The LCD is connected through pin 0, using a 1K resistor.
    =======================================
    Con

    _clkmode = xtal1 + pll16x
    _xinfreq = 5_000_000

    Var
    byte X
    byte Y
    byte Temp1
    Obj
    LCD : "Debug_Lcd"
    Debug: "FullDuplexSerialPlus"
    Mouse: "Mouse"

    Pub Main | value

    value := LCD.init(0, 9600, 4) ' Return value of init. -1 is "True"
    waitcnt(5_000_000 + cnt) 'Wait for 1000 ms
    LCD.cls
    LCD.gotoxy(0,3)
    LCD.Str(String ("LCD init: "))
    If value
    LCD.Str (String ("Successful"))
    Else
    LCD.Str (String ("Failed "))
    LCD.dec(value)
    LCD.backlight(True)
    LCD.gotoxy(0,0)
    LCD.Str(String ("X position: "))
    LCD.gotoxy(0,1)
    LCD.Str(String ("Y position: "))
  • StefanL38StefanL38 Posts: 2,292
    edited 2008-10-06 01:28
    Hello Pi-Guy,

    to have a feedback of your program for debugging you could use the FullDuplexSerial-object

    download the Propeller serial Terminal-Software "PST.EXE" here

    www.parallax.com/Portals/0/Downloads/sw/propeller/PST.exe.zip

    And here's is a little democode to show how FullDuplexSerial works on the serial connection
    you are using to program the chip (PINs30,31)


    'ATTENTION! You HAVE TO download the code to the EEPROM ! (Key F11)
    'opening the comport with PST.EXE causes a reset of the propeller
    'after reset, the propeller does its bootprocess that includes loading the content of the EEPROM
    'to the RAM. So last content of the RAM will you overwritten by the last content of the EEPROM
    
    CON
      _clkmode = xtal1 + pll16x 
      _xinfreq = 5_000_000
    
    OBJ
      debug  : "FullDuplexSerial"
    
    VAR
       long X
       
    PUB main 
      debug.start(31, 30, 0, 9600)
    
      X := 0
      repeat 
        X++
        debug.str(string("X="))
        debug.dec(X)
        debug.str(string(" Hello World"))
        debug.tx(13)
        waitcnt(ClkFreq + cnt)
    
    



    This is not solving the LCD-issue but gives you supereasy feedback for debugging
    @Parallax-Team:

    This kind of debugging is SO EASY
    as it needs NOTHING MORE than any kind of PropBoard
    that some democode should be delivered inside the manual AND as SPIN-File
    Library-demo-folder

    best regards

    Stefan

    Post Edited (StefanL38) : 10/6/2008 1:38:53 AM GMT
  • P!-RoP!-Ro Posts: 1,189
    edited 2008-10-06 03:56
    Only problem with your code is the part using the external oscilator. For some reason it hasn't been working since I shorted the pins. In fact, this might even be what my proplem is. Maybe I'll just have to order a new prop. Sorry for the extra work I'm making you guys do, but do you know of a way to make it function on just the internal crystal?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    The Pi Guy
  • Mike GreenMike Green Posts: 23,101
    edited 2008-10-06 04:06
    The RCFAST clock mode setting will let the Propeller function somewhat. It won't let you do serial I/O though since the RCFAST and RCSLOW clock speeds can vary widely from Propeller to Propeller and are somewhat temperature sensitive as well. RCFAST for example can be anywhere from 8MHz to 20MHz. It would be possible to calibrate RCFAST if you have some way to measure frequency. You'd need to write a program using one of the cog counters to output a pulse on an I/O pin at 1/2 the clock frequency and measure that, then modify the serial I/O routines to use the actual clock speed that you measure rather than the one computed from the clock mode.
  • SapiehaSapieha Posts: 2,964
    edited 2008-10-06 04:16
    Hi I LIKE PI.

    One solution can be External Clock generator if Yours Crystal pin is bad.
    Test with External frequency in XINPUT on XIN pin.

    0 1 0 XINPUT XIN OSC OSCENA must be '1'.

    Ps. It is mostly XOUT pin that fails.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Nothing is impossible, there are only different degrees of difficulty.
    For every stupid question there is at least one intelligent answer.
    Don't guess - ask instead.
    If you don't ask you won't know.
    If your gonna construct something, make it·as simple as·possible yet as versatile as posible.


    Sapieha

    Post Edited (Sapieha) : 10/6/2008 4:32:28 AM GMT
  • P!-RoP!-Ro Posts: 1,189
    edited 2008-10-07 00:01
    I doubt I would be able to figure out how to get around using the external oscilator, so I'll probably just wait until I can get a new prop to try it out. Thanks for your help, though, guys! I've got plenty of stuff now to try when I get that new prop!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    The Pi Guy
Sign In or Register to comment.