10/6/2009 6:06 PM | |
Posts: 691 Rating:
|
you may access the bits of a word by getting the status of individual bits For Example L 16#209 T MW20 A m20.0 A M21.6 |
10/7/2009 6:39 PM | |
Posts: 691 Rating:
|
Whats your application i can't understand properly Do you want Indirect Addressing |
10/9/2009 1:36 PM | |
Joined: 10/7/2005 Last visit: 4/23/2024 Posts: 3004 Rating:
|
Hello Palestine AttachmentFC7.zip (1181 Downloads) |
Cheers |
|
This contribution was helpful to
4 thankful Users |
10/10/2009 2:03 PM | |
Joined: 10/7/2005 Last visit: 4/23/2024 Posts: 3004 Rating:
|
Hello again Palestine not too sure why it won't work in your case. I did admittedly quickly "hack" FC7 together, but did test it before posting it (and just testedit again and it works fine). Your error relates to FC99(I presume though that this is the block I posted, correct?) and more importantly to a write problem with the TEMP variablesof FC99. I wonder if you used the source file that I posted OR copied the code "printout" in my post and - if so - possibly forgot to create the 16 TEMP bits (which would explain the error that you are getting). Anyway, to besure to be sure, please find attached FC7 as a "ready to go" block inside a Step7library, give it a try and please let me knowthe outcome. Last but not least, the logic in your screendump really does nothing else than copyingPIB516 onto MB3 and PIB517 onto MB2 (I thought you want toextract bits froma Word an copy them onto "scattered" memory (or DB) bit addresses). Perhaps your screendump only shows a test logic, butjust in case this is all you want to achieve, you will be far better off with this logic: [code]L PIW 516 CAW // swap high and low byte T MW 2[/code] All that's left to do is todeclare symbol names for MW 2 as well as M 2.0 -> M3.7 and then use the individual bits as needed. I hope this helps AttachmentFc7.zip (773 Downloads) |
Cheers |
|
This contribution was helpful to
1 thankful Users |
10/11/2009 12:08 PM | |
Joined: 10/7/2005 Last visit: 4/23/2024 Posts: 3004 Rating:
|
Hey Palestine "L" nominates"Local" memory which is bettwr known as the TEMP variable area of the block. "LW 0" is the first WORD of the TEMP area. You'd "normally" useTEMP's symbolically in your Block (and if done, you'll note thatthey still have a symbolic name even if you untick "Symbol" view). TEMP's do however have an "address" which can also be used (and is used in thiscase as the first 16 TEMP bits are declared as individual bits insteadof typeWORD). The downside of doing this is that if you were to add (or remove) TEMP variables which would lead to a shift of the "directly addressed" one you will have to remember that direct addressing is done and make the required changes in your logic. Anyway, none of the above expains why the AR1 based logic doesn't work (which has to work), have you had a change to test the FC7 from the library yet? |
Cheers |
|
This contribution was helpful to
1 thankful Users |
10/12/2009 9:13 AM | |
Joined: 10/7/2005 Last visit: 4/23/2024 Posts: 3004 Rating:
|
Thanks for the feedback Palestine, I'm glad it does what you want it to do. I'm sure by now you would have yourself "reversed" the "Word to Bits" Function into a "Bits to Word' Function, but just in case you haven't you'll find my "idea" in form of FC8 in the attached library (which also has the previously posted FC7 in it). As a return "favour" can you please let me know if the previosuly sent FC7does now work with(my preferred) AR1 based logic (it really must). AttachmentBits&Words.zip (994 Downloads) |
Cheers |
|
This contribution was helpful to
4 thankful Users |
10/31/2009 4:40 PM | |
Posts: 32 Rating:
|
How do I install these bitfromword function block? TIA! LP |
1/17/2011 10:42 AM | |
Joined: 9/23/2005 Last visit: 4/17/2024 Posts: 4325 Rating:
|
Hi, take a look also in the FAQ "How can you group separate signals (variables of the "Bool" data type) to one variable of the "Word" type and again extract them from that "Word" variable (Bool - Word data type conversion)?" http://support.automation.siemens.com/WW/view/en/41512046 |
Denilson Pegaia |
|
1/31/2012 6:37 AM | |
Joined: 10/7/2005 Last visit: 4/23/2024 Posts: 3004 Rating:
|
Hello Chester_F no, there is no difference in addressing between 16bit and 32bit in this case and each FCcanbe easily modifed to cater for DWORD usage. I wonder though if you made sure to add another 16 bits to the TEMP variable declaration? I hope this helps |
Last edited by: fritz at: 1/31/2012 6:46 AMtypos Cheers |
|
1/31/2012 7:46 AM | |
Joined: 10/7/2005 Last visit: 4/23/2024 Posts: 3004 Rating:
|
Hello Chester_F can you upload your program/block here for evaluation (otherwise I'd need a crystal ball to work out what's wrong |
Cheers |
|
1/31/2012 8:33 AM | |
Posts: 4 Rating:
|
Oops, sorry about that~ Here is the program in the attachment. AttachmentDWord2bits.zip (682 Downloads) |
Follow us on