如果手册说要首先访问16位LSB然后再访问16位MSB,请按照手册中的说明进行操作.
例如(小端):
#define REG (*(volatile uint32_t *) 0x1234)
uint16_t val_hi, val_lo;
val_lo = *((volatile uint16_t *) ®);
val_hi = *((volatile uint16_t *) ® + 1);
Run Code Online (Sandbox Code Playgroud)
请注意,编译器有时也会提供HI和LO标识符来访问LSB或MSB,REG例如:
#define REGL (*(volatile uint16_t *) 0x1234)
#define REGH (*(volatile uint16_t *) 0x1236)
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2037 次 |
| 最近记录: |