Difool Posted April 14, 2014 Report Posted April 14, 2014 (edited) Hi, I have a CJ2MCPU with a SCU21-VI communication module to communicate with a ZM400 Zebra printer. I want to use TXD_SCU ST instruction I need to set the communications parameters. Does the SCU21-V1 supports the XON/XOFF handshake ? On the printer, I can set XON/XOFF (by default), DSR/DTR or RTS/CTS. What is the best to use ? How I can use XON/XOFF with SCU21-V1 ? I have not seen any of these parameters on the SCU21-V1 unit configuration on CX-Programmer. Maybe XON/XOFF flow control is used when CTS control is set to "no" ? Thanks Edited April 14, 2014 by Difool
j.brophy@corkillsystems Posted May 6, 2014 Report Posted May 6, 2014 (edited) hand shake is used by the reverse command rxd i believe it also uses bits in the AR area request to send and clear to send it all ties together. I used txd_cpu commands in structured text to a zebra printer but and did not use any handshake what so ever and it worked fine. just be sure to fill in blanks in the text string worth ascii spaces or it will fail. As the txd_cpu command sends at the scan rate of the plc you could overflow the buffer of the serial port and truncate data as a quick hack I just added a program in ladder to step/ step next with diff up bits driving the txd commands in st and put a .2 second delay between steps. there is heaps of better ways to do this but it works as a hack and is suitable for our purpose. if someone else has a better idea i'd be intrested in this to make the code more robust. I used the plug in rs232 module in the front of a cj2. (* ascii print string setup*) IF P_On=P_On THEN; START_PRINT_STRING_DELIMITER:= 'N$N'; TITLE_STRING:= 'A50,20,0,2,2,1,N,"Dynes Transport Docket"$N'; TRUCK_NUMBER_STRING:= 'A100,40,0,2,2,1,N,"Truck Number AA"$N'; TANKER_NUMBER_STRING:= 'A100,40,0,2,2,1,N,"Truck Number BB"$N'; TRAILER_NUMBER_STRING:= 'A150,60,0,2,2,1,N,"Trailer Number CC"$N'; MONTH_NUMBER_STRING:= 'A200,80,0,2,2,1,N,"Month DD"$N'; DAY_NUMBER_STRING:= 'A250,100,0,2,2,1,N,"Day EE"$N'; HOUR_NUMBER_STRING:= 'A300,120,0,2,2,1,N,"Hour FF"$N'; SILOTEMP1_NUMBER_STRING:= 'A350,120,0,2,2,1,N,"Silo Temp GG"$N'; SILOTEMP2_NUMBER_STRING:= 'A400,120,0,2,2,1,N,"Silo Temp HH"$N'; LITRE_TRUCK_STRING:= 'A450,140,0,2,2,1,N,"Litre Truck II "$N'; LITRE_TRAILER_STRING:= 'A500,140,0,2,2,1,N,"Litre Trailer JJ"$N'; SEAL1_NUMBER_STRING:= 'A550,140,0,2,2,1,N,"Seal Number KK"$N'; SEAL2_NUMBER_STRING:= 'A550,140,0,2,2,1,N,"Seal Number LL"$N'; BARCODE_STRING:= 'B600,180,0,3,3,7,50,B," MM"$N'; END_PRINT_STRING_DELIMITER:= 'P2$N'; ELSE; END_IF; (*insert data into string*) (* truck number string insersion*) TRUCK_NUMBER_STRING_INSERSION_POINT:= FIND(TRUCK_NUMBER_STRING,'AA'); TRUCK_NUMBER_STRING_OUTPUT:= REPLACE(TRUCK_NUMBER_STRING,TRUCK_NUMBER,2,TRUCK_NUMBER_STRING_INSERSION_POINT); (* trailer number string insersion*) TANKER_NUMBER_STRING_INSERSION_POINT:= FIND(TANKER_NUMBER_STRING,'BB'); TANKER_NUMBER_STRING_OUTPUT:= REPLACE(TANKER_NUMBER_STRING,TANKER_NUMBER,2,TANKER_NUMBER_STRING_INSERSION_POINT); (* trailer number string insersion*) TRAILER_NUMBER_STRING_INSERSION_POINT:= FIND(TRAILER_NUMBER_STRING,'BB'); TRAILER_NUMBER_STRING_OUTPUT:= REPLACE(TRAILER_NUMBER_STRING,TRAILER_NUMBER,2,TRAILER_NUMBER_STRING_INSERSION_POINT); (* month number string insersion*) MONTH_NUMBER_STRING_INSERSION_POINT:= FIND(MONTH_NUMBER_STRING,'CC'); MONTH_NUMBER_STRING_OUTPUT:= REPLACE(MONTH_NUMBER_STRING,MONTH_NUMBER,2,MONTH_NUMBER_STRING_INSERSION_POINT); (* day number string insersion*) DAY_NUMBER_STRING_INSERSION_POINT:= FIND(DAY_NUMBER_STRING,'DD'); DAY_NUMBER_STRING_OUTPUT:= REPLACE(DAY_NUMBER_STRING,DAY_NUMBER,2,DAY_NUMBER_STRING_INSERSION_POINT); (* hour number string insersion*) HOUR_NUMBER_STRING_INSERSION_POINT:= FIND(HOUR_NUMBER_STRING,'EE'); HOUR_NUMBER_STRING_OUTPUT:= REPLACE(HOUR_NUMBER_STRING,HOUR_NUMBER,2,HOUR_NUMBER_STRING_INSERSION_POINT); (* silotemp1 string insersion*) SILOTEMP1_STRING_INSERSION_POINT:= FIND(SILOTEMP1_NUMBER_STRING,'FF'); SILOTEMP1_STRING_OUTPUT:= REPLACE(SILOTEMP1_NUMBER_STRING,SILOTEMP1_NUMBER,2,SILOTEMP1_STRING_INSERSION_POINT); (* silotemp2 string insersion*) SILOTEMP2_STRING_INSERSION_POINT:= FIND(SILOTEMP2_NUMBER_STRING,'GG'); SILOTEMP2_STRING_OUTPUT:= REPLACE(SILOTEMP2_NUMBER_STRING,SILOTEMP2_NUMBER,2,SILOTEMP2_STRING_INSERSION_POINT); (* litre truck string insersion*) LITRE_TRUCK_STRING_INSERSION_POINT:= FIND(LITRE_TRUCK_STRING,'HH'); LITRE_TRUCK_STRING_OUTPUT:= REPLACE(LITRE_TRUCK_STRING,LITRE_TRUCK_NUMBER,2,LITRE_TRUCK_STRING_INSERSION_POINT); (* litre trailer string insersion*) LITRE_TRAILER_STRING_INSERSION_POINT:= FIND(LITRE_TRAILER_STRING,'II'); LITRE_TRAILER_STRING_OUTPUT:= REPLACE(LITRE_TRAILER_STRING,LITRE_TRAILER_NUMBER,2,LITRE_TRAILER_STRING_INSERSION_POINT); (*seal1 number string insersion*) SEAL1_NUMBER_STRING_INSERSION_POINT:= FIND(SEAL1_NUMBER_STRING,'JJ'); SEAL1_NUMBER_STRING_OUTPUT:= REPLACE(SEAL1_NUMBER_STRING,SEAL1_NUMBER_ASCII,2,SEAL1_NUMBER_STRING_INSERSION_POINT); (*seal2 number string insersion*) SEAL2_NUMBER_STRING_INSERSION_POINT:= FIND(SEAL2_NUMBER_STRING,'KK'); SEAL2_NUMBER_STRING_OUTPUT:= REPLACE(SEAL2_NUMBER_STRING,SEAL2_NUMBER_ASCII,2,SEAL2_NUMBER_STRING_INSERSION_POINT); (* barcode string insersion join strings together for barcode*) BARCODE_NUMBER:=CONCAT(TRUCK_NUMBER,TANKER_NUMBER,TRAILER_NUMBER,LITRE_TRUCK_NUMBER,LITRE_TRAILER_NUMBER,SEAL1_NUMBER_ASCII,SEAL2_NUMBER_ASCII); BARCODE_NUMBER_STRING_INSERSION_POINT:= FIND(BARCODE_STRING,'LL'); BARCODE_STRING_OUTPUT:= REPLACE(BARCODE_STRING,BARCODE_NUMBER,2,BARCODE_NUMBER_STRING_INSERSION_POINT); (* end string insersion*) (* Send print string contents to printer*) IF PRINT_STEP_NUMBER>10 THEN; if TRUE=TRUE THEN; ELSIF PRINT_STEP_NUMBER=20 THEN; TXD_CPU(START_PRINT_STRING_DELIMITER); ELSIF PRINT_STEP_NUMBER=30 THEN; TXD_CPU(TITLE_STRING); ELSIF PRINT_STEP_NUMBER=40 THEN; TXD_CPU(TRUCK_NUMBER_STRING_OUTPUT); ELSIF PRINT_STEP_NUMBER=50 THEN; TXD_CPU(TANKER_NUMBER_STRING_OUTPUT); ELSIF PRINT_STEP_NUMBER=60 THEN; TXD_CPU(TRAILER_NUMBER_STRING_OUTPUT); ELSIF PRINT_STEP_NUMBER=70 THEN; TXD_CPU(MONTH_NUMBER_STRING_OUTPUT); ELSIF PRINT_STEP_NUMBER=80 THEN; TXD_CPU(DAY_NUMBER_STRING_OUTPUT); ELSIF PRINT_STEP_NUMBER=90 THEN; TXD_CPU(HOUR_NUMBER_STRING_OUTPUT); ELSIF PRINT_STEP_NUMBER=100 THEN; TXD_CPU(SILOTEMP1_STRING_OUTPUT); ELSIF PRINT_STEP_NUMBER=110 THEN; TXD_CPU(SILOTEMP1_STRING_OUTPUT); ELSIF PRINT_STEP_NUMBER=120 THEN; TXD_CPU(LITRE_TRUCK_STRING_OUTPUT); ELSIF PRINT_STEP_NUMBER=130 THEN; TXD_CPU(LITRE_TRAILER_STRING_OUTPUT); ELSIF PRINT_STEP_NUMBER=140 THEN; TXD_CPU(SEAL1_NUMBER_STRING_OUTPUT); ELSIF PRINT_STEP_NUMBER=150 THEN; TXD_CPU(SEAL2_NUMBER_STRING_OUTPUT); ELSIF PRINT_STEP_NUMBER=160 THEN; TXD_CPU(BARCODE_STRING_OUTPUT); ELSIF PRINT_STEP_NUMBER=170 THEN; TXD_CPU(END_PRINT_STRING_DELIMITER); ELSE; END_IF; ELSE; END_IF; Edited May 7, 2014 by j.brophy@corkillsystems
Difool Posted May 14, 2014 Author Report Posted May 14, 2014 I've finally used CTS/RTS handshake on the Zebra Printer and I've set "CTS control" to "YES" on the SCU parameters and all worked fine. I think that will be usefull for you.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now