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 CCS Technical Support

dsPIC33FJ128GP802 on board DAC

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
ROBERT-SANSOM



Joined: 16 Nov 2011
Posts: 2

View user's profile Send private message

dsPIC33FJ128GP802 on board DAC
PostPosted: Wed Nov 16, 2011 4:57 am     Reply with quote

I am unable to get the on board DAC operational on dsPIC33FJ128GP802.
Can anyone help with getting it set up?
Cheers.
ROBERT-SANSOM



Joined: 16 Nov 2011
Posts: 2

View user's profile Send private message

Here is my code
PostPosted: Wed Nov 16, 2011 10:38 am     Reply with quote

Code:
#include <main.h>
#include <STDIO.H>

#use fixed_io(A_outputs=PIN_A0)
#use delay(clock=20000000)

#word DAC1CON =0x03F0
#word DAC1STAT =0x03F2
#word DAC1DFLT =0x03F4
#word DAC1RDAT =0x03F6
#word DAC1LDAT =0x03F8
#word ACLKCON =0x074A

//PORT A
#define LED   PIN_A0


void main()
{
//Initialise DAC
disable_interrupts(INTR_GLOBAL);
DAC1CON=0b1001000000000001;
DAC1STAT=0b1000000100000000;
DAC1DFLT=0x0000;
//Auxiliary Clock
//ACLKCON=0b0010111100000000;
//Primary clock
ACLKCON=0b0000000010000000;
  while(1)
   {
    output_high(LED);
    delay_ms(500);
    output_low(LED);
    delay_ms(500);

     DAC1LDAT=0xFFFF;
   delay_ms(500);
     DAC1LDAT=0X0000;
     delay_ms(500);
   }

   // TODO: USER CODE!!

}[quote]
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