Search
Cool News
Hot Topics
amd
API
Apple
application
blog
business
camera
cell
ceo
computer
CPU
desktop
Development
device
digital
electron
facebook
generation
Google
Hardware
ims
information
interface
Internet
iphone
iss
memory
microsoft
money
Network
performance
processor
research
rms
Samsung
sla
Software
Space
storage
system
technology
type
web
windows
XP Business (1)
Cloud Computing (1)
Communications (121)
Computers (60)
Digital (155)
Electronics (857)
FPGA (28)
Gadgets (3107)
Hardware (3963)
Internet (3)
Mac (797)
MicroControllers (65)
Networking (2)
Online Services (2)
Open Source (228)
Phones (76)
Security (2)
SEO (1)
Software (12)
Storage (1)
Technology (1712)
Virtualization (2)
VoIP (1)
Webinars (1)
WP Cumulus Flash tag cloud by Roy Tanck and Luke Morton requires Flash Player 9 or better.
Interesting News
- A Look Inside Tumblr’s Architecture
- Google+ Photo Search With Image Recognition
- Promoción Social – Fein – Clubes barriales
- Apple considerada como la mejor marca por tercer año consecutivo
- Báez en el diario de Báez
- A good wife
- LAN concluye los trabajos de modificación de sus Boeing 787
- Rizzoli to referee UEFA Champions League final
- El gestor de Google Drive Archy llega a su versión final y estable
Links
Our Archive
- May 2013
- April 2013
- March 2013
- February 2013
- January 2013
- December 2012
- November 2012
- October 2012
- September 2012
- August 2012
- July 2012
- June 2012
- May 2012
- April 2012
- March 2012
- February 2012
- January 2012
- September 2011
- August 2011
- July 2011
- June 2011
- May 2011
- March 2011
- February 2011
- January 2011
- December 2010
- November 2010
adc interfacing with Pic16f877
An analog-to-digital converter (A/D) is used to convert an analog signal, such as
voltage, to digital form so a microcontroller can read and process it. Some
microcontrollers have built-in A/D converters. External A/D converter can also be connected to any type of microcontroller. A/D converters are usually 8 to 10 bits, having 256 to 1024 quantization levels. Most PIC microcontrollers with A/D features have multiplexed A/D converters which provide more than one analog input channel.
For example, the PIC18F452 microcontroller and PIC16f877 have 10-bit 8-channel A/D converters. The A/D conversion process must be started by the user program and may take several hundred microseconds to complete. A/D converters usually generate interrupts when a conversion is complete so the user program can read the converted data quickly.
A/D converters are especially useful in control and monitoring applications, since most sensors (e.g., temperature sensors, pressure sensors, force sensors, etc.) produce analog output voltages.
First of all if we have checked the data sheet of the microcontroller PIC 16f877. Then we will come to know that it have builtin Analog to digital converter. The microcontroller PIC16f877 have built in adcs. what we need is carefull configuration of the special purpose registers associated with ADC in PIC16f877. Best practice is to start using analog to digital converter from AN0 to onword. becuase if you will start from AN4 or AN5 then you will notic that there are some analog channel which have to configure them as spare channel. At first it appears that the PIC16F877 has 8 built-in ADCs, but this is not the case. The input analogue channels AN4..0 are shared with port A, and channels AN7..5 are shard with port E. If less than eight analogue channels are required then some of the pins can be assigned as digital I/O port lines using PCFG3..0 bits (see datasheet). For example, if PCFG3..0 = 0010 then AN4..0 are configured as analogue inputs, while AN7..5 are digital (port E free), with VDD used as the reference.Any how, I suggest my students, to use builtin ADC of the PIC 16f877 for any general purpose expierement. As they have good enough resolution and in the most of the assignments they have good performance. The typical resolution of the ADC built in PIC 16f1877 are 10bits, i.e you can have 5000(mV)/1024 = 4.88 mV/bit. It is fine for some cases. When you need some higher resolution then you can attach 12bit or 14, 16 bit ADC with PIC16f877 very easily. In the coming post we will learn how to interface 12-bit ADC with Microcontroller PIC16f877.There are many
analog-to-digital converter chips available on the market, and an embedded systems designer should understand the characteristics of such chips so they can be used efficiently. As far as the input and output voltage are concerned A/D converters can be classified as either unipolar and bipolar. Unipolar ADC accept unipolar input voltages in the range 0 to þ0V, and bipolar ADC accept bipolar input voltages in the
range V. Bipolar converters are frequently used in signal processing applications, where the signals by nature are bipolar. Unipolar converters are usually cheaper, and they are used in many control and instrumentation applications. The typical steps involved in reading and converting an analog signal into digital form, a process also known as signal conditioning. Signals received from sensors usually need to be processed before being fed to an ADC. The processing usually begins with scaling the signal to the correct value. Unwanted signal components are then removed by filtering the signal using classical filters (e.g., a lowpass filter). Finally, before feeding the signal to an ADC, the signal is passed through a sample-and-hold device. This is particularly important with fast real-time signals whose value may be changing between the sampling instants. A sample-andhold device ensures that the signal stays at a constant value during the actual conversion
process. Many applications required more than one ADC, which normally involves using an analog multiplexer at the input of the ADC. The multiplexer selects only one signal at any time and presents this signal to the ADC. An ADC usually has a single analog input and a digital parallel output.
The most practical method of reading Analog signal is by using an ADC built into a PICmicro® MCU. The ADC read can be carried out in the following macro:
ADCRead Macro
bsf ADCON0, GO ; Turn on the ADC
btfsc ADCON0, GO ; Wait for it to Complete
goto $ – 1
endm
Method to use Built in ADC of PIC16f877 in MicroC C language:
void main()
{
ADCON1 = 0×00 ; // set PORTA as analog input
TRISA = 0xff ; // set PORTA as inputs
while (1)
{
temp = Adc_Read(0);
}
}
In the above example single channel ADC is used , however you can use upto eight ADC by selecting one by one. the analog voltage from PORTA channel 0. The analog voltage is supplied by a potentiometer. As you change the variable resistance the voltage that is applied to PORTA channel 0 will change. The ADC module of the PIC16F877 will convert the input voltage to an integer number between 0 and 1024. Notice that the ADC module of the PIC 16F877 is a 10-bit module, so the there are 1024 binary number to represent the input voltage range.The output of ADC module is a 10-bit binary number.
The Microcontroller PIC16F873A has 5 10-bit ADC channels,16F874A has 8 10-bit ADC channels,16F876A has 5 10-bit ADC channels,16F877A has 8 10-bit ADC channels.
reflectance sensor with PIC16F877 solar panel voltage by using PIC16F877 microcontroller. Microcontroller-based converter is chosen because it permits easy system modifications.
Automatic Furnace Temperature Control
In this project temerature of a furnace is controlled using microcontroller PIC16f877.
The furnce is a closed chamber in which an electric heater and fan is used to maintain the critical temperature.
The temperature is measured and checked then fan or heater is turned ON if necessary.
The Project is desinged to build an automatic furnce by taking a stability in preference. The heater and fan are turned ON in a specific range instead of set point. Forexample, if the set point is 50 degree C and running temerature is 25 degree C, then heater will be ON if temerature till 49 is echived then dueto heater’s interia or heat in chamber, temperature can be rised to 51C, if temperature goes up even more than this, fan will be turned ON. Then temerature starts falling, Fan will switched OFF on 52C. and heater will then ON if temperature is down to 48C. This way the temperature will be very stable.
Source code:-
unsigned int cnt ,brk,lr,hr,st,chr,clr;
char led [3],key;
unsigned int rem ;
void converter (unsigned int z);
void scanled (void);
void highrang (void);
void lowrang (void);
void setvalue (void);
void keyid (void) ;
unsigned int valueed (unsigned int a);
void cont1 (void);
void main() {
OPTION_REG = 0×80; // pull up resistors
TRISB = 0x1f; // designate portb pins as first five line as input
PORTB = 0xff; //and other as output
TRISC = 0×00; // designate portb pins as first five line as input
PORTC = 0xec; //and other as output
PORTD = 0; // clear portd (make sure LEDs are off)
TRISD = 0; // designate portb pins as output
ADCON1 = 0×80;//ADCON2 = 0×80; // Configure analog inputs and Vref
cnt = 0;
lr= 1;
hr = 1;
st = 50;
key = 0;
clr = st – lr;
chr = st + hr;
while(1)
{
if (Button( & PORTB, 0, 100, 0))
// port, pin #, time (ms), ative state (0 or 1)
{
key ++;
if (key < =4)key = 0;
}
keyid();
scanled();
}
}
void keyid (void)
{
switch (key)
{
case 0 :
cnt=ADC_Read(2);
converter(cnt*5);
cont1();
break;
case 1 :
highrang();
PORTC & = 0xef;
break;
case 2 :
lowrang();
PORTC & = 0xef;
break;
case 3 :
setvalue();
PORTC &= 0xef;
break;
}
}
void cont1 (void)
{
cnt = cnt/2;
if(cnt < clr ){PORTB = 0xbf; PORTC = 0xfd;} else { if( cnt > chr){ PORTB = 0x7f; PORTC = 0xfe; }
else {PORTB = 0xdf; PORTC = 0xfc;}
}
}
void highrang (void)
{
if(hr >10) hr = 1;
hr = valueed (hr);
converter(hr);
led[0] = 1;
led[1] = 12;
chr = st + hr;
}
void lowrang (void)
{
if(lr > 10) lr = 1;
lr = valueed (lr);
converter(lr);
led[0] = 2;
led[1] = 11;
clr = st – lr;
}
void setvalue (void)
{
if(hr > 99) st = 10;
st = valueed (st);
converter(st);
led[0] = 3;
led[1] = 10;
}
unsigned int valueed (unsigned int a)
{
if (Button(&PORTB, 1, 100, 0)) a++;
if (Button(&PORTB, 2, 100, 0)) a–;
if(a<=1)a=1; return (a); }
void converter(unsigned int z) {
led[0] = z/1000;
rem = z%1000 ;
led[1] = rem/100;
rem = rem%100 ;
led[2] = rem/10;
led[3] = rem%10; }
void scanled(void) {
unsigned char i;
for(i=0;i<4;i++) {
portd = i << 4;
portd |= led[i];
delay_ms(10); } }
automatic control of the blast furnace process by means of microcontroller PIC16f877,Atmosphere Furnace Controller/Programmer,HIGH LIMIT CONTROL PROVIDES AUTOMATIC FURNACE CHAMBER TEMPERATURE CONTROL THAT ASSURES MAXIMUM MELTING PERFORMANCE AND EFFICIENCY WITH EXTENDED REFRACTORY,Automatic furnace control selects recipe and heat-time. ♦ Optimized heat-time saves seconds per load. Fully automatic drying machine, automatic control ,Automatic Control System for the High stability,automatic temperature control,Experiences Implementing the Smart Furnace Control ,PLC continues to control the automatic sequencing of the equipment ,
Digital Thermometer LM35 Seven segment display
In this project we will learn to develop a digital thermometer using microcontroller PIC16f877, Lm35, and seven segment display.
unsigned int cnt ,brk;
char led [3];
unsigned int rem ;
void converter (unsigned int z);
void scanled (void);
void main() {
OPTION_REG = 0×80; // pull up resistors
//PORTA = 0; // clear porta (make sure both displays are off)
TRISA = 255; // designate porta pins as output
PORTD = 0; // clear portb (make sure LEDs are off)
TRISD = 0; // designate portb pins as input
ADCON1 = 0×80;//ADCON2 = 0×80; // Configure analog inputs and Vref
while(1)
{
cnt=ADC_Read(2);
cnt=cnt*5;
converter(cnt);
scanled();
}
}
void converter(unsigned int z)
{
led[0] = z/1000;
rem = z%1000 ;
led[1] = rem/100;
rem = rem%100 ;
led[2] = rem/10;
led[3] = rem%10;
}
void scanled(void)
{
unsigned char i;
for(i=0;i < 4;i++) { portd = i & 4;
portd |= led[i];
delay_ms(10);
}
}
Tags:-PIC 16F877, 18F452 and 18F4550,PIC16F877, PIC18F452,PIC18F4550,16f876,16f84,microcontroller projects,lm35,lm34,lm335,temperature sensor,MikroC Projects,Digital Thermometer LM35 Seven segment display, lm35, seven segment display,pic16f877,digital thermometer,
