We need to learn a few bit handling functions before being able to prepare the data for the DAC: | : bitwise or & : bitwise and data += 5 <=> data = data + 5 data |= 5 <=> data = data | 5 ~data: invert all bits in data data >> 4 all bits in data are shifted right by 4 data << 4 all bits in data are shifted left by 4
Changed:
< <
---++
> >
Writing data to a DAC
Imagine a 12 bit digital to analogue converter with the following register outline:
Line: 306 to 307
The medium significant digit to register 1 (RS=01)
Changed:
< <
And the highest significant digit to register 2 (RS=01)
> >
And the highest significant digit to register 2 (RS=10)
To strobe the data into the register the strobe line must see a low to high transition