Chapter 1 : Introduction to the HC12 Microcontroller - EngSoc
Chapter 1 : Introduction to the HC12 Microcontroller - EngSoc
Chapter 1 : Introduction to the HC12 Microcontroller - EngSoc
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
The 68<strong>HC12</strong> <strong>Microcontroller</strong><br />
Addition Overflow<br />
Is that <strong>the</strong> only interpretation of <strong>the</strong> example?<br />
1111 1111 2<br />
+ 0000 0001 2<br />
(1) 0000 0000 2<br />
Result is correct if <strong>the</strong> values are interpreted as 2’s<br />
complement signed integers! ( – 1 + 1 = 0 )<br />
• In that case, no overflow, and carry at MSB<br />
not important!<br />
H. Huang Transparency No.1-39<br />
The 68<strong>HC12</strong> <strong>Microcontroller</strong><br />
Addition Overflow<br />
OVERFLOW DEPENDS ON THE INTERPRETATION OF<br />
VALUES!<br />
Ano<strong>the</strong>r example:<br />
unsigned signed<br />
0111 1111 2<br />
127 127<br />
+ 0000 0001 2<br />
+ 1 + 1<br />
1000 0000 2<br />
128 – 128<br />
UNSIGNED OVERFLOW<br />
Did NOT occur<br />
• The C flag is cleared.<br />
SIGNED OVERFLOW did occur!<br />
(even though <strong>the</strong>re is no carry<br />
outside of fixed width!)<br />
• The V flag is set.<br />
H. Huang Transparency No.1-40