Internet PLC Forum
General => Technical support => Topic started by: philipjoseph on February 17, 2003, 04:55:54 AM
-
Hi,
I connect a barcode scanner to com1.
I use these funtions:
1. Funtion
setbaud 1,3
2. funtion
A$= INPUT (1)
A= VAL(A$)
IF A>0
B=A: ENDIF
The PLC doesn't show any information when I read the barcode.
The barcode reader has many configurations, so I don't know if some parameters have to be changed. This is how it is configuarated (none,9600,8,1,even,CR) the others are options.
HANDSHAKING ? NONE RTS/CTS, ACK/NAK, Xon/off
BAUD RATE ? ? ? ? 9600 19200,4800,2400
DATA BIT ? ? ? ? ? ? ? ? ?8 ? ? ? ? ? ? 7
STOP BIT ? ? ? ? ? ? ? ? ?1 ? ? ? ? ? ? 2
PARITY ? ? ? ? ? ? ? ?even ? ? ? ? ? ? Odd, Mark,space,none
TERMINATOR ? ? ? ? ? CR ? ? ? ?none,cr/lf,lf,h tab,stx/etx,eot
I checked the barcode reader using the HyperTerminal and it read the value of the barcode.
How can I solve the problem?
If I want to use the COMM3, the only part that I need to change is the setbaud 3,3 and the A$=INPUT(#).
Philip.
-
Since the barcode is a DCE device, I made the special cable that you show us at the manual. The PLC is reading some values from the barcode scanner, but it doesn't read the numbers 0,3,5,6,9 and letter D. Is there any possibility why it is happening?
I change the funtion
a$= input$(1)
if len(a$)>0
b$=a$
endif
setlcd 1,1, b$+" "
just to see the variable
Philip
-
SETBAUD 1,3 will set COMM1 to 9600, 8 data bit, 1 stop bit and NO parity. But if you define the bar code scanner for even parity then you need to use a different number for SETBAUD 1,n
I assume you have used a clock pulse to periodically execute the Fn #2?
Anyway, you should test whether you have received any input from the PLC by:
A$ = INPUT$(1)
IF LEN (A$) = 0 RETURN: ENDIF ' nothing received.
SETLCD 1,1, A$+" " ' To display captured string.
A = VAL (A$)
If A > 0: B = A: ENDIF
This should work better.
-
There is an error in the Trilogi manual that is causing the confusion. The first colum should read 8,1,n not 8,1,e.