Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronic 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.

Register Log in

[SOLVED] how to further improvise my current program(Volt Meter) to become a thermal sensor

Status
Not open for further replies.

InNeedOfHelp

Full Member level 3
Joined
Dec 5, 2012
Messages
169
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,298
Activity points
2,205
Hi guys , I managed to display the voltage of my board using C18 compiler. any ideas how i can use these current code to build a thermal sensor out of it ?
 

Attachments


Tahmid

Advanced Member level 5
Joined
Jun 17, 2008
Messages
4,758
Helped
1,791
Reputation
3,574
Reaction score
1,650
Trophy points
1,393
Location
Silicon Valley, California, USA (from Dhaka, Bangl
Activity points
30,545
Use a sensor chip that outputs a voltage that represents the temperature, so that the output voltage to the PIC changes with temperature. Adjust the voltmeter code to read the sensor. Eg. If you use LM35, the output is 10mV per degree Celsius. So, if you have 74'C, the output is 0.74V. Adjust your code so that when the input is 0.74V, the voltmeter display 74 ('C) instead of displaying 0.74 (V).

Hope this helps.
Tahmid.
 

waseem309

Newbie level 3
Joined
Jan 12, 2013
Messages
3
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,332
hello ,can i have the drawing of the VOLTEMETER proteus design please ??

- - - Updated - - -

hello , this code is for voltmeter using pic18f4550, iam facinf a problem in displaying values on LCD /// can anyone help??

=====================================================
#include <p18F4550.h>
#define lcdport PORTB
#define rs PORTAbits.RA0
#define rw PORTAbits.RA1
#define en PORTAbits.RA2


void lcd_ini() ;
void lcdcmd(unsigned char) ;
void lcddata(unsigned char);
void adc_con(unsigned int) ;
void adc_init();
void DELAY(int time);

unsigned char data[20]="ADC OUTPUT=";
unsigned int digital_out[10],avg_output=0,temp;
unsigned int i=0;
void main()
{
TRISCbits.TRISC0=0;
TRISA=0; // Configure RA0 as input pin
PORTA=0;
TRISB=0;
PORTB=0; // Configure Port B as output port


lcdcmd(0x38); // Configure the LCD in 8-bit mode, 2 line and 5x7 font
lcdcmd(0x0E); // Display On and Cursor Off
lcdcmd(0x01); // Clear display screen
lcdcmd(0x06); // Increment cursor
lcdcmd(0x86); // Set cursor position to 1st line, 1st column
lcddata('w');

while(data!='\0')
{
lcdport=*data; // Call lcddata function to send character one by from 'data' array
i++;
}

ADCON1=0xCE; // Make RA0/AN0 pin as analog pin (Other pins remain to be digital I/O)
ADCON0=0x81; // Select Channel0 & ADC off
ADCON2=0x8A; // Left justified, 2TAD acquiciation time, Fosc/32 clock option
ADCON0bits.GO=1; // Enable ADC

while(1)
{
temp=0;
for(i=0;i<10;i++)
{
ADCON0bits.GO=1; // Start A/D conversion
while(ADCON0bits.DONE=1); // Wait until conversion gets over
digital_out=((ADRESL)|(ADRESH<<8)); // Store 10-bit output into a 16-bit variable
DELAY (20);
temp=temp+digital_out;
}
avg_output=temp/10; // Take average of ten digital values for stablity
adc_con(avg_output); // Function to convert the decimal vaule to its corresponding ASCII
}
}




void adc_con(unsigned int adc_out)
{
unsigned int adc_out1;
int i=0;
char position=0xC3;
for(i=0;i<=3;i++)
{
adc_out1=adc_out%10; // To exract the unit position digit
adc_out=adc_out/10;
lcdcmd(position);
lcddata(48+adc_out1); // Convert into its corresponding ASCII
position--;
}
}


void lcdcmd(unsigned char cmdout)
{
lcdport=cmdout; //Send command to lcdport=PORTB
rs=0;
rw=0;
en=1;
DELAY(50);
en=0;
}


void lcddata(unsigned char dataout)
{
lcdport=dataout; //Send data to lcdport=PORTB
rs=1;
rw=0;
en=1;
DELAY(50);
en=0;
}

void DELAY(int time)
{
int k=0,j=0,r=0,a=0;
for (k;k<time;k++)
for (j;j<25;j++)
for (a;a<25;a++)
for (r;r<25;r++);
}

==========================================================================
صص.jpg
 

Status
Not open for further replies.
Toggle Sidebar

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top