Here are the macros you can use by including utils.h.
Write one byte of memory.
Declare uint8 *q as a local variable and use it as a pointer to the area where you want to read the data. After evaluating the assignment operator, q++ is executed.
Write 2 bytes of memory.
Declare uint8 *q as a local variable and use it as a pointer to the area where you want to read the data. After evaluating the assignment operator, q+=2 is executed.
BE represents Big Endian.
Write 4 bytes of memory.
Declare uint8 *q as a local variable and use it as a pointer to the area where you want to read the data. After evaluating the assignment operator, q+=4 is executed.
BE represents Big Endian.
Reads a single byte of memory and stores the value in a variable of type uint8.
uint8 *p = &sRx.au8Data[0];
uint8 u8data1 = OCTET();
uint16 u16data2 = G_BE_WORD();
uint32 u32data3 = G_BE_DWORD();Declare uint8 *p as a local variable and use it as a pointer to the area where you want to read the data. After evaluating the = operator, p++ is executed.
2バイトメモリを読み込み uint16 型の変数に値を格納する。
uint8 *p = &sRx.au8Data[0];
uint8 u8data1 = OCTET();
uint16 u16data2 = G_BE_WORD();
uint32 u32data3 = G_BE_DWORD();Declare uint8 *p as a local variable and use it as a pointer to the area where you want to read the data. After evaluating the = operator, p+=2 is executed.
BE represents Big Endian.
1バイトメモリを読み込み uint8 型の変数に値を格納する。
uint8 *p = &sRx.au8Data[0];
uint8 u8data1 = OCTET();
uint16 u16data2 = G_BE_WORD();
uint32 u32data3 = G_BE_DWORD();Declare uint8 *p as a local variable and use it as a pointer to the area where you want to read the data. After evaluating the = operator, p+=4 is executed.
BE represents Big Endian.
Converts values between 2000 and 3600 into 8-bit values.
// definition at utils.h
#define ENCODE_VOLT(m) \
(m < 1950 ? 0 : \
(m > 3650 ? 255 : \
(m <= 2802 ? ((m-1950+2)/5) : ((m-2800-5)/10+171)) ))
...
uint16 u16Volt = 2860;
uint8 u8Volt_enc = ENCODE_VOLT(u16Volt);
uint16 u16Volt_dec = DECODE_VOLT(u8Volt_Enc);Values between 2000 and 2800 are assigned to 8-bit values in steps of 5 and from 2800 in steps of 10.
Returns the 8-bit value obtained by ENCODE_VOLT() to its original value.
// definition at utils.h の定義
#define DECODE_VOLT(i) \
(i <= 170 ? (1950+i*5) : (2800+(i-170)*10) )
...
uint16 u16Volt = 2860;
uint8 u8Volt_enc = ENCODE_VOLT(u16Volt);
uint16 u16Volt_dec = DECODE_VOLT(u8Volt_Enc);Values between 2000 and 2800 are assigned to 8-bit values in steps of 5 and from 2800 in steps of 10.
Set port c as input
Set port c as output
Set port c to Hi state
Set port c to Lo state
Set port c to Lo if s is TRUE, Hi if FALSE.
Reads port c, returns TRUE if Lo level.
Reads port c, returning TRUE if Lo level.
Bitmap 1 is Hi, 0 is Lo.
If the bit corresponding to port c of the read bitmap is Lo level, TRUE is returned.
Stop the pull-up on port c.
If you want to define a scope with switch, you have to write _C { ... }.
#define _C if(1)
// for example
switch(c) {
case 1:
_C {
uint8 u8work;
; // work
} break;
default:
}A newline code (CRLF) string.
This is a 2-byte string literal, so it cannot be used with vPutChar().