Full Duplex Serial Tutorial? UPDATE 7/13: MAX3232 on PPDB Questions
WBA Consulting
Posts: 2,935
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 ???.
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
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
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
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.
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 Abshier
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