Continue to Site

### Welcome to EDAboard.com

#### Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Status
Not open for further replies.

#### gopintj

##### Member level 4
Hello friends,..!!!!

I am very new to Microcontrollers. As i am a Final Year Electronics student, I would like to build ADC as my mini project.

I hav searched lots of webpage and i found nothing helpful.

Code:
#include<pic.h>
#include"delay.c"
#include"lcd_driver.c"
__CONFIG(0x1932);
void main()
{

unsigned char result=0;
setup_lcd_port();
lcd_init();
while(1)
{
result=0;
DelayUs(20);
lcd_goto_pos(1);
lcd_putn(result);
DelayUs(20);
}
}
{
TRISA=0x01;
TRISC4=0;
DelayUs(20);
}
{
DelayUs(20);
}
{
DelayUs(10);
{

continue;

}

}

I am using 16f877a and High Tech C compiler.

Last edited by a moderator:

#### bigdogguru

These are the best PIC tutorials I have come across online:

The cover both the baseline and midrange PICs using both MPASM Assembler and Hi-Tech C.

Your 16F877A is a midrange PIC and tutorial 8 in the second link above covers Analog to Digital Conversion.

#### gopintj

##### Member level 4

I think, Analog Input in Channel 0 of 16f877a is not suitable for A/D conversions.

I then, tried in channel 1 and i got the output successfully..

The doubt that i hav now is, Which one is the best compiler,.. i mean, I have known about High tech c compiler and i m working on it till now.

But, some says that, CCS compiler is better than High Tech C compiler...!!!!!

Could you tell me which of the above is best one to create codes...???

#### engshahrul

##### Banned
The doubt that i hav now is, Which one is the best compiler,.. i mean, I have known about High tech c compiler and i m working on it till now.

But, some says that, CCS compiler is better than High Tech C compiler...!!!!!
I'm using Hi-Tech compiler. I like to use Hi-Tech. I also heard about CCS Compiler and Micro C, but I don't give a try yet.

From my view, I see the CCS Compiler and Micro C have many ready made function that user can use, while Hi-Tech don't have many function. I'm using Hi-Tech with all my own function but this is good to get more understanding what's going on.

The Hi-Tech is cheaper but CCS I heard need to pay some yearly, maybe for the function updates.

#### gopintj

##### Member level 4
Oh..

I here after going to use High Tech C compiler to improve my knowledge as like you ppl..

Thank u very much once again..

dont use the forum as your mobile and spoil the quality of it...

spend some time to type the complete words when you ask for help...

this is the last warning to you ,

Last edited by a moderator:

#### Zwilorg

##### Member level 5
You have alot of compilers available to use.

Some will need payment thought.

Arduino - easiest (huge number of libraries. They go as far as having libraries for specific IC, like max6674 or max6675.

CCS and Mikro - they have a decent community helping them and they also have a very good number of libraries to compare and create more complex codes

Hi-Tech - (the one i use) has loads of ppl using it but the number of libraries built for it are very small comparing with the others... but when you get something working on it you get double pleased. You need to check datasheets, etc... etc... i think that by working with this compiler you learn more of C than working on the others

#### sebgar

##### Newbie level 4
These tutorials are great! Thanks for the links, I'm new to pics, I've been looking for something like this for a while.

#### ravimd

##### Newbie level 4
I was not able to find out that tutorial for free. Can any one help ?

wire042

### wire042

Points: 2

#### wire042

##### Newbie
Hi Tahmid

this is great work.
How can it be read with an LCD, to display the value maybe the RMS value like a range of 100V--300V

##### Banned
What do you mean by read with LCD. The value you get from adc is converted to string and then passed to lcd display function which displays the adc data on LCD.

#### wire042

##### Newbie
What I mean is this how do I measure an RMS with range of 100v-300v and above to display it on an LCD. This is my question

##### Banned
Vrms = V/sqrt(2)

If you are measuring a scaled down dc value proportional to some AC value then you calculation will be

like this.

If your adc input is 5V DC and your AC for 5V DC is equal to 300 V AC then

5V DC = 1023 raw adc value

1023 * x = 5
x = 5/1023 = 0.0048875855327468

If raw ad c value 765 then 765 * 0.0048875855327468 = 3.73900293255132 V

5V Dc = 300V AC

5 * y = 300

y = 300/5 = 60

So, 3.739 * 60 = 224.34 V AC

Try this method and see if it works. In AC the rms value will be equal to 70% of the peak value

Vrms = V/sqrt(2) = 224.34/1.41421 = 155.5648

Eg: 165 V AC = 115 V AC RMS

If you get 230 V AC RMS then actual AC is 325.266 V

#### wire042

##### Newbie
Ok I think I got it but I have to try it and see the result. thanks a million Jayanth.devarayanadurga

- - - Updated - - -

Ok I think I got it but I have to try it and see the result. thanks a million Jayanth.

#### sinorbee

##### Newbie level 6
hello guys i am doing a ph meter project using pic 16877a, i have no idea about the coding can anyone help me please.......

thank you

Status
Not open for further replies.