I want to compare an integer with multiple constants. Can I use just one EQU command for this or do I have to use a seperate EQU with each comparison? Such as, N7:0 can be equal to 1 and 4 and 5 and so on...
If the values you want to compare the source integer to are consecutive you can use the LIM instruction. Otherwise you will need to test each condition. You can parallel the EQU instructions to keep it on a single rung.
No, they are not consecutive. I have 15 different comparisons for one true statement. The rung will be very long with that many branches. But I can do that if that's the only way. Thanks so much for replying.
How often are you needing to compare? you could use a MOV and move the constants to the EQU run the cycle then move another constant to the EQU? not sure what would be better
You don't have to put all of the EQU instructions on one rung. But you will need to use an OTE instruction to keep track of the results of each rung of comparisons and then OR all of those intermediate results.
be careful with the number of parallel branches.
every time I go more than 8, I start having issues with the logic.
you have to read the first published manual. it limits the number of branches to 8 if memory server me correctly.
What are the 15 numbers? Depending on the number sequence you could combine LIM and NEQ to cover a range of numbers like Steve suggested. Like 1, 4 & 5 could be coded.