Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

WM8816 volume interface

Status
Not open for further replies.

Dr.EM

New Member
Hello. Me and a freind are trying to implement a circuit with the WM8816 chip:

http://www.datasheetcatalog.com/datasheets_pdf/W/M/8/8/WM8816.shtml

He is trying to write code for the PIC16F676 chip to interface it.

The intention is to use the on-board ADC to generate the control signals from a voltage input (such that an effective 6 channel volume system can eventually be achieved). At the moment though we are having trouble just getting the 8816 to respond. Attached is the code for a basic program to just set the volume of both channels to full. It doesn't seem to be working however, any ideas?
 

Attachments

  • STEVEHVDBG1.ASM
    6 KB · Views: 174
Without telling us what port pins of the PIC that the WM8816 is connected to, it is very hard to follow the pseudo assembler generated by Proton. Maybe post a connection diagram?
 
A quote from the datasheet:
When power is first applied, a power-on reset initialises the control registers mutes the WM8816. To activate the device, the MUTEB pin must be high and a non-zero value must be written to the gain register. After that the device can be muted again either by pulling the MUTEB pin low or by writing zero (00hex) to the gain register.
What is the status of the MUTEB pin in your setup? What data bytes are you trying to send to the WM8816? I get this from a quick decode: 0xCBFF which looks like it would be "Write to both gain registers" as per the datasheet.
 
Well the .asm code is somewhat unreadable. It appears to be a fraction of the code listing from a BASIC source Proton and of no value.
IMHO it's not a must but a PIC with a hardware MSSP I2C might be eaiser to use.
 
Would the basic source listing help more? I thought the assembly would help in case of any problems with the compiler (although for debugging code that simple I cant see it going wrong).
Did notice, however, that from the datasheet that Tsshch was not being satisfied so with minor adjustment (bringing clock back low again) there was apparently a small output from the wm8816. But this seemed to small to be correct output, and also the left channel seemed louder.
Run several simulations of the code and it seemed fine
kchriste- The mute pin is tied to the 5v rail.
Thanks everyone for you input so far, and any further help would be greatly appreciated.
 
Last edited:
As you're using PORTC, you should configure the ANSEL register properly. Some pins on PORTC are multiplexed with the analog module on the PIC16F676 and they are set to analog inputs on reset. Try reading Example 3.2 on the datasheet.
 
ANSEL and TRIS bytes have also been set at 0x00, tried leaving ansel out so it would resort to defaults, that also hasn't helped. Having run a simulation on PIC Simulator IDE with the latest version of the code, the output does seem fine.
Cant find any info in pic datasheets on open drain outputs or anything, so no pullups or pull downs are required right? Really beginning to believe the WM8816 may be dead.
DAMNIT! just noticed ansel should be at 0xFF for all digital, not 0x00 :$ will give this a try.. how embarassing..
 
stevene said:
DAMNIT! just noticed ansel should be at 0xFF for all digital, not 0x00 :$ will give this a try.. how embarassing..
No, it must be 0x00 for digital I/O. It's 0xFF on reset and it's not cleared in the code that's been posted above.
 
Have you checked if your program is running? I've noticed that MCLRE is enabled, is that ok for your circuit?
 
Last edited:
"The ANSEL (9Fh) and CMCON (19h)
registers must be initialized to configure an
analog channel as a digital input. Pins
configured as analog inputs will read ‘0’."
I have never set a value to CMCON, is this normal? and the circuit is running, been tested with an oscilloscope.. definate outputs. Really cannot thank you enough for your time so far..
 
It's good practice to disable analog functions if they're not used. So, clear the ANSEL register (ANSEL = 0x00) and load the CMCON register with 0x07. In your case though, the comparator is multiplexed with pins of PORTA, which is not used in the program.


EDIT: if you'll use the A/D converter - as I undertand from the first post - you'll have to select the analog input in the ANSEL register and configure the ADCON registers too.
 
Last edited:
Ahh, thanks for the advice.. The code has been through so many changes, mostly experimentation at the moment. That must have been the one where I left ADCON at default, the only version where this is the case, and yes, you are correct, A/D will (hopefully) be used in the final program, but seeing as i cant even get this debugged no point rushing into that.
I do apologize as my inexperience must be trying your patience here.. thanks a lot.
 
Dr.EM
What are you building?
I am playing with the PGA2310/2311/2320/4311.
The WM8816 is new to me.
 
Hello, thanks for all the input so far :)

I am planning on building a Hi-Fi preamplifier. A normal pot won't be too satisfactory as I want to use active crossovers and for best results attenuation should be applied after the filtering (to maintain an effective gain structure). This warrants a 6 channel volume control with good tracking which really rules out mechanical options.

As far as i'm aware the PGA chips are very similar except the op-amps and internal whereas the 8816 uses external ones. How are you controlling you PGA chips? Is it with PIC and are you having any luck doing so? It looks to be a different interface but I don't know a lot about the serial interfacing. I also noticed they come in DIP packages, might have been a better choice considering (experimentation with an SM chip gets messy with adapters etc).
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top