Cobranet™ ev-2 – Cirrus Logic EV2 User Manual

Page 39

Advertising
background image

CobraNet™ EV-2

39

Rev. 2.1

Poke <target> <value> [offset]

This command will set the value of the given location in CobraNet memory space to <value>.

<target>– same as peek above.

<value> – a hexadecimal with a “0x” prefix.

Example: poke 0x40104 0x1011

[offset] – optionally used with HMI array variables only. Offset into the HMI array. If not present
on an HMI array variable the poke will poke the <value> into the first location of the array.

Example: poke txBundle 0x111 0x2000

Please note the difference between the “peek <target = address>” and “<target = HMI>” commands. The
peek <target = address>” command will return the raw value at the specified address location whereas the
peek “<target = HMI>” command will return a properly formatted value. The difference is significant
between the CM-1 and CM-2 where the variables are not stored in memory in the same format. An exam-
ple is the rxPriority HMI variable.

On the CM-1:

peek 0x40104

- command

0x101000

- what is returned

peek rxPriority

- command

0x1010

- what is returned

On the CM-2:

peek 0x40104

- command

0x1010

- what is returned

peek rxPriority

- command

0x1010

- what is returned

This difference here is that the “peek 0x40104” command returns the raw value as it is stored in memory,
the “peek rxPriority command returns the value as it should be represented. In this example the CM-1
returned a different value than the CM-2 for the “peek 0x40104” command but the same value for the
peek rxPriority” command; this is because the storage format of the variable in memory is different
between the CM-1 and CM-2. The main memory architecture difference between the CM-1 and CM-2 is
that the CM-1 has a 24-bit wide memory bus whereas the CM-2 has a 32-bit wide memory bus. In the
above example the rxPriority HMI variable is an Integer16 data type. On the CM-1 this type of data uses
the middle and upper byte of the 24-bit memory location to store the data whereas the CM-2 stores the data
in the lower two bytes of the 32-bit wide memory location.

In summary, using the HMI variable name will return data in the proper format. Using the address will
return the raw data at the address location.

This also applies to the Poke command. When using the “poke <target = address> <value>” command you
must pay attention to how the data (i.e. the <value>) is stored on the respective CM. Where supported,
using the “poke <target=HMI> <value> [offset]” command means that the format of <value> is indepen-
dent of how the data is stored. This allows for writing a command line interface script that works on either
the CM-1 or the CM-2.

Advertising