Innaz Review, Samsung Galaxy, price and specifications, Flash Android, Games For Your Apple, Jailbreak Tool For iOS, IMEI Unlock Method

Senin, 24 September 2012

ANALOG TO DIGITAL CONVERTION using PIC16F877A and MPLABX

ANALOG TO DIGITAL CONVERTION using PIC16F877A and MPLABX - In the past, when I started to start blogging, many thoughts disturbed me. I want to have a blog with a nice and interesting look. I am constantly looking for basic tutorials from some web and blogs on the internet. And thankfully, one by one I started to do it, and of course have to go through some confusion process first, but the most important of a blog that is content, yes on the blog Innaz Review we will discuss a lot of information about gadgets that are very in need by you, now we will discuss first about ANALOG TO DIGITAL CONVERTION using PIC16F877A and MPLABX please refer to the information we will convey until completion:

Articles : ANALOG TO DIGITAL CONVERTION using PIC16F877A and MPLABX
full Link : ANALOG TO DIGITAL CONVERTION using PIC16F877A and MPLABX

You can also see our article on:


ANALOG TO DIGITAL CONVERTION using PIC16F877A and MPLABX


Many electrical signals around us are Analog in nature. That means a quantity varies directly with some other quantity. The first quantity is mostly voltage while that second quantity can be anything like temperature, pressure, light, force or acceleration.

The PIC16F877A has a built-in Analogue to Digital converter. What ADC does is basically convert an analogue voltage ranging from -Vref to +Vref (usually 0V to 5V) and converts it to a binary value. The ADC on the PIC16F877A has 10-bit resolution and this provides 1024 steps (2^10=1024) which is more than enough for normal applications.



Programming ADC in HI-TECH C for MPLAB

ADC is connect to the PIC CPU by 3 control register and 2 data register. The control registers are used to setup and give commands to the ADC. They also provides the status of ADC. The two data registers holds the 10 bit of converted data. Since each resister in PIC18 is of 8 bits therefore 2 registers are required to hold the 10bit data.
We will develop two functions to support ADC in our projects. One will help initialize the module and other will help us select any of the 13 channels and start the conversion. After the conversion is done it will return us the results.
I am not giving here the description of the control and data registers as they are very clearly explained in PIC18F4520's datasheet on page 223 to 225. I request you to download the datasheet and read the description so that you will have an Idea of what every bit in the registers do. As I told before, ADC is connected to the CPU via three control register and two data registers. The three control registers are :-
  • ADCON0 - Used to select analog input channel,start the conversion, check if the conversion is done and to switch on/off the module.(We use this in ADCRead() function.)

  • ADCON1 - Used to Select Voltage reference, and to configure ports as Analog of digital. (We leave these to defaults)

  • ADCON2 - Used to select ADC data format, Set acquisition time, ADC clock setup (We setup these in ADCInit() function)

First we configure the ADC to our needs in the ADCInit() function.
//Function to Initialise the ADC Module
void ADCInit()
{
//We use default value for +/- Vref

//VCFG0=0,VCFG1=0
//That means +Vref = Vdd (5v) and -Vref=GEN

//Port Configuration
//We also use default value here too
//All ANx channels are Analog

/*
ADCON2

*ADC Result Right Justified.
*Acquisition Time = 2TAD
*Conversion Clock = 32 Tosc
*/

ADCON2=0b10001010;
}



ADCRead function ...


//Function to Read given ADC channel (0-13)
unsigned int ADCRead(unsigned char ch)
{
if(ch>13) return 0; //Invalid Channel

ADCON0=0x00;

ADCON0=(ch<<2); //Select ADC Channel

ADON=1; //switch on the adc module

GODONE=1; //Start conversion

while(GODONE); //wait for the conversion to finish

ADON=0; //switch off adc

return ADRES;
}




THE PROGRAM IS AVAILABLE ON GITHUB : https://github.com/ebine/



so much information ANALOG TO DIGITAL CONVERTION using PIC16F877A and MPLABX

hopefully ANALOG TO DIGITAL CONVERTION using PIC16F877A and MPLABX information can provide benefits for you in determining the gadgets that fit your needs in daily life.

you just read ANALOG TO DIGITAL CONVERTION using PIC16F877A and MPLABX if you feel this information is useful and want to bookmark or share it please use link https://innaz2.blogspot.com/2012/09/analog-to-digital-convertion-using.html if you want more information please search on other pages this blog.

Tag :
Share on Facebook
Share on Twitter
Share on Google+
Tags :

Related : ANALOG TO DIGITAL CONVERTION using PIC16F877A and MPLABX

0 komentar:

Posting Komentar