170 likes | 466 Views
C8051F020 DAC. See chapter 8 of C8051F02x.pdf. The C8051F020 contains two 12-bit DAC’s Output swing from 0V to VREF-1LSB Several possible sources for VREF Internal reference = 1.2 X 2 = 2.4 volts, AV+, external. Possible update sources: Update on write to high byte of DAC. (Default)
E N D
C8051F020 DAC See chapter 8 of C8051F02x.pdf
The C8051F020 contains two 12-bit DAC’s • Output swing from 0V to VREF-1LSB • Several possible sources for VREF • Internal reference = 1.2 X 2 = 2.4 volts, AV+, external. • Possible update sources: • Update on write to high byte of DAC. (Default) • Update on timer overflow. • Position of 12 bits used can be varied.
0 0 1 1 1 MOV REF0CN,#07H ;USE INTERNAL VREF
1 0 0 0 0 0 MOV DAC0CN,#10000000B ;EN DAC0, UPDATE ON WR, LEFT JUSTIFIED
INIT_DACS: MOV REF0CN,#07H ;USE INTERNAL VREF MOV DAC0CN,#10000000B ;EN DAC0, UPDATE ON WR, LEFT JUSTIFIED MOV DAC1CN,#10000000B ;EN DAC1, UPDATE ON WR, LEFT JUSTIFIED RET WR_DAC0: MOV DAC0L,R7 ;OUTPUT LOW BYTE MOV DAC0H,R6 ;OUTPUT HIGH BYTE RET WR_DAC1: MOV DAC1L,R7 ;OUTPUT LOW BYTE MOV DAC1H,R6 ;OUTPUT HIGH BYTE RET