User Tools

Site Tools



Storing Words and Double Words

A byte is 8 bits, a word is 16 bits, and a double word is 32 bits.

Memory is divided into bytes, so words and double words must be split across multiple bytes. Therefore, there are two ways to store words and double words: Least significant byte first (Little Endian) or most significant byte first (Big Endian). Cubloc stores its data in Little Endian.

In the memory map to the right, 1234H is stored in memory address 0 and 12345678H is stored in memory address 5. Note how 34H (the least significant byte of 1234H is stored first in memory address 0, and 78H, the least significant byte of 12345678H is stored first in memory address 5.

The Registers C, T, D are in word units. To store double words data, 2 words are required, therefore 2 registers are required. Below is an example of storing a double word, 12345678H. D1 gets 1234H and D0 gets 5678H.

Go CUBLOC Ladder Logic home

cubloc/storing_words_and_double_words/index.txt · Last modified: 2016/04/14 11:07 (external edit)