jydepower Posted March 30, 2012 Report Posted March 30, 2012 (edited) Hallo. Ive made an array of bool for all my alarms. The idea was if any Bool wrent 1 i could do something. Now i have a problem finding a function that does that check. Is this possible or do have to use another aproach? Edited March 30, 2012 by jydepower Quote
Gambit Posted March 30, 2012 Report Posted March 30, 2012 Per 32 address's you could use K8<Arrayname> not equal to 0 Quote
jydepower Posted March 30, 2012 Author Report Posted March 30, 2012 Im using ladder in IEC developer. I dont understand K8 :) The array im using i bigger than 100. Quote
Gambit Posted March 30, 2012 Report Posted March 30, 2012 (edited) It standard ladde you can write K4M0 Each K value = 4 bits K4M0 means M0-M15 seen as a 16 bits value K8M0 means M0-M31 seen a a 32 bit value In IEC Developer the same can be done with your an array K8<Arrayname>[0] NE 0 K8<Arrayname>[32] NE 0 K8<Arrayname>[64] NE 0 K8<Arrayname>[96] NE 0 Edited March 30, 2012 by Gambit Quote
kaare_t Posted March 30, 2012 Report Posted March 30, 2012 You can use static variables like K4M0 but I don't think you can use labels with K*, like you say K8<Arrayname>[0] NE 0. I might be wrong, but I've never been able to use this with labels. Please correct me if I'm wrong. Another option would be to convert to a DINT and then compare to 0 like the picture attached. Quote
Gambit Posted March 30, 2012 Report Posted March 30, 2012 (edited) Kaare your solution is better but as an alternative. Using K8 on a Array is possible. Unfortunately you cannot index anymore Edited March 30, 2012 by Gambit Quote
jydepower Posted March 30, 2012 Author Report Posted March 30, 2012 I actually thought about converting to dint. But thought there might be a function to directly check the array. Ill use what you have made kaare. Thanks for the help both of you. Quote
jydepower Posted March 31, 2012 Author Report Posted March 31, 2012 It's actually very nice with the converting function. It made me make groups right away. Like emergency alarms overload alarms etc. Quote
jydepower Posted April 1, 2012 Author Report Posted April 1, 2012 What do you mean by indexing? Quote
kaare_t Posted April 2, 2012 Report Posted April 2, 2012 (edited) M0Z = M0 + [The value of Z]. So basically if we say M0Z, and Z has the value of 4, then M3 will be set/reset. Edited April 2, 2012 by kaare_t Quote
kaare_t Posted April 2, 2012 Report Posted April 2, 2012 Not sure what you mean, but here's some more examples: Z = 4 -> M0Z = M3 Z = 10 -> M0Z = M9 Z = 15 -> M0Z = M14 As you see, if you index then the value of Z will be added to the value of the M/D and so on. Here's some more examples: Z = 4 -> M100Z = M103 Z = 10 -> M100Z = M109 Z = 15 -> M100Z = M114 Z = 4 -> M1100 = M1103 Z = 10 -> M1100 = M1109 Z = 15 -> M1100 = M1114 Quote
jydepower Posted April 3, 2012 Author Report Posted April 3, 2012 Hmm must admit im completely lost now. How and where do you define that? (Z = 4 -> M100Z = M103) how do i say this in ladder? Know any guide or something where i can learn to understand this? Remember im still in ladder. Quote
kaare_t Posted April 4, 2012 Report Posted April 4, 2012 Here are some exmples: 1: Basic usage of Z 2: Your application using Z and hardware addresses 3: Your application using index and bit arrays with labels Note that no3 is preferred since you normally don't want to use hardware addresses. Sometimes there's no choice so you must use hardware addresses and then you must use no2 Quote
jydepower Posted April 7, 2012 Author Report Posted April 7, 2012 I understand your usage of code. But I still don't get the picture of the z indexing. For me it looks like another register. Just like d and w except it only goes from 0-7. And in your post you talk about hardware addresses, I don't see those in your examples. Quote
kaare_t Posted April 8, 2012 Report Posted April 8, 2012 Sorry, I use the word "Hardware addressing" when referring to M, D, W and so on... In essence every address not declared in Header/GVL and used with labels instead of "directly" addressing the address. Yes, Z's are basically an integer in the same way as D's except that you can use them for indexing "hardware addresses". You can try to write M0D0 instead of M0Z and see what happens. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.