Posted 10 May 2008 (edited) Hi, I,m programming a FB wich should activate an output on a given time, for a given period on given weekdays. All works fine, all the given choises are variables, so I can remotely chance them. Only thing is that the weekdays are bit's and they aren't retentive. What would be the appropiate way to solve this? I've added the program, should clearify the above...... Carol Edited 11 May 2008 by Carol Share this post Link to post Share on other sites
Posted 10 May 2008 Hi Carol Use a Int. var. as Weekday seleckt. Or Use some internal bool var. seleckt them as retain and then some Set/reset logik. Banker Share this post Link to post Share on other sites
Posted 11 May 2008 OK, I will give it a try. I thought that it might be possible to set certain bit(s) in a dataword, something like %MW200:X1, but then in Omron syntax. I've tried to find this solution in the manual without any luck. Any suggestions? Carol Share this post Link to post Share on other sites
Posted 11 May 2008 SETB, D100 &5, will set bit 5 of D100. RSTB, D100 &5, will Reset bit 5 of D100. This instruction is in the manual, and numerous other implementations, you could also use the ANDW, which is the exact same as a MASK in AB. I think you have the AND instruction in Modicon also? The instruction manual is very good on the complete set, with examples also. In relation to your dataword question, it all depends on how you define your datatypes, in normal execution, if you use CIO, W, HR, you can set bits in the normal 'Omron' way. In FB's, this is not possible though, unless you define the FB variable at an absolute address. Share this post Link to post Share on other sites
Posted 13 May 2008 I can't follow here... I thought you could have bit retained in FB in Memory (just by checking the box when creating the symbol) or am I missing something beegee Share this post Link to post Share on other sites
Posted 13 May 2008 Maybe if the Carol can explain a bit clearer as to what they are trying to achieve. Share this post Link to post Share on other sites
Posted 13 May 2008 Scot & Beegee, you're right, inside the FB you can retain the bit. But Scot got it right, I want to set the days and I want to control these on a remote controlpost using GPRS. So when the PLC is turned out of programmode or is repowered I lost the status of the day-bits. When this happens, it's impossible the read back the status because there isn't one, all the day-bits are low, but with the bits inside the FB retained, they're still high. Now I've made the day-bits "Internal" and added an INT variable at the same adress as my original bits were. By writing the actual value into a second word I made it possible that after repowering the value of the second word is written in the actual value word. This one is read by the controlpost and I don't lose track nor control. For anyone who want to look back where the heck I'm babling about, here is a working version. Carol by the way: thanx guys for the feedback Share this post Link to post Share on other sites