1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

MELSEC-Q GX Works2のコンパイラの動作を調べる(その2)

Last updated at Posted at 2021-10-17

前回の続きです。

MELSEC-Q GX Works2のコンパイラの動作を調べる(その1)

配列を使ったST文はどのようにコンパイルされるか

自動割り付けデバイスは次のようになっている場合です。
image.png

Sample1

配列の要素数16個のビット配列を作りL1の内容を転送するロジックです。

(*Sample1*)
index:=1;
array_bit[index]:=L1;

image.png
image.png

Sample2

配列の要素数128個のビット配列を作ります。ここでは意地悪をして先頭をD0.0のワードデバイスにします。
128/16=8なので配列の大きさは8Wordです。g_array_bit_D0にはD0-D7が割り当てられます(BITとして)
そしてindexの場所にL2の内容を転送するロジックです。
BSET/BRSTを使いちゃんと動きようになってますね。

(*Sample2*)
index:=2;
g_array_bit_D0[index]:=L2;

image.png
image.png
image.png

Sample3

配列の要素数16個のワードデータの配列を作りW3の内容を転送するロジックです。

(*Sample3*)
index:=3;
array_word[index]:=W3;

image.png
image.png

Sample4

配列の要素数128個のワードデータの配列を作ります。ここでは意地悪をして先頭をK4M0のビットの桁指定にします。
44128=2048 なので配列の大きさは2048BITです。
g_array_word_M0にはM0-M2047が割り当てられます(WORDとして)
そしてindexの場所にW4の内容を転送するロジックです。

(*Sample4*)
index:=4;
g_array_word_M0[index]:=W4;

image.png
image.png
image.png

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?