NEC V850E/CA1 ATOMIC Preliminary User's Manual page 466

32-/16-bit single-chip microcontroller
Table of Contents

Advertisement

(3)
Bit location definition for bit commands
If the location of a bit or a bit-string has to be defined for a command, the bit location is given as a 6-
bit or 5-bit value (named in to following as "BIT_POS") using the following formula. If a 6-bit value is
given, the location is absolute without any offset for the byte location. If a 5-bit value is given an off-
set has to be added. The type of command defines the offset of the byte location, i.e. if the com-
mand targets the bytes 4-7 then the offset for the byte location is 4.
Formula for start byte and start bit:
byte: BIT_POS div 8 [+ byte offset for 5-bit value]
bit:
BIT_POS modulo 8
Example 1:
BIT_POS is set to 43 (as 6-bit value)
→ BIT_POS div 8 = 43 div 8 = 5 ... byte location
→ BIT_POS modulo 8 = 3 ... bit location
⇒ bit/bit-string is located at data byte 5, bit 3
Example 2:
BIT_POS is set to 16 (as 5-bit value) for a command that targets bytes 4-7
→ byte offset = 4 (command targets bytes 4-7)
→ BIT_POS div 8 = 16 div 8 = 2 ... relative byte location
→ BIT_POS modulo 8 = 0 ... bit location
⇒ bit/bit-string is located at data byte 6, bit 0
Example 3:
BIT_POS is set to 5 (as 5-bit value) for a command that targets bytes 0-3
→ byte offset = 0 (command targets bytes 0-3)
→ BIT_POS div 8 = 5 div 8 = 0 ... relative byte location
→ BIT_POS modulo 8 = 5 ... bit location
⇒ bit/bit-string is located at data byte 0, bit 5
466
Chapter 13 FCAN Interface Function
Preliminary User's Manual U14913EE1V0UM00

Advertisement

Table of Contents
loading

Table of Contents