Shop OBEX P1 Docs P2 Docs Learn Events
serial LCD doesn't work properly with BS2px — Parallax Forums

serial LCD doesn't work properly with BS2px

day376day376 Posts: 24
edited 2005-11-12 15:36 in Robotics
I'm using a Matrix Orbital Serial LCD with a BS2px (BOE board)·and prog with Pbasic 2.5.· When I download to the PX my text appears fine on the screen, but if I power down I need to reset before the text appears.·

I also have a Homework board, and when I run the same program (w/baud adjustment) after power down it runs fine.· Really weird.· I use the same initiation seq. as in your Serial_LCD_Demo program.· Is there something else that I need to know for using with PX?· Here's my code


' {$STAMP BS2px}
' {$PBASIC 2.5}
tx· CON· 3
rx· CON· 4
baud CON 188··· ' 32 for BS2 Homework

·setup:
·HIGH tx
·PAUSE 1000

SEROUT tx, baud, [noparse][[/noparse]"Hello World"]·

END

The user manual is 3.8 MB so I included link to·it.
http://www.matrixorbital.com/files/MOS-AL202C.pdf
Any Advice would be greatly appreciated.
«1

Comments

  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2005-11-07 20:16
    Hello,

    ·· Just curious why you are using the init routine from our display on the Matrix Orbital Display?· Maybe that is causing the problem?· Matrix Orbital shows no such code for their displays.

    http://www.matrixorbital.ca/appnotes/basic_stamp

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • day376day376 Posts: 24
    edited 2005-11-07 20:29
    I began with just the serout command just like in the manual, and this is when I noticed I needed to reset after power down. I added the init. to see if that would solve the problem. When I run Serial_LCD_Demo.bs2 (BSpx) I can cut power then power up and the Demo program runs fine. Guess I was hoping the init. seq was the answer.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2005-11-07 20:34
    Try just using a small pause, like PAUSE 200, without the HIGH command.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • day376day376 Posts: 24
    edited 2005-11-07 20:40
    First I wanted to thank you for your help. I've tried many pause lengths before serout from PAUSE 10 - 2000. At first I thought it was the display but when I connect to Home work board "Hello World" works fine. I also have a second BS2px and it has the same prob. I've been beating my head againist the wall trying to figure out what going on with the PX.
  • day376day376 Posts: 24
    edited 2005-11-07 21:53
    It's definitely the PX. I added a test LED to the Boe Board to see if PX was sending the command at all. It's not, If I re-download to PX or reset the LED pops on. If I power down then power on the LED never pops on, meaning the commands aren't being executed. Ive even giving the px 2 sec start up time. The only time the program executes is after reset. I ve tried this on 2 PX's and its the same on both. Please Help.



    ' {$STAMP BS2px}
    ' {$PBASIC 2.5}
    tx CON 3
    rx CON 4
    baud CON 188 ' 32 for BS2 Homework

    PAuse 2000 'giving the px time


    high 1 'test LED to see if PX is sending commands
    pause 1000
    low 1

    SEROUT tx, baud, [noparse][[/noparse]"Hello World"]

    END
  • day376day376 Posts: 24
    edited 2005-11-07 22:05
    I'm going to pick up a new wall wart to see if that is the culprit. I'll post results.
  • Bruce BatesBruce Bates Posts: 3,045
    edited 2005-11-07 22:08
    day376 -

    Which version of the Stamp PBASIC Editor are you using?

    Regards,

    Bruce Bates
  • day376day376 Posts: 24
    edited 2005-11-07 22:10
    Hey Bruce,
    i'm using 2.5
  • Bruce BatesBruce Bates Posts: 3,045
    edited 2005-11-07 22:19
    day376 -

    Unless you're testing a Beta version for Parallax, there is no such version. The latest version of the Stamp PBASIC Editor that I'm aware of is Version 2.2. Invoke the Editor/Compiler and hit HELP ->> ABOUT.

    Regards

    Bruce Bates
  • day376day376 Posts: 24
    edited 2005-11-07 22:27
    Im using 2.2. Sorry about that.
  • day376day376 Posts: 24
    edited 2005-11-07 23:08
    Well it's not the power supply. I've just got a 9v 800 ma wall wart to test an led. The second px I'm using has only been used a few times and I'm having problems with that one too! This is fustrating. Programs only execute after a physical reset. No wonder I've been beating myself up over little stuff I'm familar with. Can someone Advise?

    ' {$STAMP BS2px}
    ' {$PBASIC 2.5}

    DO
    PAUSE 1000
    HIGH 1
    PAUSE 2000
    LOW 1
    PAUSE 1000
    END
  • day376day376 Posts: 24
    edited 2005-11-07 23:11
    The "Do" command above isnt in my code (typo)
  • day376day376 Posts: 24
    edited 2005-11-08 02:18
    I've figured out what the problem is, and it's basically because I made a typo in my previous post. It's funny how life shows you the answers....

    For some reason the BS2px refuses to execute a program without some sort of looping mechanism after a power down. Every now and then it may, but 90% of the time it doesn't.
    For example, using the Hello World code I posted earlier (without init seq.):

    ' {$STAMP BS2px}
    ' {$PBASIC 2.5}
    tx CON 3
    rx CON 4
    baud CON 188 ' 32 for BS2 Homework



    SEROUT tx, baud, [noparse][[/noparse]"Hello World"]

    If you were to download this to the BS2px the program would execute. Furthermore, If you were to physically reset the px the program would execute. BUT, If you were to power down and then power up, 90% of time the program would not execute.

    But if you were to place a DO...LOOP or GOTO statement anywhere in the code, the program works 100% after a power down.

    ' {$STAMP BS2px}
    ' {$PBASIC 2.5}
    tx CON 3
    rx CON 4
    baud CON 188 ' 32 for BS2 Homework


    SEROUT tx, baud, [noparse][[/noparse]"Hello World"]

    DO
    HIGH 1 'test led on
    pause 1000
    Low 1
    pause 1000
    LOOP

    I guess this is Why ALL the other Programs worked. We never even noticed this because, we never ran a program without a looping mechanism, until testing the LCD. Fortunately, our applications use a DO...LOOP. Conditional LOOPs such as LOOP UNTIL doesn't seem to work, only infinites.

    I personally have two modules and there are an additional four units which my associates use. Including my two, four of the BS2px modules have this "glitch", wont be able to test the other two until next week. Our BS2's work fine.

    Hoping someone out there can confirm or disprove this?! Other than this the modules have been great, but I hate think someone is out there beat their head againist wall or modifying Code that may good.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2005-11-08 06:00
    Is the "glitch" you're referring to after the program has ended?· If so, that's normal, and happens when the BASIC Stamp program ends.· To stop it, end your program with STOP instead of END.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • day376day376 Posts: 24
    edited 2005-11-08 16:02
    Not at the end of the program. The program wont start. For Example

    ' {$STAMP BS2px}
    ' {$PBASIC 2.5}


    ' Very Simple Program
    PAUSE 1000 ' Giving px time
    HIGH 1 'LED ON
    PAUSE 1000
    LOW 1 'LED OFF
    PAUSE 1000

    After A power down this program WONT run <90% of the time. But if you place an DO...LOOP in the program....

    ' {$STAMP BS2px}
    ' {$PBASIC 2.5}


    ' Very Simple Program

    HIGH 1 'LED ON
    PAUSE 1000
    LOW 1 'LED OFF
    PAUSE 1000

    DO
    PAUSE 100 ' Does nothing but loop
    LOOP

    The program runs 100%. After Bruce Bates (forgot to say thanx BB) mentioned the EDITOR I uninstalled and redownloaded 2.2. It made no difference. It could be in the Complier, but other stamps work fine. I'm not sure what's up. I hated to post anything negative but just wanted to possibly help someone else.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2005-11-08 17:16
    Hello,

    ·· I just setup a BS2px24 in my PDB and ran both of your programs.· In every case they work flawlessly whether I turn the board off then on, or hit the reset button, or re-download the program.· What I would suggest is see if you can duplicate your results after unplugging the serial cable from the board you're using.· I can't help but wonder if the Stamp Module is being held in a reset state somehow...Of course, that doesn't explain the program with the loop working for you, but then with or without the loop the two programs are still not functionally equivalent.· One pauses first, the other brings the line high first.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2005-11-08 17:23
    day376 said...(trimmed)
    It's definitely the PX.
    I wouldn't jump to conclusions without the benefit of complete testing.· If you are concerned that there's something wrong with your BS2px modules, please ask for an RMA number and we will test them for you and confirm proper functionality.· The fact that your last programs worked for me indicates that even if it is the px, it is unique to you.· I will try your LCD code in a few moments.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2005-11-08 17:35
    Okay, I tested your LCD code on a Matric Orbital LK204-25 (You didn't say which one you were using) and it worked flawlessly.· Thinking more about your problem, I can't help but think perhaps maybe there's something wrong with your BOE board.· Perhaps a regulator or cap problem.· Can you take a picture of the board close-up from a 45 degree angle view of the board?· Do you have a way to test voltages on the regulator?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • day376day376 Posts: 24
    edited 2005-11-08 18:21
    I'm using an M.O. MOS-202C BW I placed a link in my first post. sorry about that.· I have tested the voltages.· VIN = 10.78V· VDD= 4.98 .· And the CAPS and traces appear fine.· I'm using BOE revision C.· But I have included pics I took pics of caps, top and bottom side, also regulator and PX.· Camera isn't the best but here they are.
    320 x 240 - 56K
    320 x 240 - 43K
    320 x 240 - 49K
    320 x 240 - 47K
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2005-11-08 18:38
    Hello,

    ·· I was able to get the information I needed from the pics.· The caps look fine, as does the regulator.· Thanks for posting your voltages.· You are correct, I missed your link at the beginning.· But I think which display is unimportant at this time.· I will contact someone from our engineering team to see if they have an idea what might be causing this, since I cannot duplicate it.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • day376day376 Posts: 24
    edited 2005-11-08 18:38
    No, the previous codes aren't equivilent.· I was giving the px a head start in the first code.· I took away the head start in the second code to OVER prove my point.· Really Pause or No Pause it really shouldNOT matter The led should pop on either way.·I'm not looking to down the PX or Parallax.· We really would prefer that it did work the same as the homework board.· nearly $900 for six PX's and BOE's over a few months..· Unfortunately We cant take down time for sending units back, right now already behind schedule.· But appreciate the offer.
  • Jeff MartinJeff Martin Posts: 758
    edited 2005-11-08 18:56
    Hi,

    Your post indicating the fact that this only happens when it is NOT in an infinite loop is the biggest clue to the problem at hand.· What is likely happening to you is that when you think you are powering down the BS2px, there must be residual power being supplied to the BS2px for some time (like from a Cap) and so it isn't being completely powered down 90% of the time, thus, when you reapply power, it continues where it left off (it never really powered down), which is at the end of the program... so it does nothing.

    I couldn't see in your post any mention of using the reset button.· If what I'm saying is actually the real problem, then a push of the reset button (instead of a power-down) should yield much different results; causing it to run your program 100% of the time.

    I think that the 10% of the time that it did work for you on power-down / power-up, was because you waited long enough for the power to be drained below the BS2px's reset circuitry threshold, thus it performed a true reset upon power-up.


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    --Jeff Martin

    · Sr. Software Engineer
    · Parallax, Inc.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2005-11-08 18:59
    This brings up one more question for me...Is the LCD Display still powered when you power down the BASIC Stamp?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • day376day376 Posts: 24
    edited 2005-11-08 19:12
    I totally disconnected the LCD for now, just in case it was drawing to much power. But the problem persists. Only LED connected now. After a power down the only thing that will cause the program to execute is a reset or redownload. I thought that longer power downs would fix the problem. So I would power down and wait ten minutes or so. And it was during these longer power downs( with no DO...LOOP) when I got the 10% success. 100% with a DO...LOOP included regardless of power down duration. The DO..LOOP "fix" is what is really STRANGE.
  • Jeff MartinJeff Martin Posts: 758
    edited 2005-11-08 19:25
    If there is anything connected to the system, it may be a source of power (even a serial cable in enough to provide power for the Stamp, sometimes, so don't rule out anything like that).

    Take a volt meter (or better yet, an oscilloscope) and monitor the Vin and Vdd and RES pins on the BS2px during power down. If it doesn't fall below about 4.2 volts quickly, this is your problem.

    If you are ABSOLUTELY SURE that you have no source of power connected to it when you "power down," then take a conductive material (wire, pocket knife, etc) and briefly short it across Vin (or Vdd) and Vss (to drain any capacitor on the power circuit), then power up again.

    Another thing you could do is change your code to turn on the LED only when it has reached the end of the routine. If I'm on the right track, you'll see the LED stay on (and possibly fade) when you power down and your BS2px should power up and run perfectly upon the following power-up (provided that you let the LED turn off, of fade to completely off).

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    --Jeff Martin

    · Sr. Software Engineer
    · Parallax, Inc.
  • day376day376 Posts: 24
    edited 2005-11-08 19:47
    Yip, Youre definitely on to something. After running the LED program
    ' {$STAMP BS2px}
    ' {$PBASIC 2.5}


    ' Very Simple Program

    HIGH 1 'LED ON
    PAUSE 1000
    LOW 1 'LED OFF
    PAUSE 1000
    HIGH 1 ' Drain CAP after power down

    The LED does fade out slowly upon power down. Then after LED goes out I power back up and the program runs fine. Before I power down the LED stays on but flickers every two seconds or so, instead of steadily staying on.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2005-11-08 19:56
    So it would seem to be a slow fading supply.· Just out of curiosity are you switching the BOE off from it's power switch?· You can stop the glitching of the LED (Pulse) by putting a STOP command at the end of your code.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • day376day376 Posts: 24
    edited 2005-11-08 19:57
    Well actually after a power down· and power on the program doesn't run fine all the time.· Just like you said it seems to start where it left off sometimes.· Instead of the LED being ON for one second then OFF one second it just stays on.· I'll try longer power downs.· I dont have an osc. scope but i'll use volt meter to monitor those pins.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2005-11-08 19:59
    I think the two key pins to monitor would be pin 21 and pin 24.· Note how long it takes for the voltages to fall below 4.2 volts.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • day376day376 Posts: 24
    edited 2005-11-08 19:59
    thanks Chris, "Stop" does stop that flickering.
Sign In or Register to comment.