News:

  • October 13, 2025, 07:29:47 PM

Login with username, password and session length

Author Topic: Sorting program  (Read 3304 times)

Elect2

  • Newbie
  • *
  • Posts: 1
Sorting program
« on: August 11, 2009, 02:55:05 PM »
I am working in a sorting program project equipped with 10 lanes. I am able to read the bar codes (from the boxes of our products)and input the number to a D06 using the first 8 inputs. The decoder outputs the barcodes as BCD numbers. In the program I use an equal instruction to assign the product to a particular lane.
The program was writen in RLL and is working, but is extremely long, and seems somewhat unstable. My question is would it be simpler if I use RLL plus (stage programming)for this particular application.

 

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 6126
  • Yes Pinky, Do-more will control the world!
Re: Sorting program
« Reply #1 on: August 11, 2009, 05:12:35 PM »
Always a good question. If your program has lots of concurrent logic and is not particularly sequential, I wouldn't. If it has a significant sequencing requirement, Stage is the best tool for the job.
"It has recently come to our attention that users spend 95% of their time using 5% of the available features. That might be relevant." -BobO

b_carlton

  • Internal Dev
  • Hero Member
  • ****
  • Posts: 606
    • thePLCguy
Re: Sorting program
« Reply #2 on: August 11, 2009, 09:15:11 PM »
You've got 8 bits BCD. That's 0-99. Reserve 100 V memory registers. Lets say starting at V10000 up to V100143.

Then assign the value of V10000 equal to the lane number for bar code reading '0'
V10001 = '1' etc.

Do a simple lookup using a pointer.

LD BCD input number
BIN conver the BCD to binary
LDA O10000 load the address of V10000
ADDBS add the computed offset (which is sitting on the stack) to it
OUT V2000 (I'm using V2000 as a 'pointer)

LD P2000 (The accumulator now has the lane number for the BCD barcoded input)
OUT to wherever you want it.
An output is a PLC's way of getting its inputs to change.