Host Engineering Forum
General Category => Do-more CPUs and Do-more Designer Software => Topic started by: Bolt on August 15, 2019, 09:48:11 AM
-
Is there an easy way to have a range of Delta Contacts to trigger a rung? For example, ORDLT C600:C631? ORDLT N600:N631? I think bits could be written to a (double)word and compared, but how would I do integers? I don't think a sum would work, as 2 values could swap in the same scan and not trigger.
-
Is there an easy way to have a range of Delta Contacts to trigger a rung? For example, ORDLT C600:C631? ORDLT N600:N631? I think bits could be written to a (double)word and compared, but how would I do integers? I don't think a sum would work, as 2 values could swap in the same scan and not trigger.
Cast. C0:D = C0-C31.
That has limited benefit for words like N, but you can get 2 N locations with N0:D.
-
You could probably write a subroutine that would work efficiently. Pass the starting point in N memory and number of registers. Do a for loop comparing the current data with old data which is an offset in High N memory. For instance use an offset of 10,0000. Previous data stored for N0 to N100 would be stored at N10000 to N10100. After the compare you store the new data into the previous data register inside the same loop.
-
I think bits could be written to a (double)word and compared, but how would I do integers? I don't think a sum would work, as 2 values could swap in the same scan and not trigger.
What if you checksummed the range and looked at STRDLT MyCheckSum?
-
I think bits could be written to a (double)word and compared, but how would I do integers? I don't think a sum would work, as 2 values could swap in the same scan and not trigger.
What if you checksummed the range and looked at STRDLT MyCheckSum?
With a CRC, this would work well.
-
Thanks. The C0:D is exactly what I was looking for, and then N0:D will work in a pinch. Checksum seems like too much work for this spot in my project ???
-
Thanks. The C0:D is exactly what I was looking for, and then N0:D will work in a pinch. Checksum seems like too much work for this spot in my project ???
CHECKSUM is an instruction.
-
Yes, but how do I enter N600:N632 as the criteria?
-
Yes, but how do I enter N600:N632 as the criteria?
CHECKSUM
Buffer N600:UB0
Function CRC16
0 initial
0 offset
ending offset 64
-
What if you checksummed the range and looked at STRDLT MyCheckSum?
Great Idea! I could use that one.
-
Trying to read between the lines here. I have 50 different C's triggering the same alarm. For me this is 50 rungs of code. Is there a more efficient way to do this with less rungs?
-
Great Idea! I could use that one.
Yes it is (but not mine)! I was working on something similar several years ago and another poster suggested that idea, I think it was actually in this forum.
-
Trying to read between the lines here. I have 50 different C's triggering the same alarm. For me this is 50 rungs of code. Is there a more efficient way to do this with less rungs?
Probably. What is your current logic doing? I'd like to see a couple of your rungs.
-
Here is a screenshot of all the c,s triggering a program. It keeps going right down to C1050.
-
I assumed that you want a one shot any time a C bit goes from 0 to 1. This single rung triggers on 64 C bits.
-
The only requirement is that the C bits need to be contiguous and aligned on 32 bit boundaries.
-
And your existing code could be reduced to something much simpler, like what I've attached. The problem is that won't re-trigger properly unless all alarms go completely away. The MATH box approach will trigger a new alarm regardless of the state of previous ones.
-
Would CHECKSUM run faster than a series of OR'd Delta Contacts using 32bit registers? Is CHECKSUM native or one of those encapsulated instructions packed with hidden sub instructions?
-
Would CHECKSUM run faster than a series of OR'd Delta Contacts using 32bit registers? Is CHECKSUM native or one of those encapsulated instructions packed with hidden sub instructions?
It?s native, but it isn?t going to be faster than deltas.
-
I assumed that you want a one shot any time a C bit goes from 0 to 1. This single rung triggers on 64 C bits.
Could you explain how this rung works? Is the copy instruction also part of checking all the c's?Thanks.
-
Could you explain how this rung works? Is the copy instruction also part of checking all the c's?Thanks.
The MATH box is is simply doing a bitwise comparison of the 64 C bits and 64 bits within two D locations. Basically it returns true if any single C bit is set, but the corresponding bit in the Ds is not. Then the COPY just pushes the current state of the Cs into the Ds. It's just detecting the rising edge of the Cs. This allows the alarm handler to trigger in response to each rising edge event.
If you want the alarm handler to run when the first alarm is triggered, and then not run again until all alarms are cleared, then the other rung I gave you will work.