Shop OBEX P1 Docs P2 Docs Learn Events
Can BS2 debug on a parallax Serial LCD? — Parallax Forums

Can BS2 debug on a parallax Serial LCD?

Tronic (Greece)Tronic (Greece) Posts: 130
edited 2006-07-14 19:01 in BASIC Stamp
Hello, I would like to know if its possible·to connect·the parallax serial LCD on the serial port of BS2 board of education and just send a message to it·by using the Debug command...

I know I can connect it to any of the 15 ports of BS2 but I'd like to use p16 as I run out of free ports on my bot and I don't use the serial programming interface except to upload new program...

Here is the link of the LCD I'm referring to:

Parallax Serial LCD


Thanos


▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔


Greekbotics: Greek Robotics Forum

(Translate it using Babelfish)


Post Edited (Tronic (Greece)) : 7/10/2006 11:00:11 AM GMT

Comments

  • PJAllenPJAllen Banned Posts: 5,065
    edited 2006-07-10 12:02
    I think, yes -- why not.· If you used a MAX232 or similar·between "SOUT" (Data Out) and the LCD, then everything should be everything, serial is serial.· You might even be able to get by using the 22K resistor work-around instead of a full-on level-shifter.
  • Tronic (Greece)Tronic (Greece) Posts: 130
    edited 2006-07-10 12:45
    So the serial input of the parallax LCD is·inverted or normal?

    I guess·I could·set the speed of LCD in 9600bps, which is the speed that BS2 communicates with terminal, and send a debug message from BS2. If I connected the·Rx (and the Gnd) thru a max232 on the Sout of serial programming port·the message will then·appear on the parallax serial LCD display, right?

    Anyone has done this before?

    Thanos



    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔


    Greekbotics: Greek Robotics Forum

    (Translate it using Babelfish)


    Post Edited (Tronic (Greece)) : 7/10/2006 1:11:16 PM GMT
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2006-07-10 14:06
    Come to think of it -- the STAMP is just doing TTL, too; the serial LCD is just TTL levels, as well.· SOUT comes out of the DB9's pin2.· Inverted, non-inverted, it's easy to change that variable (baudmode.)
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2006-07-10 14:12
    The BasicStamp has two RS-232 configurations that work on different PINs.

    1. The DEBUG message via the Pins 1,2,3,and 4. If you connect Pins 1,2, and 4 directly to a Serial LCD at the proper Baud, parity, etc, no inversion and no adapter is needed. Read the section on DEBUG in the manual.

    2. The SERIN and SEROUT mode via any pair of I/O pins plus ground. Inversion depends on whether you use a MAX232 to do the inversion and provide 'true RS-232' levels or you just use a 22k resistor in the RX pin. Again the manual explains all this and has programing examples and schematics.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "If you want more fiber, eat the package.· Not enough?· Eat the manual."········
    ···················· Tropical regards,····· G. Herzog [noparse][[/noparse]·黃鶴 ]·in Taiwan
  • Tronic (Greece)Tronic (Greece) Posts: 130
    edited 2006-07-10 14:22
    PJ Allen, thats exactly my point. To send a message on LCD I have to have all
    serial settings on memory and must use SEROUT to send the message on the LCD like
    the example code below:

    SO········· PIN···· 4··············· ' serial LCD output
    T9600······ CON···· 84··············· 'baud rate 9600bps
    T19K2······ CON···· 32··············· 'baud rate 19200bps

    Inverted··· CON···· $4000
    Open······· CON···· $8000

    Baud······· CON···· T9600 + Open·· ' replace the baud rate to match the LCD baud
    rate

    SEROUT SO, Baud, [noparse][[/noparse]"cls", CR]·


    Instead I want to use the more simple command:

    DEBUG "cls", CR

    With no other settings. Like a portable terminal display...


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔


    Greekbotics: Greek Robotics Forum

    (Translate it using Babelfish)
    ·
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2006-07-10 15:12
    I totally get you, T-Man.·

    Maybe I'd better butt out.·

    You can use the DB9 programming port to connect your LCD to and use SEROUT 16, but the DEBUG thing is an IDE-related function (DEBUG & IDE, they go together.)· Maybe there's a way to fake that (??).
  • Ryan ClarkeRyan Clarke Posts: 738
    edited 2006-07-10 16:49
    Using DEBUG is the same thing as using SEROUT with PIN 16 (SERIN as well).

    Ryan

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Ryan Clarke
    Parallax Tech Support

    RClarke@Parallax.com
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2006-07-10 17:10
    So what speed does it go at, RC?· You only need connection to SOUT, like I thought·(and GND)?

    Answering my own question (R-T-F-M!!): It Is -- 9600 8N1 Inverted

    Post Edited (PJ Allen) : 7/10/2006 5:17:03 PM GMT
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-07-11 05:50
    PJ,

    ·· Bear in mind that no matter what baud mode you use it will always be inverted on the SIN/SOUT pins.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • Tronic (Greece)Tronic (Greece) Posts: 130
    edited 2006-07-11 11:04
    After connecting the parallax LCD thru an max232 the only thing i receiced is garbage on the Parallax serial·LCD screen using the debug command.

    But I succeded to connect my AVR based serial LCD directly on the programming port of "BS2 board of education"!!!!
    ...and just print messages using the debug command but this was only·after I modified my original design by adding an extra resistor as shown on the PDF (optional part).

    AVR_serial_LCD_controller_v1.1_sch.pdf


    Any suggestions to fix the Parallax serial LCD work the same way?




    BS2_debugs_on_LCD.JPG

    mini_gender_changer.JPG

    resistor_fix_for_BS2_debug.JPG


    And some video of its operation...

    vid_BS2_debugs_on_LCD.zip


    Here is the demo program I used to send messages to my own avr based serial LCD:

    ' {$STAMP BS2}
    ' {$PBASIC 2.5}

    i·········· VAR···· Byte
    DO
    PAUSE 20
    DEBUG "cls", CR
    PAUSE 20
    DEBUG "· Greekbotics·· ", CR
    PAUSE 20
    DEBUG " AVR ROCKS!!··· ", CR
    PAUSE 20
    DEBUG "ln2",CR
    PAUSE 20
    DEBUG " Robotic Forum· ", CR
    PAUSE 20
    DEBUG "Now thru debug! ", CR

    PAUSE 1000
    FOR i = 1 TO 15
    ···· PAUSE 100
    ···· DEBUG "shl", CR··················· ' command the LCD to shift message to left
    NEXT

    PAUSE 20
    DEBUG "bloff",CR
    PAUSE 20
    DEBUG "beep",CR
    PAUSE 500
    DEBUG "blon",CR
    PAUSE 500
    DEBUG "bloff",CR
    PAUSE 500
    DEBUG "blon",CR

    PAUSE 1000
    LOOP



    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔


    Greekbotics: Greek Robotics Forum

    (Translate it using Babelfish)


    Post Edited (Tronic (Greece)) : 7/11/2006 11:13:22 AM GMT
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2006-07-11 12:19
    Congrats, I knew this was possible to do.

    Forgive me, but below is a review of what I was trying to say about two 'conduits' for the RS-232.

    1. The DEBUG already has hardware inversion and so does the SERIN/SEROUT on PIN16.

    2. Only the generic SERIN/SEROUT on pins 0-15 need either a MAX232 to provide inversion of the TTL or 'Software Inversion' when using somewhat sloppy 22k resistor approach.

    3. DEBUG probably takes the same space in EEPROM, but certainly is easier to write code for. It is limited to one and only one configuration [noparse][[/noparse]the one the used by the IDE].

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "If you want more fiber, eat the package.· Not enough?· Eat the manual."········
    ···················· Tropical regards,····· G. Herzog [noparse][[/noparse]·黃鶴 ]·in Taiwan
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2006-07-11 12:57
    DEBUG data goes out of SOUT and then·via DB9-pin2, where it is still "TTL" (if it is on a BoE or HWB).· It is 9600, 8N1, Inverted (no matter what.)·
    I do not know what the LCD requires in the way of inverted or·non-inverted, but a MAX232 is not needed (or appropriate, afterall.)·
    If the LCD needs non-inverted data, then one can easily rig up an inverting amplifier to make the change [noparse][[/noparse] //A = A ], at the LCD's input.

    Post Edited (PJ Allen) : 7/11/2006 1:04:48 PM GMT
  • Tronic (Greece)Tronic (Greece) Posts: 130
    edited 2006-07-11 14:02
    The parallax serial LCD has non-inverted RX input, as it it possible to connect it directly to any of the 15 ports of BS2.

    The issues about garbage I got maybe is because the parallax serial LCD does not return back to the BS2 the characters it receives (echo), as debug requires from IDE to function properly (basic stamp editor terminal).

    In the AVR based serial LCD, that I designed, I added such "return" as you can see in the schematic (PDF) I gave above.

    Too bad there is no workaround to have my parallax serial LCD function such easy... sad.gif·· ...or there is?


    PS. I can give·the AVR firmware for free, to anyone that is interested·making such project smilewinkgrin.gif


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔


    Greekbotics: Greek Robotics Forum

    (Translate it using Babelfish)
    ·
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2006-07-11 14:15
    Yes -- the work-around is an inverter between the SOUT (Inverted) Data output and the LCD's (Non-Inverted) Data input.· That simple (see attached.)

    PJ Allen said...
    If the LCD needs non-inverted data, then one can easily rig up an inverting amplifier to make the change [noparse][[/noparse] //A = A ], at the LCD's input.
    318 x 243 - 6K
  • Tronic (Greece)Tronic (Greece) Posts: 130
    edited 2006-07-11 14:25
    PJ Allen, I already tried that. I even tried a MAX232 but nothing. Thanks anyway.

    The problem must be of another nature. Not about inverted or non-inverted connection...

    Its must be IDE related as I explained already. You see, the parallax LCD has only input, no output to redirect back to the BS2 the character it receives. Or at least I think that's the problem is that it doesn't work directly with the debug command.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔


    Greekbotics: Greek Robotics Forum

    (Translate it using Babelfish)
    ·
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2006-07-11 14:52
    Then, I guess, the answer lies in how your AVR-based LCD works.· What does it do that the Parallax LCD does not?
    Tronic (Hellas) said...
    The issues about garbage I got maybe is because the parallax serial LCD does not return back to the BS2 the characters it receives (echo), as debug requires from IDE to function properly (basic stamp editor terminal).

    In the AVR based serial LCD, that I designed, I added such "return" as you can see in the schematic (PDF) I gave above.
    Is it the 4-to-6 and 7-to-8 jumpers?

    Post Edited (PJ Allen) : 7/11/2006 3:01:48 PM GMT
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2006-07-11 15:07
    Tronic,
    Some how you got into double inverting.
    BasicStamp Pins 1 and Pins 2 have transistors that Invert for you.

    The Standard Asychronous Serial Communications signals are:
    TTL low [noparse][[/noparse]0] is RS-232 high [noparse][[/noparse]+5 to +12 ;
    TTL high [noparse][[/noparse]+5] is RS-232 [noparse][[/noparse]-5 to -12 prefered, but sometimes 0]

    Software inversion is available via the 'Baudmode' portion of the SERIN and SEROUT commands, but the manual's discussion is quite involved AS A PERSON HAS TO LEARN TO USE THE 'PBasic notation' to properly select.

    DEBUG is really the easiest way [noparse][[/noparse]if your LCD happens to take the same Baud rate and Format].

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "If you want more fiber, eat the package.· Not enough?· Eat the manual."········
    ···················· Tropical regards,····· G. Herzog [noparse][[/noparse]·黃鶴 ]·in Taiwan
  • Tronic (Greece)Tronic (Greece) Posts: 130
    edited 2006-07-11 15:09
    Well as the schematic shows (AVR_serial_LCD_controller_v1.1_sch.pdf) I just implemented echo of the received characters. I·designed it·that way from the·start because I wanted·the characters·to appear·back on the terminal as I pressed them on the keyboard (from IDE basic stamp editor)·as sort of confirmation.

    The odd part was that even my design failed to properly receive debug messages, at start, and worked when I accidentaly powered the TXD port of attiny2313 with +5v while trying to get it work. So I added the +5v to the line thru a 10ohm res·to protect it from overcurrent and thats it. You can see the strange connection I did on the schematic.

    As it figures I dont think I can do such think on my parallax serial LCD without void of warranty nono.gif

    ·

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔


    Greekbotics: Greek Robotics Forum

    (Translate it using Babelfish)


    Post Edited (Tronic (Greece)) : 7/11/2006 3:23:08 PM GMT
  • Tronic (Greece)Tronic (Greece) Posts: 130
    edited 2006-07-11 15:16
    PJ Allen said...
    Then, I guess, the answer lies in how your AVR-based LCD works.· What does it do that the Parallax LCD does not?

    Is it the 4-to-6 and 7-to-8 jumpers?
    No, I·included those loopbacks·with the connection of the parallax serial LCD but they didin't do any good as they·are usefull only when connecting it to a PC serial port.



    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔


    Greekbotics: Greek Robotics Forum

    (Translate it using Babelfish)


    Post Edited (Tronic (Greece)) : 7/11/2006 3:28:06 PM GMT
  • Tronic (Greece)Tronic (Greece) Posts: 130
    edited 2006-07-12 10:54
    Here is another photo of my AVR Serial LCD connected on my BS2 board of education:

    BS2_debugs_on_LCD2sm.jpg


    Still no way to·make my Parallax serial LCD work with the simple debug command...
    ·

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔


    Greekbotics: Greek Robotics Forum

    (Translate it using Babelfish)


    Post Edited (Tronic (Greece)) : 7/13/2006 7:45:47 AM GMT
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-07-12 17:43
    Tronic (Greece) said...(trimmed)
    Still no way to·make my Parallax serial LCD work with the simple debug command...
    Tronic, you should be very clear about what you post regarding products not working.· In fact the Parallax Serial LCD works perfectly as a DEBUG output.· All you need is the transistor setup PJ Allen Posted.· I used different values (1K on the base and 10K as a pull-up), but essentially the same circuit and have it running on my desk now using DEBUG.· If you prefer the AVR for your projects that is fine, but this is a BASIC Stamp Forum and the subject line refers to the Parallax Serial LCD.

    If you use a simple Transistor inverter you can use the Parallax Serial LCD for DEBUG purposes.· Remember, not all of the serial constants will work, such as CLS or HOME, but you can always use the literal values, such as 12 ($0C) to clear the screen.· I hope this helps out those following this thread.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • Tronic (Greece)Tronic (Greece) Posts: 130
    edited 2006-07-13 08:13
    Sorry, didin't mean to offend any of the parallax products as they are really great and got me into the robotics world! And the parallax Serial LCD is non comparable·regarding robotic applications.

    I was just asking for help, figuring out how this can be done, and tried my avr serial lcd just to test the connection, as I have made it for entirely other reason (computer application)... No need to advertise anything, as its a non commercial application.

    Anyway I finaly found the problem. It was about a noisy powering from a wall transformer that caused garbled data thru the transmision lines of the OEM Bs2. The difference in my desing was that I amplified somehow the signal. Really don't know, it happend by accident lol.gif

    Powering it from batteries got it working. Thanks for all help!



    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔


    Greekbotics: Greek Robotics Forum

    (Translate it using Babelfish)
    ·
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-07-13 14:22
    Tronic,

    ·· No offense was taken...I just wanted to clarify a few things so Forum Members didn't get misinformation.· For example, the problems you were having were not related to an echo issue.· That only affects the Stamp IDE communication with the BASIC Stamp.· Anything you send to the BASIC Stamp Dedicated Serial Port will be echoed back.· However, in this case we're not doing that, we're sending from the Serial Port and the target device is not required to echo.· I think some confusion is caused by not knowing which DB-9 pin to connect to.· Pin 2, which is RX on the PC side.· But for some they might think it is the Stamp RX pin from the diagram.· For those interested here is the exact schematic used to do this, and these parts are all available from us or are included in various kits we offer.· Enjoy.


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • Tronic (Greece)Tronic (Greece) Posts: 130
    edited 2006-07-14 14:49
    Just a small question.

    I'm using the circuit that·Chris Savage suggested.

    I receive messages (thru debug) from Pin 2, which is TX on the·BS2 DB-9, but I also receive messages when I connect it on Pin 3, which is RX on the·BS2 DB-9... Is this normal?



    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔


    Greekbotics: Greek Robotics Forum

    (Translate it using Babelfish)
    ·
  • Tom WalkerTom Walker Posts: 509
    edited 2006-07-14 15:28
    I am at work right now so I don't have a Stamp in front of me, so please keep that in mind, but as I recall, the DEBUG port on the Stamp has its TX and RX lines tied together in hardware. This is one of the things that must be taken into account when using 16 as a "general" serial port (fixed baud rate, parity and "inversion state" are others).

    Chris,
    Sorry for repeating you, but sometimes just seeing different verbage helps [noparse]:)[/noparse]

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Truly Understand the Fundamentals and the Path will be so much easier...
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-07-14 15:41
    It is possible, since, if you look at the schematic for the board there is a 4.7K resistor between the RX and TX lines.· This would allow enough signal to pass through for that to happen.· I hope this helps you.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2006-07-14 19:01
    Some threads never die.
    Asynchronous serial communications is an important part of the microcontoller's popularity. It really reduces the connections to other devices and can be effortless.

    Problems of understanding occur because people either don't understand what is involved in a minimal configuration or they have difficulty reading the PBasic Manual's complete discussion. I have wanted to jump in and say, 'NO! no! you aren't looking at it correctly.' But, I have tried to let go and sit back as I fear that I'd just add more confusion.

    A few simple things are need-to-know.

    1. Parallax eliminates the hardware handshaking {unless you really need it.· It is possible with SERIN and SEROUT}·which can add another layer of complexity to the whole thing. Just stick with thinking abut Rx and Tx. The only exception to this is the ATTN line which is a 'special and not RS-232 standard accomodation' to allow the IDE to program the Stamp. After the Stamp is programed, don't include it.

    2. Inversion from TTL to RS-232 tradionally occurs in a transistor that drives or receives the RS-232 signal. In that case, no inversion is needed in software.·· The MAX 232 is the preferred hardware inverter, but takes a bit of building.

    3. When confused, even though you have the Baud Rate, the Parity, and the Stop Bits correct; you may be 'double inverting by using·the software with hardware [noparse][[/noparse]like the MAX232].

    4. Above all, check the BAUD rate REQUIRED BY YOUR OTHER DEVICE and the signal levels [noparse][[/noparse]TTL or RS232]. The above problems seem to be related to two LCDs of differnet Baud Rates - it appears one is 9600 and the other is 19200.· They are two separate problems.· One solution will never work.

    5. READ and reread the PBasic sections until this information soaks in completely. There is an indexed entry for 'Serial Troubleshooting' and the two entries are merely copied so that one is in the SERIN section and one is in the SEROUT section.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "If you want more fiber, eat the package.· Not enough?· Eat the manual."········
    ···················· Tropical regards,····· G. Herzog [noparse][[/noparse]·黃鶴 ]·in Taiwan

    Post Edited (Kramer) : 7/15/2006 10:50:19 AM GMT
Sign In or Register to comment.