08.01.2013 Views

Introduction to Microcontrollers

Introduction to Microcontrollers

Introduction to Microcontrollers

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

2.1. PROCESSOR CORE 13<br />

Example: Use of Status Register<br />

The status register is very useful for a number of things, e.g., for adding or subtracting numbers<br />

that exceed the CPU word length. The CPU offers operations which make use of the carry flag,<br />

like ADDC a (add with carry). Consider for example the operation 0x01f0 + 0x0220 on an 8-bit<br />

CPU b c :<br />

CLC ; clear carry flag<br />

LD R0, #0xf0 ; load first low byte in<strong>to</strong> register R0<br />

ADDC R0, #0x20 ; add 2nd low byte with carry (carry

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!