Shop OBEX P1 Docs P2 Docs Learn Events
Full Duplex Serial Tutorial? UPDATE 7/13: MAX3232 on PPDB Questions — Parallax Forums

Full Duplex Serial Tutorial? UPDATE 7/13: MAX3232 on PPDB Questions

WBA ConsultingWBA Consulting Posts: 2,935
edited 2010-07-14 05:46 in Propeller 1
I am working on a project that interfaces the propeller with two standard serial port devices. One is a Symbol LS1220 Serial Barcode Scanner Engine and the other is a Zebra 3844 Thermal Transfer Label Printer. Both devices use your run of the mill RS-232 Serial port for communication. I have tried some basic things using the Full Duplex Serial object and have not made any progress other than being able to make the barcode scanner activate it's laser and read a barcode. Here is where I am at:

This is the section of code that I am expecting to receive the serial output from the scanner. However, it just hangs when ran as is at the "scanner.Rxstr" line. (Rxstr is from the extended full duplex serial object). I believe my understanding of Full Duplex Serial is lacking and that I may need to use timeouts, flush buffers, and/or ???.

      outa[noparse][[/noparse]0]~                             ' Activate Barcode Scanner
      scanner.Rxstr(@serialnum)            ' Receive data string from scanner
      pst.str(@serialnum)                  ' Display string in PST
      waitcnt(clkfreq * 2 + cnt)           ' pause 
      outa[noparse][[/noparse]0]~~                            ' disable scanner




As for the Zebra printer portion, I am simply trying to start with sending a sample label to the printer using ZPL (Zebra Printer Language). If I send the following (in a text file) to a "Generic ASCii Text" printer from windows, I get my sample label that states "hello world!". What's the best way to do the same thing with SPIN? I am thinking I need to use the DAT block for the data and somehow tie that in with a repeating TX-byte step out the serial port?

~~~ZPL Sample~~~~~~~~
^XA
^FO50,50^ADN,36,20^FDhello world!
^FS
^XZ
~~~~~~~~~~~~~~~~~~~~~

Anyhow, as I am trying to learn how to communicate with these serial devices, I have found it difficult to find any tutorials/demos that explain how to use Full Duplex Serial (and/or its variants). I started looking at the GPS_IO_Mini object I used in my Reverse Geocache project as well as the GPS Float objects and noticed some "buffer" things going on which are currently around the corner in my learning path, but may be my answer(?).

Anyone have a project that uses Full Duplex Serial to send and receive data that is commented well or documented in a project write up? I'll be gathering up more work-in-progress details for this project to post as well, but right now it's a bunch of datasheets, scribbles, a bit of wiring and chunks of non-working code.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Andrew Williams
WBA Consulting
PowerTwig Dual Output Power Supply Module
My Prop projects: Reverse Geo-Cache Box, Custom Metronome, Micro Plunge Logger

Post Edited (WBA Consulting) : 7/14/2010 5:49:34 AM GMT

Comments

  • StefanL38StefanL38 Posts: 2,292
    edited 2010-07-06 09:42
    You don't need a tutorial really. Of course it would be good to have one.

    But I would like to analyse how you try to get things working at the moment:

    You put together

    - the propeller with the fullduplexserialobject,

    - the scanner

    - the printer

    So you have THREE and for each you still have to learn how they work.
    Any fault could be caused by a wrong use of each of the three.
    In this situation it is pretty hard to conclude what went wrong.

    Even with two components it is still difficult to know what you do wrong.

    Now you can experimtate for some weeks with both always together.

    Or you change to a way that seems to be slower at first view but turns out to be MUCH faster in the long run.

    Experiment with only ONE of those paired with components that are already well known as working reliably.

    In this case I recommend to play with FullDuplexSerial (shortname FDX) or one of its derivates with PST.EXE (Parallax Serial Terminal)
    To get to know how the different methods of FDX or FDX+ or ExtFDX are working.

    You started already this way by using a PC to send
    ~~~ZPL Sample~~~~~~~~
    ^XA
    ^FO50,50^ADN,36,20^FDhello world!
    ^FS
    ^XZ
    ~~~~~~~~~~~~~~~~~~~~~

    now you have to reproduce this on the propeller.
    For quickly finding bugs DON'T send it to the printer

    FIRST send it to PST.EXE

    - once from another PC that makes the printer printing

    - second send from the propeller to PST.EXE and COMPARE the received result

    As a part of the data, that is send to the printer, are controlsequences
    this way you will find bugs much faster than by the strange reactions of the printer
    because of one single controlbyte beeing wrong

    For more information about using FDX see attached picture

    best regards

    Stefan

    Post Edited (StefanL38) : 7/6/2010 9:59:21 AM GMT
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2010-07-06 13:31
    Would a Propeller based terminal program help? It came in handy when I started the Force Trainer Project.

    Coggyterm
    http://forums.parallax.com/showthread.php?p=772078

    OBC

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Propeller Feature Projects: PropellerPowered.com
    Visit the: PROPELLERPOWERED SIG forum kindly hosted by Savage Circuits.
  • WBA ConsultingWBA Consulting Posts: 2,935
    edited 2010-07-06 17:18
    Stefan, Yes, I am starting off with two separate programs, one for the printer and one for the scanner. To start, I am just trying to receive data from the scanner once it gets a valid read. For the printer, I am just trying to send a ^HH which should make it print a configuration settings label. I will take a look at using PST to send out data and see what I am getting.

    OBC, I will take a look at coggyterm to see if that will help. My trouble is with understanding the proper way to utilize serial I/O, so I am uncertain how it will help at this point.

    I will also be creating full RS-232 setups for both devices using MAX3232s to eliminate any hardware issues. I may also look at the RFID object, since that should work very similar to what I need for the barcode scanner.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Andrew Williams
    WBA Consulting
    PowerTwig Dual Output Power Supply Module
    My Prop projects: Reverse Geo-Cache Box, Custom Metronome, Micro Plunge Logger
  • John AbshierJohn Abshier Posts: 1,116
    edited 2010-07-06 19:45
    What are you sending for ^XA ? One interperation would be Shift-6 X A another would be $18 A or $18 $41

    John Abshier
  • WBA ConsultingWBA Consulting Posts: 2,935
    edited 2010-07-14 05:46
    John, sorry for missing your question, but I haven't made progress with the printer enough to try and send code to it yet.

    Regarding that, I have a question regarding the schematic for the DCE Serial Port on the PPDB (see page 7). Since I only need to transmit serial data to the printer and only receive data from the barcode scanner, could I not use the DCE port on the PPDB by using a mating DB9 connector that has the MAX3232 TX connection fed to the Printer and the MAX3232 RX tied to the Barcode scanner output?

    So, in essence, my printer output connections will be:

    Printer Data Prop Pin(TX) --> >--T1IN{MAX3232}T1OUT--> >--DB9.2--> >--Printer RX pin on DB9 RS-232 Serial Port

    And the scanner input connections will be:

    Scanner TX pin on DB9 RS-232 Serial Port--> >--DB9.3--> >--R2IN{MAX3232}R2OUT--> >--Scanner Data Prop Pin (RX)

    In other words, if I have a way to ignore the way the MAX3232's is connected to the DB9 connector on the PPDB, I can just use the input and output pins for the MAX3232 however I want right? I guess what I am really asking is this: The only thing that makes the MAX3232 circuit a DCE port rather than a DTE port is the way the DB9 is connected to the MAX3232?

    I won't be able to try this for a few days, so I figured I would ask for input before I wrap my brain up down the wrong path.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Andrew Williams
    WBA Consulting
    PowerTwig Dual Output Power Supply Module
    My Prop projects: Reverse Geo-Cache Box, Custom Metronome, Micro Plunge Logger
Sign In or Register to comment.