#picaxe 20x2
#Terminal 9600
#No_Table
#No_Data
hi2csetup i2cmaster, %11000000, i2cfast, i2cbyte 'default chip address
hi2cout (%00000101) 'startup and pass the value stored in the eeprom to the DAC.
'note: don't use the General Call Address as suggested previously, hi2cout is sending the
'device address so "%00000000,(%00000110)" changes the DAC output voltage.
'if you want the output at startup to be zero or other defined voltage store that value in the
'eeprom
main:
for w1 = 0 to 4095
w2 = w1<<4
hi2cout (%01000000,b5,b4) 'sets DAC output voltage without storing in eeprom
'hi2cout (%01100000,b5,b4) 'sets DAC output voltage and stores in eeprom
next w1
for w1 = 4095 to 0 step -1
w2 = w1<<4
hi2cout (%01000000,b5,b4)
next w1
goto main
theend: