Print

Subroutine: Shift Register to Track the Status of Products

 

In many applications it is necessary to store the status of an event that has previously happened.

We use a register or group of registers to form a train of bits (cars) to store the previous on/off status. Each new change in status gets stored in the first bit and the remaining bits get shifted down the train.

 

With this subroutine here, you can manage an offset register in a tag table up to hundreds of states.

Here you will find the ACE PLC vBuilder programme and the HMI project. Ready to start with an ACE-11 connected to a 4.3″ HMI via USB.

Subroutine parameters :

  • ReadWriteShift (ui8)
    • 0 = Read any bit of the register
    • 1 = Write any bit (often number 0 at the right) + shift the register to the left
    • 2 = Write any bit without shift the register (For modify a bit as example)
  • BitValue (Bit)
    • Value of the bit to be read or write
  • BitNumberToRW (ui16)
    • Bit number to be read or write, depending of „ReadWriteShift“
    • Start from 0 (Right) to the last one (Left)
  • RegisterLenght
    • Lenght of the bit register
    • 6 means 6 registers from 0 to 5 !