c - 是否有语义连接的 n*3 个寄存器的命名约定?

标签 c assembly embedded naming-conventions microcontroller

我知道命名约定,如果有 n*2 个语义连接的寄存器或变量,你应该像下面这样命名它们:

REGH REGL

在 2*2 寄存器的情况下,它将是:

REGHH REGHL REGLH REGLL

最后两个字母代表高-高、高-低、低-高和低-低。是否有任何约定为 3 个寄存器声明相同的内容?喜欢:

REGH REGM REGL

在这种情况下,最后一个字母代表高、中和低。 6 字节看起来像这样:

REGHH REGHM REGHL REGLH REGLM REGLL

希望你明白我的意思。这种情况有什么约定吗?

最佳答案

The Atmel AVR Microcontroller, 1st ed. [P. 173; 6.10.1]

For a register larger than 16 bits, the bytes are numbered from the least significant byte. For example, the 32-bit ADC calibration register is named CAL. The four bytes are named CAL0, CAL1, CAL2, CAL3 (from the least to the most significant byte).

所以在 8 位系统中我们甚至不应该这样做:

REGHH REGHL REGLH REGLL

但是:

REG3 REG2 REG1 REG0

关于c - 是否有语义连接的 n*3 个寄存器的命名约定?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20448671/

相关文章:

c - 具有内在函数和汇编的嵌入式广播

c++ - 发送数据lwip STM32 PC

c - 原始 LWIP 将 TCP 传输发送到静态 IP

objective-c - Corefoundation CFArray 所有权

c++ - x86汇编指令优化

debugging - ollydbg 操作码跟踪

qt - 如何处理QTableView长按?

c - 如何将 native C代码用于Windows Phone运行时库?

c - 通过编辑数组元素的最后一位对数字进行编码

c - 使进程采取不同的行为取决于它是否收到来自另一个进程的消息?