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

ADC Program Help

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



Joined: 22 Jun 2014
Posts: 2

View user's profile Send private message

ADC Program Help
PostPosted: Sun Jun 22, 2014 5:21 am     Reply with quote

Below is my code and I have implemented it on Proteus as well but my supply is of 5 volts so why is the serial communicator giving me absurd calculations?

Code:


#include <ADC.h>


void main()
{
   
   float value=0.0;
   setup_adc_ports(AN0_AN1_AN2_AN3_AN4_AN5);
   setup_adc(ADC_CLOCK_DIV_32);
   //Setting up PORT 1
   set_adc_channel(1);
   
   while (1)
   {
      delay_ms(300);
      value=read_adc();
      delay_us(300);
      printf("ADC Value is %f\n\r",value);
   }

}



http://imageshack.com/a/img837/6938/fwju.png
temtronic



Joined: 01 Jul 2010
Posts: 9202
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Sun Jun 22, 2014 5:48 am     Reply with quote

EASY answer....please read PIC101...

Proteus is FULL of BUGS, ERRORS and Faulty DRCs..
It is a critically damaged piece of software KNOWN to NOT 'simulate' PICs properly, so how can anyone possibly, correctly debug ?

In your schematic there are at least 14 errors,any of which are fatal.

The first is the injecting of an AC signal into the PIC ADC.In the real world doing this let's the 'magic smoke' out of the PIC and turns it into pure sillycon.

jay
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