Addressing S7300 MW register to bit level

J

Julian

I am trying to map individual binary bits to baits of an MW register. I can't seem to find a way to do this in the S3700 platform. I am missing something?

D

Daniel Chartier

<p>Hello Julian;

<p>I don't quite understand what you mean.
Let's say the word you want to check is MW20. It comprises MB20 and MB21 (Memory bytes 20 and 21), and also M20.0 to M20.7 and M21.0 to M21.7 (individual bits inside the MB20 and MB21). You can access any bit inside the MW20 simply by using the correct bit designation.

<p>Fopr example, if you need yo check the status of the sign bit of MW20 (MSB, or bit 7
of MB20), then you could write logic like:
<pre>
M20.7 Q1.0
---| |-------------------( )
</pre>
<p>If you need to set the value of the 3rd bit of MW20 (bit M21.2) you could write:
<pre>
I2.0 M21.2
---| |------------------( )
</pre>
<p>Hope this helps,<br>
Daniel Chartier

D

Do you mean use a bit to activate a bit in a MW register? If so just use the
activating bit to turn on the bit in the M byte associated with the MW

A activating bit
= Mx.x

where x.x represents the byte and bit needed.

R

Robert D. Wagner

The first thing to understand here is that in Step7 the addressing is byte address based. This means that where MB0 is only the first byte of the M area. MW0 refers to MB0 and MB1 (two bytes comprise a word). Likewise, MD0 refers to a 32 bit double word which is therefore 4 bytes and actually includes MB0, MB1, MB2 and MB3. The addressing construct to access bits in the byte is M(byte#).(bit number 0 thru 7). Therefore to access bits within say MW10, which consists of MB10 and MB11, you would use the M10.bit or M11.bit address as appropriate, again where "bit" can have the values 0 thru 7. Example: to address bit 5 of MW10, you would use M10.5, to address bit 14 of MW10 you would use address M11.6

As you should already be aware. You need to be careful when assigning addresses in Step 7, for data greater than a byte, so that you don't end up overlapping part of another data address and overwriting its data.

Plug On!
Robert D. Wagner, P.E.