Hello guys,
Red Lion - DSPGT000 using RS232 raw driver for port 1 and 2.
I am trying to send a serial trigger to 2 microscan barcode (1 on port 1 and the other on port 2) scanners without any luck. I can set up the scanner to use the external trigger and capture the string using the programs 1 and 2 below. But I would like to use the serial trigger. The microscan is setup to start a read using these settings:
Serial Trigger
Character (Delimited) - SP
Start Character (Non-Delimited) - 0x21 (!)
Stop Character (Non-Delimited) - 0x00 (NUL)
I have a flag bit from a plc when high triggers Program 4 (or a fifth program that will be used for port 2 if I can get port 1 working) then the second trigger for the same flag bit is set to 1 sec later that triggers Program 1 (or 2, depending on the flag/port).
When Program 4 is called, the micrsscan just sits dead. I can connect to the microscan and use the terminal with a "!" trigger and it works all day long.
If you see below in Program 4 I am using the "portprint (1, "!")" and I cant seem to understand why this is not working.
The next issue I have is using Program 3. After Program 1 and 2 have run and set flags (PORT1_COMPLETE = 1 that they have completed then Program 3 is called and always get the "PASS" string in tag COMPARE_STATUS. The compare program 3 is not as important as the serial trigger as I can do this in the PLC but I would like to find out what I am doing wrong.
I have also pasted (at the bottom) a command that TWControls posted early but didnt understand the structure.
Any help would be greatly appreciated. I can provide Project files if needed.
Program 1
cstring INPUT1 = PortInput (1, 0, 13, 500, 0);
if(INPUT1 != "")
PORT1_STRING = INPUT1;
INPUT1 = "";
PORT1_COMPLETE = 1;
PORT1_TRIGGER = 0;
Program 2
cstring INPUT2 = PortInput (2, 0, 13, 500, 0);
if(INPUT2 != "")
PORT2_STRING = INPUT2;
INPUT2 = "";
PORT2_COMPLETE = 1;
PORT2_TRIGGER = 0;
Program 3
COMPARE_STATUS = "";
if (PORT1_STRING == PORT2_STRING && PORT1_STRING == "NOREAD")
COMPARE_STATUS = "BC NO READ";
if (PORT1_STRING == "NOREAD" && COMPARE_STATUS == "")
COMPARE_STATUS = "BC1 NO READ";
if (PORT2_STRING == "NOREAD" && COMPARE_STATUS == "")
COMPARE_STATUS = "BC2 NO READ";
if (PORT1_STRING != PORT2_STRING && COMPARE_STATUS == "")
COMPARE_STATUS = "MISMATCH";
if (PORT1_STRING == PORT2_STRING && COMPARE_STATUS == "")
COMPARE_STATUS = "PASS";
if (COMPARE_STATUS != "")
START_COMPARE = 0;
PORT1_COMPLETE = 0;
PORT2_COMPLETE = 0;
Program 4
PortPrint(1, "!");
// declare locals
cstring line;
line = "!";
line += DecToText(PORT_WRITE_TAG, 0, 2, 1, 0, 0);
line += " to the serial port";
PortPrint(1, line);
Red Lion - DSPGT000 using RS232 raw driver for port 1 and 2.
I am trying to send a serial trigger to 2 microscan barcode (1 on port 1 and the other on port 2) scanners without any luck. I can set up the scanner to use the external trigger and capture the string using the programs 1 and 2 below. But I would like to use the serial trigger. The microscan is setup to start a read using these settings:
Serial Trigger
Character (Delimited) - SP
Start Character (Non-Delimited) - 0x21 (!)
Stop Character (Non-Delimited) - 0x00 (NUL)
I have a flag bit from a plc when high triggers Program 4 (or a fifth program that will be used for port 2 if I can get port 1 working) then the second trigger for the same flag bit is set to 1 sec later that triggers Program 1 (or 2, depending on the flag/port).
When Program 4 is called, the micrsscan just sits dead. I can connect to the microscan and use the terminal with a "!" trigger and it works all day long.
If you see below in Program 4 I am using the "portprint (1, "!")" and I cant seem to understand why this is not working.
The next issue I have is using Program 3. After Program 1 and 2 have run and set flags (PORT1_COMPLETE = 1 that they have completed then Program 3 is called and always get the "PASS" string in tag COMPARE_STATUS. The compare program 3 is not as important as the serial trigger as I can do this in the PLC but I would like to find out what I am doing wrong.
I have also pasted (at the bottom) a command that TWControls posted early but didnt understand the structure.
Any help would be greatly appreciated. I can provide Project files if needed.
Program 1
cstring INPUT1 = PortInput (1, 0, 13, 500, 0);
if(INPUT1 != "")
PORT1_STRING = INPUT1;
INPUT1 = "";
PORT1_COMPLETE = 1;
PORT1_TRIGGER = 0;
Program 2
cstring INPUT2 = PortInput (2, 0, 13, 500, 0);
if(INPUT2 != "")
PORT2_STRING = INPUT2;
INPUT2 = "";
PORT2_COMPLETE = 1;
PORT2_TRIGGER = 0;
Program 3
COMPARE_STATUS = "";
if (PORT1_STRING == PORT2_STRING && PORT1_STRING == "NOREAD")
COMPARE_STATUS = "BC NO READ";
if (PORT1_STRING == "NOREAD" && COMPARE_STATUS == "")
COMPARE_STATUS = "BC1 NO READ";
if (PORT2_STRING == "NOREAD" && COMPARE_STATUS == "")
COMPARE_STATUS = "BC2 NO READ";
if (PORT1_STRING != PORT2_STRING && COMPARE_STATUS == "")
COMPARE_STATUS = "MISMATCH";
if (PORT1_STRING == PORT2_STRING && COMPARE_STATUS == "")
COMPARE_STATUS = "PASS";
if (COMPARE_STATUS != "")
START_COMPARE = 0;
PORT1_COMPLETE = 0;
PORT2_COMPLETE = 0;
Program 4
PortPrint(1, "!");
// declare locals
cstring line;
line = "!";
line += DecToText(PORT_WRITE_TAG, 0, 2, 1, 0, 0);
line += " to the serial port";
PortPrint(1, line);