Author Topic: barcode readers  (Read 11692 times)

philipjoseph

  • Jr. Member
  • Posts: 57
    • View Profile
barcode readers
« 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.
« Last Edit: December 31, 1969, 04:00:02 PM by -1 »
Philip.

philipjoseph

  • Jr. Member
  • Posts: 57
    • View Profile
Re: barcode readers
« Reply #1 on: February 17, 2003, 08:08:41 AM »
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
« Last Edit: December 31, 1969, 04:00:00 PM by 1076562000 »
Philip.

support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3174
    • View Profile
    • Internet Programmable PLCs
Re: barcode readers
« Reply #2 on: February 19, 2003, 05:16:57 AM »
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.

« Last Edit: December 31, 1969, 04:00:00 PM by 1076562000 »
Email: support@triplc.com
Tel: 1-877-TRI-PLCS

amoseley

  • Guest
Re: barcode readers
« Reply #3 on: June 18, 2003, 12:52:12 PM »
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.
« Last Edit: December 31, 1969, 04:00:00 PM by 1076562000 »