Jump to content
OMRON Forums

Reference to consecutive memory bits


TSV
 Share

Recommended Posts

I have a problem with M-var referencing on the CLIPPER board.

 

When I make a reference:

M500->X:$078000,17,1

all is OK, but when I want to point to 2 consecutive bits:

M500->X:$078000,17,2

I get compilation error 3 "Data error or unrecognized command"

 

But at the same time the reference:

M500->X:$078000,20,4

is OK as well.

 

There is no problem with reference to any bit-area in DPRAM:

M500->X:$060FE7,0,4

 

Where is my mistake?

Link to comment
Share on other sites

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

The following is a cut and paste from Turbo Software Reference Manual:

 

M{constant}->X/Y:{address}

Function: Short Word M-Variable Definition

Scope: Global

Syntax: M{constant}[..{constant}]->

X[:]{address},{offset}[,{width}[,{format}]]

M{constant}[..{constant}]->

Y[:]{address},{offset}[,{width}[,{format}]]

where:

• {constant} is an integer from 0 to 8191 representing the number of the M-variable;

• the optional second{constant} must be at least as great as the first {constant} -- it represents the number of the end of the range;

• {address} is an integer constant from $000000 to $FFFFFF (0 to 16,777,215 if specified in decimal).

• {offset} is an integer constant from 0 to 23, representing the starting (least significant) bit of the word to be used in the M-variables, or 24 to specify the use of all 24 bits;

• {width} (optional) is an integer constant from the set {1, 4, 8, 12, 16, 20, 24}, representing the number of bits from the word to be used in the M-variables; if {width} is not specified, a value of 1 is assumed;

• {format} (optional) is a letter from the set [u, S, D, C], specifying how Turbo PMAC is to interpret this value: (U=Unsigned integer, S=Signed integer, D=Binary-coded Decimal, C=Complementary binary-coded decimal); if {format} is not specified, U is assumed.

Link to comment
Share on other sites

The limitation in the format that is tripping you up is explained further below in the description:

 

*******************************

Legal values for bit width and bit offset are inter-related. The table below shows the possible values of

{width}, and the corresponding legal values of {offset} for each setting of {width}.

{width} {offset}

1 0 -- 23

4 0,4,8,12,16,20

8 0,4,8,12,16

12 0,4,8,12

16 0,4,8

20 0,4

24 0

**********************

 

Two things to note: You cannot specify a width of 2 bits, and if you specify a width greater than 1 bit, the starting bit must be divisible by 4.

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share


×
×
  • Create New...