Controling a TDA7318 (I2C) Audio Processor


Closed Thread
Results 1 to 7 of 7
  1. #1
    Badger's Avatar
    Badger Guest

    Default Controling a TDA7318 (I2C) Audio Processor

    Hi there,
    I hope someone can help, I am trying to controll a TDA7318 Audio Processor with the I2CWRITE command but it is not working.
    The chip address is 10001000 and then the control bits after that, for example to switch to stereo 1 with 0dB gain woul be 01011000.

    So my test code which I am useing looks like ths:

    'Program to test I2C TX

    SCL VAR PORTA.2 ' Clock pin
    SDA VAR PORTA.3 ' Data pin

    TRISA = %00010 'Set portA as o/p pin 1 i/p
    TRISB = %11111111 'set ports as i/p


    MAIN:
    IF PORTA.1 = 1 THEN DECODE
    GOTO MAIN

    DECODE:

    IF PORTB = %00000001 then GOSUB ONE
    IF PORTB = %00000010 then GOSUB TWO
    IF PORTB = %00000011 then GOSUB THREE
    IF PORTB = %00000100 then GOSUB FOUR
    ' IF PORTB = %00000101 then GOSUB FIVE
    ' IF PORTB = %00000110 then GOSUB SIX
    ' IF PORTB = %00000111 then GOSUB SEVEN
    GOTO MAIN


    ONE:
    I2CWRITE SDA,SCL,%10001000,%01011000 'select stereo 1 gain of 0dB
    PAUSE 5
    RETURN

    TWO:
    I2CWRITE SDA,SCL,%10001000,%01011001 'select stereo 2 gain of 0dB
    PAUSE 5
    RETURN

    THREE:
    I2CWRITE SDA,SCL,%10001000,%01011010 'select stereo 3 gain of 0dB
    PAUSE 5
    RETURN
    FOUR:
    I2CWRITE SDA,SCL,%10001000,%01011011 'select stereo 4 gain of 0dB
    PAUSE 5
    RETURN

    GOTO MAIN
    END

    I have looked on a scope and it looks like it has sent the control code (10001000), but nothing else.
    It also looks like there is no ack from the TDA.
    Can anyone help?
    TIA
    Stefan.

  2. #2
    Badger's Avatar
    Badger Guest


    Did you find this post helpful? Yes | No

    Default

    I looked on a scope today, and after reading up on the I2C specs it looks like it is sending the chip address 10001000 and then a stop bit instead of an ack and thats it. It seams to be ignoring the control signals.

  3. #3


    Did you find this post helpful? Yes | No

    Default

    Might be a silly question but whats the value you're try to write? I see the data pin, clock pin, control and address but I don't see a value to write to that address.

  4. #4
    Badger's Avatar
    Badger Guest


    Did you find this post helpful? Yes | No

    Default

    Hi there,
    all you have to do is to send the chip address (10001000) and the data to control the chip (01011000 which will switch the chip to stereo 1 with 0dB of gain), I don't think I have to write anything else to it.
    You can get the datasheet from :-http://www.angliac.com/st/data_from_st/1491.pdf
    see if I have missed anything out.
    Thanks.

  5. #5
    Badger's Avatar
    Badger Guest


    Did you find this post helpful? Yes | No

    Default

    I have found that the TDA is not acknowledging the PIC Data.
    I don't know why though?
    Stefan

  6. #6
    Calco's Avatar
    Calco Guest


    Did you find this post helpful? Yes | No

    Default

    Badger,

    What microcontroller are you using?

    I ask just incase it is one with analogue/comparators on port a. this might be causing you problems.

    Regards

    Darryl

  7. #7
    Badger's Avatar
    Badger Guest


    Did you find this post helpful? Yes | No

    Default

    Thanks for your reply's
    Had another look at the circuit and found that I had put the resistor array across some pins that I had not defined, which caused a few problems.
    I made sure it was on only the sda & scl pins and it sorted the problem.
    Thanks anyway
    Stefan.

Similar Threads

  1. I2C Master/Slave 16F88/16F767 working code
    By DanPBP in forum Code Examples
    Replies: 2
    Last Post: - 23rd October 2012, 23:31
  2. HARDWARE I2C SAMPLE CODE question
    By Michael Wakileh in forum Code Examples
    Replies: 2
    Last Post: - 16th June 2009, 22:07
  3. Another I2C Slave Routine Problem
    By DanPBP in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 19th February 2009, 06:50
  4. I2C Master Slave issues.
    By cpayne in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 29th March 2008, 20:33
  5. Please help with i2cslave i2c slave
    By cycle_girl in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 1st December 2005, 14:55

Members who have read this thread : 0

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