Sign in to follow this  
Followers 0
Davids

Compare Barcode for S7-300

5 posts in this topic

Hi, i need some guide on how to compare barcode that data type is CHAR? Any programming language also possible. The second barcode received will compare with first barcode. if the barcode is match, then i will prompt user to re-scan. thank you.

Share this post


Link to post
Share on other sites
Well barcode data will come into a byte, one char is stored in a byte. 1st you have to move the data into integer to use the compare instruction, the reason for this is that compare instructions are in integer, dint, or real format. 2nd use the compare instruction to see if the value at the first barcode is equal to the second barcode. Either you can use a loop to compare integer by integer and increment a pointer or brut force it by one set of compares thru the whole barcode to the other barcode. So you would have a byte arrray where you have received the barcode data, and another array where you have moved the byte data to integer data for the compare for the received barcode and the barcode that you want to compare it to.

Share this post


Link to post
Share on other sites
Thank for your suggestion. That will be a very good suggestion. Do i need to write in STL to make it happen?

Share this post


Link to post
Share on other sites
If using pointers you can only use STL, won't let you write the code in ladder. Or if you have the SCL module you can write in that format. If you use the brute force method of just compare statements then you can write it in ladder.

Share this post


Link to post
Share on other sites
Do you have any SCL or STL sample program for this? Hope you can help me for this. thank you.

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0