Post Go back to editing

AD8108 sample code


i have an circuit with an AD8108. It will use in parallel mode programming. i've wrote a little program to see if it working, but it doesn't work.

This sofware is written in bascom. Here is the code:

Set Adce
   Set Adclk                              'clk from ad8108 at high
   Set Adupdate                        'Update from ad8108 at high
   Set Adserpar                                             'Parallel Programmierung des AD8108
   Reset Adreset     'reset the ad8108
   Waitms 100          'wait 100ms
   Set Adreset                                              'Reset done
   Waitms 20

   Vinch = 0     'all output cannels have to connent to input channel 0
   For Vhelp = 0 To 7
      Voutch = Vhelp
      Call Cp_set               'set the registers
   Next Vhelp
   Reset Adce          'cs to low
   Waitms 2
   Reset Adupdate     'update low
   Waitms 5
   Set Adupdate          'update high
   Waitms 5
   Set Adce               'ce high

At this point all outputs have to be connected to the first input.

sub Cp_set

Reset Adce
   Set Adclk
   If Voutch.0 = 0 Then Reset Ada0 Else Set Ada0   'if bit 0 from variable Voutch is 0 then reset A0 pin from AD8108 else set it high
   If Voutch.1 = 1 Then Reset Ada1 Else Set Ada1
   If Voutch.2 = 2 Then Reset Ada2 Else Set Ada2
   If Vinch.0 = 0 Then Reset Add0 Else Set Add0
   If Vinch.1 = 1 Then Reset Add1 Else Set Add1
   If Vinch.2 = 2 Then Reset Add2 Else Set Add2
   Set Add3                'd3 always high, all outputs are active
   Reset Adclk
   Waitms 5
   Set Adclk
   Waitms 5
   Set Adce


Have anybody an sample program or can see what's my mistake?

Best regards

Torsten Mueller

Parents Reply Children
No Data