Jump to content

Activate state relay using a data register


Recommended Posts


Posted
I have already taken into consideration DECO instruction. The problem with DECO instruction is its range which is limited to 128 bits. My FX1N has 1000 state relays. One solution would be to split the 1000 state relay range into areas of 128 states. Then, using the data register where the state number is stored (ex. D10), I would need to compute the base address of the 128-states-area my state belogs to (this would be the D operand of the DECO instruction) and the offset from that base address (this would be the source operand of the DECO instruction). I was wondering, isn't there a simpler way to do the job? (I have also tried with index registers but not working). cghaba
Posted
And there is another problem with DECO instruction. When you use it to set a state relay, all other state relays in the 128-state-area are reset. In my program, I use 3 SFCs working in parallel, one that supervises the other two and the second controlling the third. At one moment there are at least 3 active states, one from each SFC. I would want to activate a state in the third SFC without resetting (stopping) the other two SFCs. cghaba
Posted
Jerrycat, I need to go to a state I memorized in D10. It could be any state from s0 to s999, not only s5. Sometimes D10 could be 102 so I should go to s102, sometimes D10 could be 455 so I should go to s455 and so on. It is not just one particular state (s5), but could be one among 10 or 20 states I would wish to go back to under certain conditions. cghaba
Posted
Did you try to use pointer? If you have 1000 bits (or 1024) starting at M1000 and you want to set ONE bit addressed by D10 I would probably try to work on something like code below. I cannot test it right now but it should work. Other devices used: D12 bit address within one word (16-bit). M40-M55 : 16 bits used to set the one you want Z0 : pointer to word that has to be OR-ed D14 : temp. Let me know if this helped.
Posted
Btw, code above was just the concept. Don't forget to check the range of D10 or you might get into trouble. The simplest protection is to insert one more instruction like WAND D10 h3FF D10 or just use two comparison blocks.
Posted
"Inclusive relationship" table in FX manual says P-SRET and STL can not be combined. What I am trying to do is to simulate a kind of subroutine in STL and I try to implement the return from subroutine. In the data register I store the state that makes the "call" and at the end of "STL subroutine" I need to return that state. For example, I have to make a program that has among other sequences 20 stages, each stage being a sequence of commands of the form: 1) go forward/backward m slots 2) get close/go far from machine n slots 3) rise/lower body p slots 4) advance/retreat hand1 r slots 5) advance/retreat hand2 s slots where for each stage, direction of movement and parameters m, n, p, r and s take different values. As I am used with C programming, I would put all this into a function and call the function 20 times in the right sequence with corresponding parameters. cghaba

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...