TimothyMoulder
Member
For users of Unitronics, if you've tried Visilogic, you know one of the best features is the Event Scan functions. These functions let you:
1. Select a vector of Memory Bits to continuously scan.
2. Flag a bit one one of these MB's goes high.
3. Return the position of the bit within the vector
4. Reset the bit within the vector using a Reset function.
There are other features, like scrolling through the bits, but I've never used any except these 4.
Typically, I use this functionality to detect faults and generate messages for the operator. The Flag bit triggers the fault handling routines in my code, and the position is tied to a List of Text variable that reports what happened.
When you use an M91, the lower-level PLC from Unitronics, you really start to miss that function...
So as another great american once said (Hi Terry), "Roll yer own!"
The file I uploaded today has at it's base some code Peter Nachteway shared with us all a few years ago. It takes a 16-bit vector of MB's, converts to an integer, generates an Inverse value and AND's these together. This creates a register with a single bit set - the first fault in the fault vector. Peter also formed the base of the reset logic, XOR of the priotized fault with the original vector.
What I added was an interrupt routine that compares the prioritzed fault integer with a binary sequence of integers (0,1,2,4,8,etc) stored in the M91's built-in database. This allows a fast, efficient return of the exact position of the fault within the vector. You can use this value to generate a fault message.
The reset works by XOR as described, then immediately overwriting the MB vector, thus resetting the fault.
It's fully tested, fully functional, with an example - pressing the keys 1-4 on the M91 keypad generates a message. Pressing the enter key clears it. You can press multiple keys to create multiple faults, then press enter until all are reset - only one is shown at a time.
I suggest getting the latest U90 software from www.unitronics.com , updating the OS in your controller to the latest as well. I've not tried it with an M90, but if anyone does, let us know how it turns out!
Thanks!
TM
1. Select a vector of Memory Bits to continuously scan.
2. Flag a bit one one of these MB's goes high.
3. Return the position of the bit within the vector
4. Reset the bit within the vector using a Reset function.
There are other features, like scrolling through the bits, but I've never used any except these 4.
Typically, I use this functionality to detect faults and generate messages for the operator. The Flag bit triggers the fault handling routines in my code, and the position is tied to a List of Text variable that reports what happened.
When you use an M91, the lower-level PLC from Unitronics, you really start to miss that function...
So as another great american once said (Hi Terry), "Roll yer own!"
The file I uploaded today has at it's base some code Peter Nachteway shared with us all a few years ago. It takes a 16-bit vector of MB's, converts to an integer, generates an Inverse value and AND's these together. This creates a register with a single bit set - the first fault in the fault vector. Peter also formed the base of the reset logic, XOR of the priotized fault with the original vector.
What I added was an interrupt routine that compares the prioritzed fault integer with a binary sequence of integers (0,1,2,4,8,etc) stored in the M91's built-in database. This allows a fast, efficient return of the exact position of the fault within the vector. You can use this value to generate a fault message.
The reset works by XOR as described, then immediately overwriting the MB vector, thus resetting the fault.
It's fully tested, fully functional, with an example - pressing the keys 1-4 on the M91 keypad generates a message. Pressing the enter key clears it. You can press multiple keys to create multiple faults, then press enter until all are reset - only one is shown at a time.
I suggest getting the latest U90 software from www.unitronics.com , updating the OS in your controller to the latest as well. I've not tried it with an M90, but if anyone does, let us know how it turns out!
Thanks!
TM
Last edited: