6/6/2020 5:26 PM | |
Posts: 18 Rating:
|
Using S7-1200 on TIA Portal 1200 Reading alarms in a PLC program - I have a Word that I have representing alarms. In my program I dont want to have to access each of these alarms using DB20.DBX0.0 etc I want to assign each of these to a logical bit in a predefined structure area in my DB My Structure is a Word Long but I cannot seem to assign any of the data from my structure to Alarm1. It doesnt like using Slice addressing at the structure for some reason And it wont recognise any Word offsets from AlarmDB Directly Entering "AlarmsDB".%W3 Resolves to AlarmsDB and makes my Destination address unusable. I cant use Variants as these are internal variables in a block I'm trying to utilise. The BLK_MOVE wont accept an any parameter. All I'm trying to do is map a 16Bit structure to a word while maintaining some semblance of Symbolic addressing Slicing wont work Pointers wont work I tried this https://support.industry.siemens.com/cs/ie/en/view/57374718 but the W3 wont resolve to an address. is to specific and Doesnt answer my question. Can anyone help. (Tried editing the pictures to make thenm smaller - Can't)
|
Last edited by: alancurley at: 06/06/2020 17:30:14Last edited by: Jen_Moderator at: 06/08/2020 10:09:38Optimized link. |
|
6/6/2020 5:58 PM | |
Joined: 3/30/2020 Last visit: 8/14/2024 Posts: 4695 Rating:
|
Hello. Using symbolic addressing would be: I am not sure if this is the solution you are looking for. How do you want to have the coil look like? -- It is not possible to access the DB directly, it needs to go through an assigned tag. There is a way to better structure bits, but you will need to do this in a code block. Your DB20 will have to remain as it is, as the HMI needs it in words. The code block that you create to encode/decode can use the AT OVERLAY concept. This is documented in the manual: There are also the SERIALIZE/DESERIALIZE instructions that can help with moving one structure to another type structure. BR |
Activities of this user is voluntary. There is no obligation or liability placed on this user. Though optional, your 'please' and 'thank you' is highly valued. |
|
6/9/2020 9:43 PM | |
Posts: 18 Rating:
|
Pasting the link above cut out part of my "ALARMSDB", I have after Alarm3 a STRUCT with a collection of Booleans (16) one representing an alarm each. I know there is at least 16 bits in my struct. I have Alarm1 set up as a word to be assigned to my HMI for Alarms. I want to copy all 16 bits from the Alarm1Bits struct to the Alarm1 word. If I access Alarm1 via AlarmsDB.Alarm1.%X0 as you say, wont I be only accessing the 1st bit - I could achieve this via DB20.DBX0.0 but I want something to copy all of the bits in the word But instead of using the addressing like I am above, I want to access the struct like P#ALARMDB.ALARMBITS1 WORD 1 or I cannot get the correct access to the address for the structure to use the move.
|
6/9/2020 11:44 PM | |
Posts: 18 Rating:
|
No, But I wanted a DB to hold all of my Alarms Data. I was looking up on Slice addressing as well https://support.industry.siemens.com/cs/ie/en/view/57374718 but this also doesnt seem to work for some reason. Part of the beauty Behind S7 was that with a bit of knowledge (pointers) you could manipulate your Data and move it around regardless of the format or location. It seems a lot of the new TIA Portal while prettier isnt as flexible or powerful and a bit fo a step backwards. Maybe I just need to practice more. Thank you 👍 |
Last edited by: Jen_Moderator at: 06/10/2020 09:25:15Optimized link. |
|
6/10/2020 12:42 PM | |
Joined: 3/30/2020 Last visit: 8/14/2024 Posts: 4695 Rating:
|
Hello. Slicing does not do what you are hoping for. Siemens' interpretation of the world standards is what you see now instead of the older platform. What Hati is suggesting is a good idea. I include for you a converter from 16 bit structure to a WORD. This gives you a choice to follow your own idea. Attached is the converter function and video on how to use it. DATABLOCK EXAMPLE EXAMPLE OF CONVERTER IN USE CODE HOW TO USE Attachmentstructure-to-word.zip (413 Downloads) |
Last edited by: qwazee at: 06/10/2020 18:54:36Replace attachment: Code compile issue solved Activities of this user is voluntary. There is no obligation or liability placed on this user. Though optional, your 'please' and 'thank you' is highly valued. |
|
Follow us on