Member Login
Search
Jump to a Date
Sponsored Communities
Cool stuff
Neat Stuff

Visit our shop for nerds in control lifestyle products.
Thermal Overload
The threads that wouldn't die...
- PC reliability?
- Windows, real time
- PID loops
- PCs vs. PLCs
- Replacing people
- MS 'monopoly'?
- Software quality
- Where do we go from here?
- Why pay?
- PC reliability?
- Windows, real time
- PID loops
- PCs vs. PLCs
- Replacing people
- MS 'monopoly'?
- Software quality
- Where do we go from here?
- Why pay?
Fortune
While having never invented a sin, I'm trying to perfect several.
RSS Feed
www.control.com/rss/
To get a personalized feed, become a member at no cost.
G'day,
I'm new to this forum and to Step 7, so Hi to all and thx Siemens... What I'm trying to do is use 3 outputs on a card as a BCD to another device. I'm getting some obvious issues and would like to find out the best way to overcome them.
I'm using a S7-300 PLC and programming in statement list. I'm loading a decimal value, when an alarm happens, and transferring it to the output byte, which works well in the simulator. Now if I do this with the actual PLC... the rest of the card becomes useless because I'm writing to the whole card during my load and transfer statements, which means the other outputs are written to as well. I tried to make sense of the help file with the AW (and word) statement, as I have seen something like this before for "masking out" part of the byte so the rest of the card works for anyone else who comes along later and programs, but I couldn't do it. Is there an easier way? If not... Does AW work in a binary mode? Thx.
I'm new to this forum and to Step 7, so Hi to all and thx Siemens... What I'm trying to do is use 3 outputs on a card as a BCD to another device. I'm getting some obvious issues and would like to find out the best way to overcome them.
I'm using a S7-300 PLC and programming in statement list. I'm loading a decimal value, when an alarm happens, and transferring it to the output byte, which works well in the simulator. Now if I do this with the actual PLC... the rest of the card becomes useless because I'm writing to the whole card during my load and transfer statements, which means the other outputs are written to as well. I tried to make sense of the help file with the AW (and word) statement, as I have seen something like this before for "masking out" part of the byte so the rest of the card works for anyone else who comes along later and programs, but I couldn't do it. Is there an easier way? If not... Does AW work in a binary mode? Thx.
Hi,
Thanks for your reply.
I was going to do it that way, but I would have used a fair few m bits... I'm using 3 outputs as a BCD to another small PLC... So if I want to want to turn on say output 3 on card 7,
L 8
T QB7
and then for another alarm to the second PLC could be outputs 3 and 1 on card 7,
L 10
T QB7
As outputs 4 to 7 are spare at the moment, it's not a problem, but if I use them later, then the Load and Transfer will overwrite the new code... So I need to use the AW (and word) command, but I'm not sure how it works. I think it will mask out the outputs that I'm not using, so that they can be written to later without any problems...
Cheers
Thanks for your reply.
I was going to do it that way, but I would have used a fair few m bits... I'm using 3 outputs as a BCD to another small PLC... So if I want to want to turn on say output 3 on card 7,
L 8
T QB7
and then for another alarm to the second PLC could be outputs 3 and 1 on card 7,
L 10
T QB7
As outputs 4 to 7 are spare at the moment, it's not a problem, but if I use them later, then the Load and Transfer will overwrite the new code... So I need to use the AW (and word) command, but I'm not sure how it works. I think it will mask out the outputs that I'm not using, so that they can be written to later without any problems...
Cheers
The conventional way of modifying certain bits in a word without affecting the rest is to use an AND with mask followed by an OR.
For example:
Temp1 = Destination AND 0x07
Temp2 = Source AND 0xF8
Destination = Temp1 OR Temp2
With a PLC though, nobody will thank you for doing it this way because it won't show up in a cross reference in an obvious way.
For example:
Temp1 = Destination AND 0x07
Temp2 = Source AND 0xF8
Destination = Temp1 OR Temp2
With a PLC though, nobody will thank you for doing it this way because it won't show up in a cross reference in an obvious way.
dear Michael,
I disagree with your last statement.
Masking an output byte is a commonly used method, regardless in PLCs or any other platform, and it's more elegant than chopping a number into a series of flags to be output separately. We just should do the masking in the proper place and possibly comment it out clearly.
If it were up to me, a mask using AND and OR instructions (just like your example) is the "obvious" way to go ;-)
Kind regards
Luca Gallina
I disagree with your last statement.
Masking an output byte is a commonly used method, regardless in PLCs or any other platform, and it's more elegant than chopping a number into a series of flags to be output separately. We just should do the masking in the proper place and possibly comment it out clearly.
If it were up to me, a mask using AND and OR instructions (just like your example) is the "obvious" way to go ;-)
Kind regards
Luca Gallina
First, transfer the decimal value to a storage byte. Next use another storage byte to hold the results of your bit manipulation that will be writing to the other 5 output bits. Finally and both storage bytes together an transfer the results to the output byte.
David Adams
David Adams
From Control Engineering magazine...
Related articles from Control
Engineering magazine- Budget-friendly temperature control unit
- Upgrading control for better polymer performance
- Software pinpoints process interactions
- BP selects SIS for UK deployment
- Automation vendors boost biofuels
- Cyber security issues take center stage in 2009
- AIC Series presents new high energy storage chokes
- Decrease arc flash risk with new motor control center option
- Relays: Slim industrial relays have push-in terminal sockets
Above articles copyright 2009 Reed Business Information.
Subject to its Terms of Use.
Your use of this site is subject to the terms and conditions set forth under Legal Notices and the Privacy Policy. Please read those terms and conditions carefully. Subject to the rights expressly reserved to others under Legal Notices, the content of this site and the compilation thereof is © 1999-2009 Control Technology Corporation. All rights reserved.
Our Advertisers
Help keep our servers running...
Patronize our advertisers!
Patronize our advertisers!




