在AVR MCU上,状态寄存器中的S标志如何工作?
V和S标志在Atmega328上如何工作?
ATMEGA328具有单独的符号,随身携带(C),2的补体溢出(V)和负(N)标志。 n是MSB(对应于其他处理器上的符号)。在数据表中无法很好地解释V标志的运行方式。据我了解,V通常计算为N⊕C。但是s在数据表中定义为v⊕n,这意味着它等于n⊕n⊕c或C。如果这是真的,那么拥有一个单独的标志就没有多大意义这里的东西。
How exactly do the V and S flags function on the ATMEGA328?
The ATMEGA328 has separate sign (S), carry (C), 2's complement overflow (V) and negative (N) flags. N is the MSB (corresponding to the sign bit on other processors). How exactly the V flag operates is not well explained in the datasheet. As I understand it, V is generally calculated as N⊕C. But S is defined in the datasheet as V⊕N which implies that it equals N⊕N⊕C or just C. If that's true then it doesn't make much sense to have a separate flag for it so I suspect I've misunderstood something here.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
v通常与n xor C不一样。
我通过查看手动,考虑到如果将0xff添加到0x02中会发生什么,以获得0x01。
V is not generally the same as N XOR C.
I found a counterexample by looking at the ADC (Add with Carry) instruction in the manual and considering what would happen if you add 0xFF to 0x02 to get 0x01.