Programming in C Using the A D converter module

This blog post describes the ADC part of PIC16F877 microcontroller and addresses the least CCS C inbuild function required to activate the ADC, to read the analog signal and display the converted digital signal on a LCD. This tutorial uses Proteus, MPLAB and CCS C compiler.

A PIC microcontroller has Analog to Digital converter or ADC module build inside in it. The function of this part is to convert the external circuitry analog signal into n=8, 10.. bits digital signal. For example PIC16F877 is a 10 bit converter while PIC16F73 is an 8 bit converter. The number of levels of quantization is n to the power of 2. For n=8 the level is 2^8=256 levels and for n=10 its 2^10=1024 levels. The voltage resolution is then Vref/L, where Vref is voltage reference and L is the level. If Vref=5V and L=256 then voltage resolution is 5V/256=0.0195V.

The functioning of ADC module inside the PIC16F877 microcontroller is shown below-

Setting up ADC and reading values using C-language

The process of reading analog and using the ADC module to convert to 8bit digital value requires to set up the ADC device properly. Few of the things that must be specified are the clock source for the ADC, port settings and which port will be used to read the analog signal. The C functions to do these are pointed out below-
  • Specify the ADC clock for sampling( setup_adc(ADC_CLOCK_INTERNAL)
  • Set up the ports type(setup_adc_ports(ALL_ANALOG)
  • Specify which port is used(setup_adc_channel(0))
 Once the A/D port is configured properly the analog signals can be read. The command to read the value is read_adc( ). This value can be strored as an integer as follows-
  • x = read_adc( )
Then the value x(digital value) can be manipulated and displayed onto the screen.

This value x is stored in the ADRESH and ADRESL registers which are 8 bit registers. The value x can be arranged into these two register from left and right. This selection is controlled by the bits value in the ADFM register.

The following code illustrates reading reading analog signal and displaying it on a LCD.

#include "16F877.h"
#device ADC=8
#use delay(clock=4M)
#use rs232(baud=9600, xmit=PIN_D0, rcv=PIN_D1)

void main()                      
    {
        int x;
        setup_adc(ADC_CLOCK_INTERNAL);
        setup_adc_ports(ALL_ANALOG);
        set_adc_channel(0);

        for(;;)
    {
            delay_ms(500);
            x = read_adc();
            x = (x/32)+0x30;

            putc(254);
            putc(1);
            delay_ms(10);
            printf("Level=");
            putc(x);
    }

}

The Proteus Simulation circuit is below-


 Scroll down and up the variable resistor and the corresponding level is displayed in the LCD display.

See How to write C-program to display character on LCD interactively tutorial and other microcontroller tutorials with proteus.

Read More..

4Videosoft Video Converter Platinum 5 2 8 Final Download Free

pc-softwarepk.blogspot.com







4Videosoft Video Converter







Mdzavri multimedia package of video and audio files to work with, which includes utilities such as 4Videosoft DVD Copy, 4Videosoft DVD Creator, 4Videosoft DVD Ripper Platinum, 4Videosoft iPhone Transfer Platinum and 4Videosoft Video Converter Platinum. The program can shemknat ringtone for iPhone-, iPod-files in the message. Graberi DVD - AVI, MP4, MPEG, WMV, 3GP, HD and other format. Converter MPEG, MP4, H264, SWF, FLV, VOB, MOD, M4V, AVI, WMV, 3GP, 3GPP, DivX, XviD, MOV, DV, MPV, MTS, M2TS, TS, HD and other format. Remove video from audio MP3, MP2, AAC, AC3, WAV, WMA, M4A, RAM, OGG, AU, AIF, AIFF, APE, FLAC, NUT formats. Transfer files to your computer and iPod, iPhone 4G-between. Synchronize iPad, iPod, iPhone and other mobile phones. Create and edit playlists. Knife and join files. JPEG, GIF, BMP screenshots creation. The settings configuration. Burst mode conversion. Preliminary review of the integrated pleirebs. High speed and quality. Nice design, easy to use and understand interface.



Year: 2014 Program Version: 5.2.8 Final OS: Windows XP | Vista | 7 | 8 & 8.1 Interface Language: ML / Russian (RUS) Activation: Present File Size: 30.88 Mb






download1 Assassins Creed Directors Cut Edition PC Game

4Videosoft Video Converter Platinum 5.2.8 Download

Extraction Password =pc-softwarepk.blogspot.com
Direct Download Link

4Videosoft Video Converter Platinum 5.2.8 Final

30.88MB
Read More..

Freemake Audio Converter v1 1 0 49 Portable


Convert audio free to MP3, WMA, WAV, FLAC, AAC, M4A, OGG, convert audio to MP3 player, iPod, iPhone, iPad, PSP, extract audio from video, join audio files.

Convert audio to MP3, M4A, WMA, WAV, AAC
Convert audio between all key audio formats: MP3, WMA, WAV, FLAC, AAC, M4A, OGG. Convert WMA to MP3, WAV to MP3, MP3 to WAV, FLAC to MP3, AAC to MP3, etc. List of supported formats
   
Free MP3 Converter
Use Freemake as Free MP3 Converter: convert audio to MP3 format for MP3 playes: iPod, Zune, Coby, SanDisc Sansa, iRiver, Walkman, Archos, GoGear, etc.
Convert audio to iPod, iPhone, iPad
Convert audio to M4A format for Apple devices. Get smaller than MP3 audio files for playback on iPod, iPhone, iPad or in iTunes.

MP3 to iTunes
Send MP3 and AAC files directly to iTunes from our audio converter

Join audio files
Merge multiple audio files into one with Free Audio Converter from Freemake.

Extract audio from video
Export audio tracks from video files: DVD, H.264, AVI, MPEG, MP4, MKV, DIVX, MOV, WMV, VOB, 3GP, RM, QT, FLV, etc. List of supported formats

This is Free Audio Converter
Freemake Audio Converter is designed without any limitations, hidden costs, sneakware or adware!

Soon! Rip Audio CD
Rip Audio CD dics with our Free Audio Converter. Convert CDA files to MP3.

Soon! Burn Audio CD and MP3 discs
Create Audio CD and MP3 discs using our Free Audio Converter.

Microsoft .NET Framework v4 Required To Run The Program

Size: 17.9 MB

Made By Spoon Studio

Download from Mirrorcreator.com
Read More..

Blog Archive

Powered by Blogger.