Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Forums > General Electronics Chat


General Electronics Chat This forum is for general chat about electronics, eg: Dont know what a part does? Dont know how to read a circuit? Want to get an opinion?

Reply
 
Tools
Old 6th June 2008, 03:27 PM   #1
Default how can i read NTC?

Hi,

in my project i use MikroC as compiler, PIC16F877A. i connected a NTC to AN0 of this microcontroller. my problem is, i don't know how can i work with NTC.
i worked with LM32 and i know readding temperature, but i don't know how can i read NTC output.

in ISIS i connect one pin of NTC to VCC and second pin to micro. but on LCD i have 5v for all temperatures.

my code is:
Code:
unsigned char ch;
unsigned int adc_rd;
char *text;
long tlong;

void main() {
  INTCON = 0;                              // disable all interrupts
  Lcd_Init(&portd);                        // Dataport=PortD, En=d.3, Rs=d.2
  LCD_Cmd(LCD_CURSOR_OFF);                 // send command to LCD (cursor off)
  LCD_Cmd(LCD_CLEAR);                      // send command to LCD (clear LCD)

  ADCON1     = 0x82;                       // configure VDD as Vref, and analog channels
  TRISA      = 0xFF;                       // designate PORTA as input
  Delay_ms(2000);
  text = "Temp: ";
  
  while (1) {
    adc_rd  = ADC_read(0);                 // get ADC value from 2nd channel


    LCD_Out(2,1,text);                     // print string a on LCD, 2nd row, 1st column

    tlong = (long)adc_rd * 5000;           // covert adc reading to milivolts
    tlong = tlong / 1023;                  // 0..1023 -> 0-5000mV

    ch     = tlong / 1000;                 // extract volts digit
    LCD_Chr(2,9,48+ch);                    // write ASCII digit at 2nd row, 9th column
    LCD_Chr_CP('.');

    ch    = (tlong / 100) % 10;            // extract 0.1 volts digit
    LCD_Chr_CP(48+ch);                     // write ASCII digit at cursor point

    ch    = (tlong / 10) % 10;             // extract 0.01 volts digit
    LCD_Chr_CP(48+ch);                     // write ASCII digit at cursor point

    ch    = tlong % 10;                    // extract 0.001 volts digit
    LCD_Chr_CP(48+ch);                     // write ASCII digit at cursor point
    LCD_Chr_CP('V');

    Delay_ms(1);
  }
}//~!
Hesam Kamalan is offline  
Old 6th June 2008, 03:36 PM   #2
Default

Quote:
Originally Posted by Hesam Kamalan View Post
Hi,

in my project i use MikroC as compiler, PIC16F877A. i connected a NTC to AN0 of this microcontroller. my problem is, i don't know how can i work with NTC.
i worked with LM32 and i know readding temperature, but i don't know how can i read NTC output.

in ISIS i connect one pin of NTC to VCC and second pin to micro. but on LCD i have 5v for all temperatures.
An NTC is a Negative Temperature Coefficient Resistor so of course it will not give you a reading, as an LM3x will. You need to put it into a voltage divider cct, with a resistor of known value. The resistance of the NTC will increase as the temperature decreases. Here, read all about it:
Thermistor - Wikipedia, the free encyclopedia
BeeBop is offline  
Old 6th June 2008, 04:10 PM   #3
Default

Thanks BeeBop,

i understand that how NTC works.

but what circuit diagram can you suggest me?
Hesam Kamalan is offline  
Old 6th June 2008, 09:43 PM   #4
Default

i want to use bridge for measurmenting temperature. but i don't know what is value of Ra, Rb, Rc , Rs.
if you know guide me please. i want to measure temperature from 35 up to 80.
Hesam Kamalan is offline  
Reply

Tags
ntc, read

Thread Tools
Display Modes


Similar
Title Starter Forum Replies Latest
How To Read This codan General Electronics Chat 24 26th April 2008 05:58 PM
How to read from the ADC port? Lac Micro Controllers 6 11th August 2006 08:59 PM
Need for Help in vb.net..... please read cena Micro Controllers 9 14th April 2006 10:32 AM
PLEASE READ sia Electronic Projects Design/Ideas/Reviews 14 14th October 2005 10:46 AM
How to read Capacitors SeanHatch General Electronics Chat 4 2nd January 2003 06:22 AM



All times are GMT. The time now is 02:32 AM.


Electronic Circuits  |  Learning Electronics
eXTReMe Tracker