serial LCD doesn't work properly with BS2px
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.
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.
Comments
·· 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
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
' {$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
Which version of the Stamp PBASIC Editor are you using?
Regards,
Bruce Bates
i'm using 2.5
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
' {$STAMP BS2px}
' {$PBASIC 2.5}
DO
PAUSE 1000
HIGH 1
PAUSE 2000
LOW 1
PAUSE 1000
END
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 Savage
Parallax Tech Support
csavage@parallax.com
' {$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.
·· 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 Savage
Parallax Tech Support
csavage@parallax.com
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
·· 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
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 Savage
Parallax Tech Support
csavage@parallax.com
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.
' {$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 Savage
Parallax Tech Support
csavage@parallax.com
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com