6/20/2014 8:17 AM | |
Posts: 5225 Rating:
|
Hi, There is a problem with the overlay. Please see if the following links help.. LINK 1 Parts and attachments of 6/19/2014, 12:52 PM and 6/19/2014, 3:35 PM LINK 2 Remember.. * Use "AT" in FB not in global DB * Should NOT be set to "optimized" when creating the FB * Declare WORD variable as STAT * Below this.. declare {array name} with the type as "AT" * The "AT" will move away to the left and open the type entry again. * Now write (again) inside the type entry ARRAY of BOOL. I hope this is not too cryptic. Tell us if it is - then someone will help you later with a step-by-step. Greetings. w |
This contribution was helpful to
2 thankful Users |
6/20/2014 9:50 AM | |
Joined: 1/5/2011 Last visit: 10/27/2023 Posts: 814 Rating:
|
Hello Maidel, this is perfectly normal, you are overlaying a word with an array, but both are different in structure. Let me explain: a word consist of two bytes, byte 0 and byte 1. Byte 0 contains bits 8 to 15 and Byte 1 contains bit 0 to 7. Which means in a word bit numbering is done in the other direction than byte numbering. for an array its different, the first byte of your array(byte 0)will containt bits 0 to 7 and the second byte (byte1)will contain 8 to 15. You see, the ordering ofbytes happens differently for an array and a word. I've attached an image wich will clarify this a bit more, and added a sample with you case. Now the thing you can do if you want your bytes in different order, is just swap those two bytes. So switch byte 0 of your array with byte 1. I don't know what you are doing further in your program, so I don't know if you need to switch the bytes or can work with the word as it is now. I hope this explains it all. Kind regards, Jens AttachmentarrayvswordvsAToverlay.pdf (2303 Downloads) |
Keep it simple and on-topic. |
|
This contribution was helpful to
6 thankful Users |
6/20/2014 2:35 PM | |
Posts: 5225 Rating:
|
Hi. Sorry my last entry was not to answer the original question as to further the discussion in more general terms. What I wish to show (maybe academical) is that the optimized access is not a must anymore in TIA V13. Please see the attached extract from the manual STEP 7 Basic V13.0, System Manual, 02/2014, page 119. Please note the highlighted section. The downfall of the method is that there is not the traditional order of byte addresses for teh entire DB, but only for the borders of the AT overlay. I do hope this clears up some confusion. ..maybe this discussion should rather split to anther post. Greetings. w AttachmentEXTRACT_STEP_7_Basic_V13_enUS_en-US.pdf (935 Downloads) |
6/20/2014 2:58 PM | |
Posts: 5225 Rating:
|
Back on original topic.. Date code: 6/20/2014, 2:52 PM.. from LINK for a step by step to create AT overlay. Please say THANKS to the author of the refferenced post. w |
Follow us on