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.

[SOLVED] HI-TECH LM35 On PIC16F877A TQFP HELP

Status
Not open for further replies.
At 100C the adc will get 1000mV. ADC output(adc_data) will be 1000/2.441 = 410 (rounded). Now in your code You have to convert it , like, 410*2.441=1000.8.
Now remove decimal part, divide by 10 and you will get 100C.

---------- Post added at 00:53 ---------- Previous post was at 00:52 ----------

Hints, temp = ((long)adc_value*2441)/100;
 
adc_data = ADRESH & 0x00FF;
adc_data = adc_data<<8;
adc_data = adc_data | ADRESL;

i got confused on this part, why do you have to "and" ADRESH with 0x00FF and then move it 8 bits to the left and then "or" it with ADRESL? what kind of adc_data does the pic converted the input to? for example, if i inputted 100 degree celsius, what is the adc_data? can you please explain this part of the code, an example will be great =) thank you so much! ^_^
 

thank you so much! now i get it...i was really confused with the "& 0x00FF" <--- but since its not necessary i understand now! =) thank you again XD

---------- Post added at 21:32 ---------- Previous post was at 21:06 ----------

by the way, what are the things to consider in choosing the clock conversion? most examples i saw, they used Fosc/64...some uses Fosc/2...
 
There is a fact to mention about the resolution of the A/D converter. Since the converter converts the signals, it takes a certain time. The conversion time of the low resolution A/D takes less time than the conversion time of the high resolution A/D. You have to consider carefully : if you select an analog to digital converter with high resolution – system will not be as fast; but if you select an analog to digital converter with high-speed response – you will loose the resolution of the system.


Acquisition Time: When an specific channel is selected the voltage from that input channel is stored in an internal holding capacitor. It takes some time for the capacitor to get fully charged and become equal to the applied voltage. This time is called acquisition time. According to datasheet 16F87XA family: The minimum acquisition time is 19.75micro second. (depends upon many things. See datasheet).Once acquisition time is over the input channel is disconnected from the source and the conversion begins.

ADC Clock: ADC Requires a clock source to do its conversion, this is called ADC Clock. The time period of the ADC Clock is called TAD. It is also the time required to generate 1 bit of conversion.

The ADC requires 12 TAD [16F87XA datasheet] to do a 10 bit conversion. It can be derived from the CPU clock (called TOSC) by dividing it by a suitable division.The source of the A/D conversion clock is software selected as a multiple of the clock frequency TOSC.For correct A/D conversions, the A/D conversion clock (TAD) must be selected to ensure a minimum TAD time of 1.6 micro second(according to datasheet).

Possible options for a Crystal are:
• 2 TOSC
• 4 TOSC
• 8 TOSC
• 16 TOSC
• 32 TOSC
• 64 TOSC

Examples:-
A 10MHz crystal is attached to a pic16F877A.

Our FOSC = 10MHz. Therefore our TOSC = 1/10MHz =100nS

16 TOSC = 16 x 100 nS = 1600nS = 1.6uS

which is same as the the minimum requirement.
 
thank you so much! ^__^ i learned a lot here =)
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top