@ device hs_osc
define osc 4

Ctrl con %10010000

CPIN var portb.1
DPIN var portb.0

trisa=0
porta=255
pause 1000
porta=0
pause 1000' Pause 50ms for MC23016 to start-up



main:
i2cwrite DPIN, CPIN, Ctrl,%00000000,%10000000,%00000000 '512*Vref/1024
pause 2000
i2cwrite DPIN, CPIN, Ctrl,%00000000,%00000000,%00000000
pause 2000
goto main





with this code i able to generate analog voltage at the output. But funny thing is i only able to generate the first value (512*Vref/1024) but no respond after 2s. It suppose to change to 0V after 2s.