Shop OBEX P1 Docs P2 Docs Learn Events
PGA2310 and BS2 help — Parallax Forums

PGA2310 and BS2 help

XlratorXlrator Posts: 8
edited 2006-03-23 05:11 in BASIC Stamp
I have a PGA2310 Stereo Audio Volume Control socketed on a perfboard and connected to my HomeworkBoard according to the datasheet, but I still cannot get any response from it. With the code below I am trying to send straight binary to it. 16 bits, the first 8 for Right channel and last 8 for Left channel. I also tried the sending the 8 bits seperately.

volume_1 = %00011001 'channels step #25
LOW 7
PAUSE 10
SHIFTOUT 6, 5, MSBFIRST, [noparse][[/noparse]volume_1\8,volume_1\8]
PAUSE 10
HIGH 7

Should it work this way or am I misunderstanding something? Or do I need to check my perfboard for the 50th time? confused.gif

The datasheet can be found here: focus.ti.com/docs/prod/folders/print/pga2310.html#technicaldocuments

' {$STAMP BS2}
' {$PBASIC 2.5}

volume_1    VAR    Word
volume_2    VAR    Word
volume_3    VAR    Word

DIRL = %11100000

DO
    volume_1 = %0001100100011001    'both channels step #25
    LOW 7
    PAUSE 10
    SHIFTOUT 6, 5, MSBFIRST, [noparse][[/noparse]volume_1\16]
    PAUSE 10
    HIGH 7
    PAUSE 2000

    volume_2 = %0100101101001011    'both channels step #75
    LOW 7
    PAUSE 10
    SHIFTOUT 6, 5, MSBFIRST, [noparse][[/noparse]volume_2\16]
    PAUSE 10
    HIGH 7
    PAUSE 2000

    volume_3 = %0110010001100100    'both channels step #100
    LOW 7
    PAUSE 10
    SHIFTOUT 6, 5, MSBFIRST, [noparse][[/noparse]volume_3\16]
    PAUSE 10
    HIGH 7
    PAUSE 2000

LOOP

Comments

  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-03-22 05:42
    I have one of these audio chips but have not yet had time to mess around with it.· If you do not find an answer by this weekend reply again and I will hook it up and see what I can come up with.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • bjhamltnbjhamltn Posts: 21
    edited 2006-03-23 00:23
    I've used this chip before, your code looks correct, the problem may be the circuit.
    Do you have the chip in upside down? And how are you connectiong the +VA and -VA of the chip?
    And if you are uisng electrolitic capacitors make sure they aren't in backwards.

    Heres is some code that I used

    '{$STAMP BS2e}
    '{$PBASIC 2.5}
    '{$PORT COM1}
    '------------------Constants--------------------
       ZCEN         PIN      15          'zero crossing active high
       CS           PIN      14          'chip select active low
       SDI          PIN      13          'serial data input
       SCLK         PIN      10          'serial clock input
       Mute         PIN      8           'mute active low
       zero         CON      0
       '----------------Variables----------------------
       Channel      VAR      Word
       right        VAR      channel.HIGHBYTE
       left         VAR      channel.LOWBYTE
       '-----------------PROGRAM-----------------------
    Startup:
    HIGH ZCEN
    HIGH MUTE
    HIGH CS
       DEBUG CLS,
       "ch_R>>.........        ", CR,
       "ch_L>>.........        ", CR
        '-----------------PROGRAM-----------------------
    Main:
       LOW CS
       right= 6     'can be set from 0 TO 255
       left=  6     'can be set from 0 TO 255
       SHIFTOUT SDI, SCLK, MSBFIRST,[noparse][[/noparse]Channel/16]
       HIGH CS
       DEBUG CRSRXY, 15, 3,
       DEC right, CLREOL,
       CRSRXY, 15, 4,
       DEC left, CLREOL, CRSRX ,0
    
    
  • XlratorXlrator Posts: 8
    edited 2006-03-23 04:16
    Thanks for confirming the code. That helped me locate the loose pad on the perfboard that shorted out when the board & wires were pressed in it's housing. redface.gif

    Now it's time to work with the rotary encoder!!
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-03-23 05:11
    Rotary Encoder code examples were listed in the following thread.· Take care.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
Sign In or Register to comment.