MX7705 or AD7705 experience


Closed Thread
Results 1 to 2 of 2
  1. #1
    FM11's Avatar
    FM11 Guest

    Default MX7705 or AD7705 experience

    I´m using MX7705/AD7705 who has 2 input chanals, each can recieve 16 bit data.
    The code belov is running for canal 0 ($38) or 1 ($39), but not if I use chanal 0 and 1 at the “same” time (as the code belov).
    Hovever if I make a breake at 1 sekund (!!!!) betveen the reading at chanal 0 and 1 the code is running.
    I would like to know if anyone here has experience with 7705 and can tell me vhat I am doing wrong.
    Thank you in edvance
    FM11
    __________________________________________________ _____________
    ' Oscillator : XT
    ' Watchdog Time : Off
    ' Power Up Time : On

    DEFINE OSC 4
    DEFINE LCD_LINES 4

    'AD7705
    Symbol SCK=PORTC.4 'Clock pin
    Symbol SO=PORTC.6 ' AD7705 Data out pin.
    Symbol SI=PORTC.5 ' AD7705 Data in pin

    Output portc.4
    Output portc.6
    Input portc.5
    Input portc.3

    'AD7705
    Send var Byte 'byte sent to communication register of AD7705
    rec var Byte 'byte received from AD7705nly for communication register, set-up register and clock register (8 bit registers)
    ready var Byte 'AD7705 Ready BIT
    ad var Word 'ad converter value read from AD7705
    ad2 var Word 'ad converter value read from AD7705

    Clear 'clear all variables

    pause 1000
    Lcdout $FE, 2, "Test 60" ' linie 1
    pause 2000

    'MX7705
    gosub MX7705Ini

    Lcdout $FE, 2, " " ' Linie 1
    countd var word
    countd=0

    loop:

    'AD7705
    While portc.3=1 'wait for valid data to be received
    countd=countd+1
    Lcdout $FE, 2, "Count:", dec countd ' linie 1
    Wend 'wait for valid data to be received
    Send=$38 ' Read the 16 bit DATA Register, channel 0.
    shiftout SI, SCK, 5, [Send\8] ' Send read command and data register address
    shiftin SO, SCK, 6, [ad\16] ' Read 16 bit data
    Lcdout $FE, $c0, " " ' Linie 3
    Lcdout $FE, $c0,"V:", dec ad ' Linie 3

    'pause 1000

    While portc.3= 1 'wait for valid data to be received
    countd=countd+1
    Lcdout $FE, 2, "Count:", dec countd ' linie 1
    Wend 'wait for valid data to be received
    Send=$39 ' Read the 16 bit DATA Register, channel 1.
    shiftout SI, SCK, 5, [Send\8] ' Send read command and data register address
    shiftin SO, SCK, 6, [ad\16] ' Read 16 bit data
    Lcdout $FE, $90," " ' Linie 2
    Lcdout $FE, $90,"Amp:",dec ad ' Linie 2

    if countd>60000 then countd=0
    GoTo loop
    __________________________________________________ _____________
    MX7705Ini:
    'Reset MX7705
    Send=$ff
    rec=$ff
    shiftout SI, SCK, 5, [Send\8] ' Send command to communication register
    shiftout SI, SCK, 5, [rec\8] ' Send value to the selecte register
    shiftout SI, SCK, 5, [Send\8] ' Send command to communication register
    shiftout SI, SCK, 5, [rec\8] ' Send value to the selecte register

    'AD7705 set-up Start.
    Send=$20 ' WRITE TO THE COMMUNICATIONS REGISTER. SELECT CHANNEL 1 AND SET NEXT OPERATION AS A WRITE TO THE
    ' CLOCK REGISTER.(0x20)
    ' Send=$21 ' WRITE TO THE COMMUNICATIONS REGISTER. SELECT CHANNEL 0 AND SET NEXT OPERATION AS A WRITE TO THE
    ' CLOCK REGISTER.(0x21)
    shiftout SI, SCK, 5, [Send\8] ' Send command to communication register
    ' rec=$0C ' write on clock register: clock division=1, clock bit=1, master clock enabled (bit set to 0),
    ' bit output rate set to 50hz.
    rec=$0f ' write on clock register: clock division=1, clock bit=1, master clock enabled (bit set to 0),
    ' bit output rate set to 500hz
    shiftout SI, SCK, 5, [rec\8] ' Send value to the selecte register

    'Calib 'self-calibration
    Send=$10 ' WRITE TO THE COMMUNICATIONS REGISTER. SELECT CHANNEL 1 AND SET NEXT OPERATION AS A WRITE TO THE SETUP REGISTER.(0x10).
    ' Send=$11 ' WRITE TO THE COMMUNICATIONS REGISTER. SELECT CHANNEL 0 AND SET NEXT OPERATION AS A WRITE TO THE SETUP REGISTER.(0x10).
    shiftout SI, SCK, 5, [Send\8] ' Send command to communication register
    'rec=$46 ' write $46 (bin 01000110) on Setup Register (tabel 9):01=enable self calibration,PGA Gain 1, 1=unipolar operation,
    ' 1=buffer control on, 0= enable filter synchronization
    rec=$44 ' WRITE TO THE SETUP REGISTER. SET SELF-CALIBRATION MODE, GAIN TO 0, UNIPOLAR MODE, UNBUFFERED MODE.
    ' BEGIN SELF-CALIBRATION/CONVERSION BY CLEARING FSYNC.(0x44)
    shiftout SI, SCK, 5, [rec\8] ' Send value to the selecte register
    While portc.3=1:Wend 'wait for valid data to be received. Er angivet under self calibration mode.
    ' Note that after the self calibration, AD7705 start free conversion cycle.
    Return

  2. #2
    FM11's Avatar
    FM11 Guest


    Did you find this post helpful? Yes | No

    Default Problem solved

    The problem is solved. I have to calibrate ($10/$11 and $44) every time I change the chanel

Similar Threads

  1. Anybody have experience with FT232R USB chip?
    By circuitpro in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 10th October 2009, 04:04
  2. Experience of driving TFT screens?
    By isaac in forum General
    Replies: 1
    Last Post: - 26th September 2008, 00:15
  3. AD7705 is 15bit or 16bit ADC
    By ravindrajoga in forum Off Topic
    Replies: 1
    Last Post: - 13th July 2007, 14:09

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts