Interfacing psoc with thermocouple

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

 my basic aim is to interface thermocouple with psoc. I have accomplished the reference junction temp measuring using temp sensor which is working perfectly but regarding the measuring jn, i have used the INSAMP along with ADCINCVR and m trying to display the adc counts on lcd. The latter part is nt being implemented. Below is my source c file and the design file view is also attached:

   

 

   

#include <m8c.h>        // part specific constants and macros

   

#include "PSoCAPI.h"    // PSoC API definitions for all User Modules

   

void main(void)

   

{

   

   int a,b,c,d,e,f,i,g,h,sum,sum1,p,q;

   

   double display,reading;

   

   double volt,temp;

   

    

   

    M8C_EnableGInt;                     // Enable global interrupts  

   

    PGA_SetGain(PGA_G8_00);  

   

    PGA_Start(PGA_HIGHPOWER);

   

   

INSAMP_Start(INSAMP_HIGHPOWER); 

   

INSAMP_SetGain(INSAMP_G16_0);

   

 

   

ADCINCVR_Start(ADCINC_HIGHPOWER);         

   

   ADCINC_GetSamples(0);                    

   

   ADCINCVR_SetResolution(10);          

   

   

LCD_Init(); 

   

LCD_Start();                  // Initialize LCD  

   

     LCD_Position(0,2);            // Place LCD cursor at row 0, col 2.  

   

     LCD_PrCString("Temparature");         

   

     ADCINCVR_1_Start(ADCINCVR_HIGHPOWER); // Turn on Analog section  

   

     ADCINCVR_1_SetResolution(10);         // Set resolution to 10 Bits  

   

     ADCINCVR_1_GetSamples(0);             // Start ADC to read continuously  

   

         

   

for(;;)  

   

{  

   

sum=0;

   

       for(i=0;i<10;i++)

   

{               

   

while(ADCINCVR_fIsDataAvailable() == 0); // Wait for data to   

   

                                                 // be ready.  

   

        a = (ADCINCVR_iGetData()+512);    // Get Data  

   

        sum=sum+a;

   

ADCINCVR_ClearFlag(); 

   

}

   

display=sum/10;

   

f=display*(.033)+13.2325;

   

g=f/1000;

   

b=(f/100)%10;

   

c=(f/10)%10;

   

d=(f%100)%10;

   

e=sum%10;

   

LCD_Position(1,2);

   

LCD_PrHexByte(16*g+g);

   

 

   

LCD_Position(1,3);

   

LCD_PrHexByte(16*b+b);

   

LCD_Position(1,4);

   

LCD_PrHexByte(16*c+c);

   

LCD_Position(1,5);

   

LCD_PrHexByte(16*d+d);

   

LCD_Position(1,6);

   

LCD_PrCString(".");

   

LCD_PrHexByte(16*e+e);

   

LCD_Position(1,8);

   

LCD_PrCString("C ");

   

 

   

 

   

sum1=0;

   

       for(i=0;i<10;i++)

   

  {    

   

   

while(ADCINCVR_1_fIsDataAvailable() == 0); // Wait for data to   be ready.   

   

 

   

        p= (ADCINCVR_iGetData()+ 512 );    // Get Data  

   

        sum1=sum1+p;

   

ADCINCVR_1_ClearFlag();              

   

}

   

reading=sum1/10;

   

q=reading;

   

LCD_Position(0,2);

   

LCD_PrHexInt(q);

   

 }

   

}

   

 

   

 

   

 

   

0 Likes
1 Reply
Anonymous
Not applicable

Try application note AN2148.  That has all the code to implement a thermocouple measurement.

   

Best Regards

   

Ganesh

0 Likes