News:

  • June 13, 2026, 03:50:05 AM

Login with username, password and session length

Author Topic: D06 with Barcode Scanner on Port 2 - ascii questions  (Read 14015 times)

Tired_Old_Man

  • Newbie
  • *
  • Posts: 9
D06 with Barcode Scanner on Port 2 - ascii questions
« on: November 03, 2014, 06:57:32 AM »
Good morning, I have a AD D06 plc with an RS232 barcode scanner connected to it on port 2. I am able to read in the barcodes but am having an issue with storing and clearing data from V registers. I am trying to figure out how many bytes an ascii character takes up so I can store several of the barcodes for comparative reasons. Also, I have loaded a value of 0 into V registers that have ascii in them using "change value"  ???and they show 0 for all formats in data view except that they still show the ascii value. Any help on length of ascii in V memory as well as clearing out ascii in V memory would be greatly appreciated. Thank you,

PS- I will be reading in a 14 number barcode

plcnut

  • Hero Member
  • *****
  • Posts: 814
    • premiersi.com
Re: D06 with Barcode Scanner on Port 2 - ascii questions
« Reply #1 on: November 03, 2014, 07:16:19 AM »
1 ascii character equals 1 byte. So two characters can fit inside 1 word. Each v-mem can hold two characters.
Therefore a 14 character barcode will take up 7 v-memory locations.
If you LD K0, OUT V???(your memory location) then that will clear the memory for you.
I am not sure on your problem of
Quote
I have loaded a value of 0 into V registers that have ascii in them using "change value"  ???and they show 0 for all formats in data view except that they still show the ascii value
Did you actually write the value, or just enter it in the box? Are you viewing in a dataview (CTRL+SHFT+F3)?
Circumstances don't determine who we are, they only reveal it.

~Jason Wolthuis
Premier Systems Integration, LLC
http://premiersi.com

Tired_Old_Man

  • Newbie
  • *
  • Posts: 9
Re: D06 with Barcode Scanner on Port 2 - ascii questions
« Reply #2 on: November 03, 2014, 08:19:20 AM »
Thank you very much for your reply. I have loaded K0 into the register V6010 and in data view it shows 0 when viewed in anything but "text" view. Even after loading the K0 several time it still shows up as ..8334..........    I am using sample code from the AD website EP-C0M-008_06. This code seems to work fine for bringing in the ASCII and that was quite simple. The text value in the registers is alarming me as I want to archive several barcodes into a table and query them for re-scans. I need the barcode values to be stored intact for that reason. Thanks for your reply and any additional help,

plcnut

  • Hero Member
  • *****
  • Posts: 814
    • premiersi.com
Re: D06 with Barcode Scanner on Port 2 - ascii questions
« Reply #3 on: November 03, 2014, 08:57:25 AM »
Could you please post the actual program that you are running?

(Just click File>>Export>>Program, then select your desktop(or somewhere that you can navigate to later), and enter a name for the file.
Now just attach that text file to your reply.)
Circumstances don't determine who we are, they only reveal it.

~Jason Wolthuis
Premier Systems Integration, LLC
http://premiersi.com

b_carlton

  • Internal Dev
  • Hero Member
  • ****
  • Posts: 606
    • thePLCguy
Re: D06 with Barcode Scanner on Port 2 - ascii questions
« Reply #4 on: November 03, 2014, 08:57:47 AM »
Quote
it still shows up as ..8334..........
   

The first two dots are the representation of your data in the first word (V6010). If there is a 'printable' character it shows it otherwise it shows a '.' - one for each character or two per word. A value of zero is not a printable character. The value 30 hex (48 decimal) would show the CHARACTER '0'. Your display is showing the contents of V6010 through V6017.
« Last Edit: November 03, 2014, 09:03:31 AM by b_carlton »
An output is a PLC's way of getting its inputs to change.

Tired_Old_Man

  • Newbie
  • *
  • Posts: 9
Re: D06 with Barcode Scanner on Port 2 - ascii questions
« Reply #5 on: November 03, 2014, 09:13:28 AM »
B_Carlton, thank you so much, was confusing me seeing the other registers data. Thank worked! I have attached the program per PLCNUT. If anyone has some sample code for creating a table based on incoming ascii I would appreciate it. This is my first time with Automation Direct and I am trying to get up to speed as quickly as possible. Thanks again for all of your help. Once I get it going I will post the program with scanner hardware used for anyone else who has a similar application.

plcnut

  • Hero Member
  • *****
  • Posts: 814
    • premiersi.com
Re: D06 with Barcode Scanner on Port 2 - ascii questions
« Reply #6 on: November 03, 2014, 12:13:59 PM »
I added in a series of rungs that will shift the data down through a table.
I changed the Ascii In instruction to read in a 14 character string like you said you were reading.
Hopefully the rung comments will be enough to help you understand what is going on.
Circumstances don't determine who we are, they only reveal it.

~Jason Wolthuis
Premier Systems Integration, LLC
http://premiersi.com

Tired_Old_Man

  • Newbie
  • *
  • Posts: 9
Re: D06 with Barcode Scanner on Port 2 - ascii questions
« Reply #7 on: November 03, 2014, 12:58:35 PM »
Thanks PLCNUT !