CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

DsPic - How to configure audio Digital-to-analog converter ?

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
g.desvaux



Joined: 19 May 2009
Posts: 2

View user's profile Send private message

DsPic - How to configure audio Digital-to-analog converter ?
PostPosted: Tue May 19, 2009 9:13 am     Reply with quote

Hello all,

I would like to use the audio digital-to-analog converter of a DSPIC33FJ64GP802, but there are no explanations in the CCS manual.

I find this in file 33FJ64GP802.h in the CCS Folder :
Code:

// Digital to Analog Functions: SETUP_DAC(), DAC_WRITE()
// Constants used in SETUP_DAC() are:
#define DAC_OFF  0
#define DAC_RIGHT_ON   0x00808000
#define DAC_LEFT_ON    0x80008000
#define DAC_RIGHT_MIDPOINT 0x00A08000
#define DAC_LEFT_MIDPOINT  0xA0008000
#define DAC_SIGNED   0x100
#define DAC_SLEEP_ON 0x1000
#define DAC_IDLE_OFF 0x2000
// Constants used as the first param in DAC_WRITE() are:
#define DAC_DEFAULT  0
#define DAC_RIGHT    1
#define DAC_LEFT     2

When I use these function, the compiler ask two parameters P1 and P2 :
Code:
SETUP_DAC(P1,P2)
DAC_WRITE(P1,P2)

What values can I use for P1 and P2 ?
Can you post a code example ?

Thanks,
g.desvaux



Joined: 19 May 2009
Posts: 2

View user's profile Send private message

DsPic - How to configure audio Digital-to-analog converter ?
PostPosted: Fri May 29, 2009 3:37 am     Reply with quote

it's Ok.

Hardware configuration :
- DsPicc33FJ64GP802 (No DAC Midpoint output)
- Osc = 20MHz, Clock = 40MHz (PLL use)

Function setup_dac is not working properly.
I configure DAC Register with the following code in ASM :
Code:
 #asm
 MOV     #0x80, W4
 MOV     W4, 0x03F2
 MOV     #0x9003, W4
 MOV     W4, 0x03F0
 #endasm

DAC registers are configured for : DAC enables , Continue Module operation in Idle Mode, Analog output amplifier is enable during sleep/modeStop-in Idle mode bit, Data Unsigned, Divide input clock by 2, DAC right output Enable.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group