Jump to content
Sign in to follow this  
oktaycit

Adc Simulation In Ide

Recommended Posts

Hi,

 

I want adc simulate in Ide but It doesn't work

 

My code

 

unsigned int readAdc(char channel)

{

volatile bit Go_Done@ADCON0.GO_DONE; // Note the the 18F4520 chip puts this in bit 1.

volatile unsigned char ad_h@ADRESH;

volatile unsigned char ad_l@ADRESL;

 

 

unsigned int AD_Result;

unsigned int shiftH;

unsigned int shiftL;

 

channel %=8;

//adcon1 = 00001110b;

adcon0 &=11100011b;

adcon0 |=channel<<2;

delay_ms(1);

adcon0.ADFM=1; //right justify

adcon0.ADON=1; //start conversion;

Go_Done=1; // Start conversion

*****************************************

while ( Go_Done == 1 ); // Wait for conversion to complete -- better put a timeout in here some time.

**forever loop IDE simulater

******************************************

 

// Separate int's need to be used to keep the shifts from screwing up.

shiftH = ad_h;

shiftL = ad_l;

 

AD_Result = (shiftH<<2) | (shiftL>>6); // Combine the two registers to get full 10 bits.

 

adcon0=0; // Shut off the AD converter.

return AD_Result;

}

Share this post


Link to post
Share on other sites

oktaycit,

 

Hi,

 

I want adc simulate in Ide but It doesn't work

I the sourceboost PIC simulator has its limitations.

 

Have a look in the IDE user manual in section "SourceBoost IDE Simulator features", here its lists the limitations.

 

Regards

Dave

Share this post


Link to post
Share on other sites

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...