ATmega32 Controlling DS1802 pot - diyAudio
Go Back   Home > Forums > Amplifiers > Chip Amps

Chip Amps Amplifiers based on integrated circuits

Please consider donating to help us continue to serve you.

Ads on/off / Custom Title / More PMs / More album space / Advanced printing & mass image saving
Reply
 
Thread Tools Search this Thread
Old 15th April 2010, 09:07 AM   #1
fbee is offline fbee  Germany
diyAudio Member
 
Join Date: Mar 2010
Default ATmega32 Controlling DS1802 pot

Hi,
there are some threads on controlling DS1802 with IR or Rotary encoders. I Plan to command the DS1802 with RS232 commands (out of a linn Player).
Now , the ATmega has an SPI out , that could Control the 3wire Serial Input of the DS1802 (RST, CLK, D Inputs).
Can anyone help me, how to generate the Serial commands in the ATmega32, that the DS needs to see?
Thanks a Lot, Frank
  Reply With Quote
Old 15th April 2010, 09:53 AM   #2
ratza is offline ratza  Romania
diyAudio Member
 
ratza's Avatar
 
Join Date: Dec 2007
Location: Sibiu, Romania
You can simply send raw hex values over serial communication, copy the two bytes in some local variables and then send them over SPI. Be carefull with DS1802, since it has the chip select line active on high level and the bytes are sent with LSB first.
__________________
Any solution is a compromise.
  Reply With Quote
Old 15th April 2010, 02:21 PM   #3
fbee is offline fbee  Germany
diyAudio Member
 
Join Date: Mar 2010
Thanks,

as it´s my first uC project, I just wonder if I have to take care, that RST is "high" while the hexcode is sent and so on. In the datasheet of the DS1802 the serial controlling seems sooo complicated with the tcc, tch .... timing and the clocksynchronisation.

Is it that simple, just connecting the clock out of the ATmega (XCK pin#1) to the CLK (pin#3) of the DS1802?

Furthermore I would connect
SCK on the ATmega (pin#7) to D(pin#4) on DS1802,
SS on the ATmega (pin#4) to RST(pin#5) on DS1802
GND to GND.

...or am I missing something?

Frank
  Reply With Quote
Old 15th April 2010, 05:22 PM   #4
Sci is offline Sci  Sweden
diyAudio Member
 
Sci's Avatar
 
Join Date: Jul 2004
Location: Göteborg, Sweden
You might get more help on avrfreaks.net, a site dedicated to AVR programming.
  Reply With Quote
Old 15th April 2010, 05:45 PM   #5
diyAudio Member
 
theAnonymous1's Avatar
 
Join Date: Feb 2004
Location: Anonymityville
Just curious, why the DS1802? It will need an additional buffer circuit and the signal will be limited by the 5V supply.

It's a novel circuit to play with if your just going to use push buttons, but if you plan to put the effort into using a uC then there are better IC's available.
  Reply With Quote
Old 15th April 2010, 06:32 PM   #6
fbee is offline fbee  Germany
diyAudio Member
 
Join Date: Mar 2010
DS1802 because it´s used on the VCCS board for the Lightspeed attenuator, that I build.

The uC would translate the ASCII strings, that come out of the networkplayer, into commands for volume setting (and poweramp control by 12V toggle)

My Ipod with PlugPlayer is an upnp controlpoint of the networkplayer and it uses a slider for Volume setting. So, when I move the slider to 87% volume, the networkplayer sends a command $Volume=87$ (the value is between 0 and 100) as ASCII code to the uC (UART RX).

The uC would recognise the volume command and the value after the "=" and multiply the value by 0,64 (as the DS1802 pointer has 64 steps). Then the uC would somehow?? generate the serial commands for the RST , D and CLK inputs of the DS1802.

Last edited by fbee; 15th April 2010 at 06:35 PM.
  Reply With Quote
Old 15th April 2010, 11:53 PM   #7
diyAudio Member
 
theAnonymous1's Avatar
 
Join Date: Feb 2004
Location: Anonymityville
Ah, ok. So the signal won't be passing through the DS1802, it's just used to control the optocouplers.

Makes sense now.
  Reply With Quote
Old 16th April 2010, 06:56 AM   #8
sasmit is offline sasmit  India
diyAudio Member
 
Join Date: May 2006
Send a message via Yahoo to sasmit
first you need to look at ATMEL documentation for TWI interface, there is an AVR document for ..how to's of TWI.
You can also have a look at the documentation of IC's like TDA7449 that use the TWI inteface for controlling. The datasheet of TDA 7449 in fact carries a lot of information regarding how to send signals over TWI and how to send address etc.
Have a look at this also www.atmel.com/dyn/resources/prod_documents/doc2564.pdf
  Reply With Quote
Old 16th April 2010, 11:43 AM   #9
ratza is offline ratza  Romania
diyAudio Member
 
ratza's Avatar
 
Join Date: Dec 2007
Location: Sibiu, Romania
Quote:
Originally Posted by fbee View Post
Furthermore I would connect
SCK on the ATmega (pin#7) to D(pin#4) on DS1802,
SS on the ATmega (pin#4) to RST(pin#5) on DS1802
GND to GND.
Connections are as following:
D (pin 4) goes to MOSI (pin 6)
CLK (pin 3) goes to SCK (pin 8)
RST (pin 5) goes to SS (pin 5) or any other port pin you like to use as chip select line.
The power supply can be the same for both ATmega and DS.

Flow of the code:
- register initialization (system clock, ports, USART, SPI);
- infinite loop in which data is received over USART and sent over SPI.

I think this thread can be placed better in Digital Line Level section of the forums.
__________________
Any solution is a compromise.
  Reply With Quote
Old 16th April 2010, 02:12 PM   #10
fbee is offline fbee  Germany
diyAudio Member
 
Join Date: Mar 2010
Thumbs up Thanks

Ratza,
thanks this was very helpful.
I´ll try that route.
Cheers, Frank
  Reply With Quote

Reply


Hide this!Advertise here!
Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help! Encoder for DS1802 tifosi_f1 Solid State 3 16th January 2007 12:10 PM
WTB: DS1802 digital pot or similar Moose Swap Meet 0 8th July 2005 10:11 PM
DS1666 vs. DS1802 dalli Chip Amps 0 10th March 2005 08:05 AM
DS1802 with LM3875 soundNERD Chip Amps 11 26th February 2005 08:10 AM
Controlling TDA7448 with DS1802 Help Wanted abid_rehan Digital Source 2 6th September 2004 04:55 PM


New To Site? Need Help?

All times are GMT. The time now is 09:38 AM.


vBulletin Optimisation provided by vB Optimise (Pro) - vBulletin Mods & Addons Copyright © 2014 DragonByte Technologies Ltd.
Copyright ©1999-2014 diyAudio

Content Relevant URLs by vBSEO 3.3.2