'*******************  A-628 DEMO Program  ************************
'*    A-628 8 Channel analog output Board                        *
'*    Demo program for Quick Basic                               *
'*    Write By Hybertek Co. LTD., Richard Chen                   *
'*    Date 01.15.199                                             *
'*****************************************************************
CLS

PRINT " Set A-68  1. Unipoar Mode "
PRINT "           2. Vref = 5V "
PRINT " Analog output Range = 0 - 5V"
PRINT " Press < Enter > Key Analog output Channel 0 Will Output  3.5V"
INPUT a

Bas = &H2C0     ' Set base Address  (Def address)

Vref = 5       ' Set Reference Voltage By Jumper JP1- JP8
               ' If  Reference Voltage = 10 then let Vref=10

VOCH = 0       ' Set Analog output Channel VOCH=0-7

Vo = 3.5       ' Output volatge

                            ' 0-5V
Vdata = Vo * 4095 / Vref    ' Conversion Voltage to 12 bit Data (Unipolar)
                            ' Vdata = (Vo * 2048/Vref)+2048     (Bipolar)



Hibyte = FIX(Vdata / 256)          ' 4 bit data D8-D11 (High byte)
Lobyte = Vdata - (Hibyte * 256)    ' 8 bit data D0-D7  (Low byte)

                                  ' Write Data to D/A Convision
OUT Bas + VOCH * 2, Hibyte        ' High byte First
OUT Bas + VOCH * 2 + 1, Lobyte    ' Then Low Byte











