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.
Bookmarks