Possible intermittent bug?

I don't know whats up with firefox but it seems to change posts on me instead of new post. Hopefully a reboot fixes it. Vmware server on server 2008 seems to get a wild hair on occasion.
 
I have the new code running and it does not increment. But with the tsteq 0 it skips the mod as Ross stated. With the mod skipped there is no var
I have the .17a 
  The mul command works as Ross stated because 0 times 16 is 0 and there is no float.
If I use 102512 the results are 160 in var2 and 2672 in var8. It's almost like it doesn't know what to do with the float and caches a copy of it but rearranges it as an integer for the addition part.
 
Ross,
 
I loaded this code and not increment:
START   
 SET VAR1 1 
RW:
 MOD VAR1 10000 RAM2
 DIV VAR1 10000 VAR7
 ANDB VAR7 15 VAR7
 MUL VAR7 16 RAM1
 ROTL VAR7 4 RAM1
 SET VAR2 RAM1 
 ADD RAM1 RAM2 RAM1
 SET VAR8 RAM1 
 DELAY 500  
 GOTO RW  
 END 
 
I looked the source code of ROTL and ROTR, that when one of first two parameters is zero, it will not do anything. That might have chance to let last value of third parameter passed from previous operation.  But in your code, you never have VAR1 as third parameter, so that is not possible caused by ROTL or ROTR.
 
That is the ROTL problem taking leftover from last 3rd parameter, since VAR7 is zero.
When MUL line in there, it will put zero in RAM1 which is 3rd parameter from last line.
This is the problem I described earlier in this thread. Only impact to using ROTL and ROTR.
We have fix for this now.
 
Run this. This will increment. The mul placed before the ROTx seems to inhibit whatever is going on.
 
START   
 SET VAR1 1
RW:
 MOD VAR1 10000 RAM2
 DIV VAR1 10000 VAR7
 ANDB VAR7 15 VAR7
  ROTL VAR7 4 RAM1
 SET VAR2 RAM1
 ADD RAM1 RAM2 RAM1
 SET VAR8 RAM1
 DELAY 500  
 GOTO RW  
 END
 
I guess our posts almost overlapped. Thats why I didn't notice the issue. I have no code running that could potentially have any remainders. I let my plc do any heavy lifting. It has advanced trig functions plus allows me to create my own custom functions.
 
MOD command has no problem. If you use ROTL and ROTR, check the parameter first to make sure the value being shift is not zero and position to be shift is not zero, then it will have no problem.  Also, if your just do:
ROTL RAM1 RAM2 RAM1
then does not matter if first or 2nd parameter zero will not have problem. If you do
ROTL RAM1 RAM2 RAM3
Then RAM3 may not have correct value, if RAM1 or RAM2 has zero in it. You will need to check first 2 parameters.
The current shipping firmware does the check internally and put 3rd parameter with correct value now.  Think about it, maybe not checking and just let zero being rotated, or rotate zero position, that maybe use less CPU than checking.
 
Ross,
Can you confirm that if you change line from
 
ROTL VAR7 4 RAM1
 
to
 
SET RAM1 VAR7
ROTL RAM1 4 RAM1
 
would fix the problem?  ROTL and ROTR a value into itself should have no problem.
 
todster,
When did you send those two boards for firmware update? Which address did you send them from?  Since we have a lot firmware update customers, I want to make sure your package is updated.
 
Back
Top