Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

lookuptable help

Status
Not open for further replies.
Right.... I'll try to be clearer... lets say you need to read a temerature 0° to 100°C if you look at the Pic's ADC the total resolution is 0 to 1023... So in a perfect world you would get precision to 0.1°C... Now put that into practice, the sensor may only output 1v to 2.5v where 1v = 0°C and 2.5v = 100°C (lets assume a linear output)

1.5v span. SO using a 5 volt referenced ADC you get 1.5v * 1023 / 5v = 307...... Using a resolution of 306 we only get a temperature precision of 0.3°C which may not be enough... Also the reading will be VERY unstable moving from 0.0°C to 0.6°C erratically..... To steady the reading we over-sample... ( Interpolation is the term for sampling a frequency enough times to re-create or process a moving signal..ie... sound waves ) With a mainly steady input voltage we need to read many times to obtain a more true / average sample.

As explained in the above, the voltage produced by sensors are noisy to some extent.. If you over sample by a factor of 4 you achieve a "sort of" 12bit result.... 1.5v * 4092 / 5v = 1227. Now we have 1227 bits to represent the temperature... We can do 0.1°C quite comfortably and as there are more readings the value is a little more stable.

If you go even further... You can watch the noise on a scope... Calculate the average high's and low's of the signal and work out the best sampling times..

The other option is to reduce the ADC span by using the Vref+ / - ... Moving the ADC's span to fit the signals voltage window... But! its still worth over-sampling to smooth the value ready for displaying.
 
how to output a string on the serial port in pic16f1937,i mean how to initialise the euart in pic16f1937.iam using MPLAB X IDE and HiTech C complier.here is my program.why is it not working.i just want to send some string to serial port and get the result.for serial interface i am using tera-term .
#include <htc.h>

__CONFIG(0x2F84);
__CONFIG(0x1EFF);


void main()
{
//Initialize the USART
USARTInit();
Delay_ms(100);

USARTWriteLine("USART Demo");
while(1)
{
if (UART1_Data_Ready())
{

char data;

data=USARTReadByte();
}
}
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top