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

PIC24F, PROTEUS SIM

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



Joined: 03 Sep 2012
Posts: 1

View user's profile Send private message

PIC24F, PROTEUS SIM
PostPosted: Mon Sep 03, 2012 1:25 pm     Reply with quote

Hi, I'm new to PIC24 and I'm having difficulties on using the ADC with it. My simulator ISIS Proteus gives me a warning that looks like "ADC conversion clock period [31.25n] is below minimum recommended [75]n]."

I am posting my code hoping to find clear answers on why is this warning occurring and how can I approach this issue. Thanks in advance.

Code:

#include <24fj128ga010.h>
#fuses XT, NOWDT, NOPROTECT 
#DEVICE ADC=10
#use delay(oscillator=8M,clock=32M)

int16 PORTB;
#byte PORTB=0x2c8
int16 PORTD;
#byte PORTD=0x2d4
int16 PORTE;
#byte PORTE=0x2da
int16 PORTG;
#byte PORTG=0x2e6
#bit VCFG_BIT = 0x0322.13
#define ALL_OUT 0
#define ALL_IN 0xff
#include <math.h>
#include <float.h>
#include <stdlib.h>

void main()
{
int      i=0;
int      k=0;
int      pause;
int      arraySINE[1024];
int      arraySINE2[1024];
int      arraySINE3[1024];
int      fin_val=0;
float32   value=0;

setup_adc(ADC_CLOCK_DIV_128|ADC_TAD_MUL_4);
setup_adc_ports(sAN11|VSS_VREF);
VCFG_BIT = 1;
set_tris_b(0xfc00);
set_tris_d(ALL_OUT);   
set_tris_e(ALL_OUT);

   for(i=0;i<=1023;i++)
   {
   value=sin(k*0.351563*0.017453)*511+511;
   fin_val=(int)value;
   arraySINE[i]=fin_val;
   k=k+1;
   }
   k=120;

   for(i=0;i<=1023;i++)
   {
   value=sin(k*0.351563*0.017453)*511+511;
   fin_val=(int)value;
   arraySINE2[i]=fin_val;
   k=k+1;
   }   
   k=240;

   for(i=0;i<=1023;i++)
   {
   value=sin(k*0.351563*0.017453)*511+511;
   fin_val=(int)value;
   arraySINE3[i]=fin_val;
   k=k+1;
   }
   
   do   {
   for(i=0;i<=1023;i++)
   {
   PORTD=arraySINE[i];
   PORTE=arraySINE2[i];
   PORTB=arraySINE3[i];
    set_adc_channel( 11 );
      delay_us(10); 
    pause=read_adc();
   delay_us(pause);
   }
   }   while(1);   
}


It is a program that creates 3phase sine waves with r2r ladders on each port. Speed is of essence here. The actual program will be implemented on a PIC24HJ using its 80MHz clock . I would appreciate if someone could give me tips about the configuration of the 80MHz clock and some help on the ADC issue.
Ttelmah



Joined: 11 Mar 2010
Posts: 19504

View user's profile Send private message

PostPosted: Mon Sep 03, 2012 1:31 pm     Reply with quote

Start by reading the sticky at the top of the forum.

Seriously, Proteus as a PIC simulator, is full of bugs. It'll accept things that'll never work, but reject things that are fine.

Go elsewhere for questions about this.
Gabriel



Joined: 03 Aug 2009
Posts: 1067
Location: Panama

View user's profile Send private message

PostPosted: Mon Sep 03, 2012 1:32 pm     Reply with quote

The answer lies within...

http://www.ccsinfo.com/forum/viewtopic.php?t=47549
_________________
CCS PCM 5.078 & CCS PCH 5.093
Gabriel



Joined: 03 Aug 2009
Posts: 1067
Location: Panama

View user's profile Send private message

PostPosted: Mon Sep 03, 2012 1:33 pm     Reply with quote

ahhhh...... you beat me to it!
_________________
CCS PCM 5.078 & CCS PCH 5.093
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