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.

LCD display value no response??

Status
Not open for further replies.
Well I i had to work so that means I had to start sleeping more LOL . You are using newer Hi-tech then me so I upgraded mine.
I 'll post you some thing tonight as when

Your configure was wrong I think you new that but you use isis it uses it's own configure. They changed a lot with hi-hech v9-65. The code I posted just needs the function fixed that returns the adc value.
 
Well I i had to work so that means I had to start sleeping more LOL . You are using newer Hi-tech then me so I upgraded mine.
I 'll post you some thing tonight as when

Your configure was wrong I think you new that but you use isis it uses it's own configure. They changed a lot with hi-hech v9-65. The code I posted just needs the function fixed that returns the adc value.

how is the code going??if my code change become as shown below....but my calculation was wrong...i cant get the reading display as the thermocouple temperature....
for example...
thermocouple show 100 C but the display cant show exact 100 C.....
how i going to calculate it??

#include <htc.h>
#include <math.h>

#include "lcd.h"
__CONFIG(1, FCMDIS & IESODIS & XT);
__CONFIG(2, BORDIS & BORV45 & PWRTEN & WDTDIS & WDTPS1);
__CONFIG(3, CCP2RB3 & LPT1DIS & MCLRDIS & 0xFDFF);
__CONFIG(4, DEBUGDIS & XINSTDIS & LVPDIS & STVRDIS);

//Simple Delay Routine
void Wait(unsigned int delay)
{
for(;delay;delay--)
__delay_us(100);
}
void ADCInit(void){
ADCON0=0b00000001; // select Fosc/2
ADCON1=0b00001110; // select left justify result. A/D port configuration 0
ADCON2=0b00001010;
}
unsigned char read_adc(unsigned char ){
ADON = 1; // initiate conversion on the selected channel
GODONE=1 ;//Start conversion
while(GODONE= 1)continue;
return(ADRESH); // return 8 MSB of the result
}
void main()
{
//Let the LCD Module start up
Wait(100);

//Initialize the LCD Module
LCDInit(LS_BLINK);

//Initialize the ADC Module
ADCInit();

//Clear the Module
LCDClear();

//Write a string at current cursor pos
LCDWriteString("Temperature:");
LCDWriteStringXY(5,1,"Degree C");


while(1)
{
unsigned int val;
unsigned int t; //Temperature

val=read_adc(); //Read Channel 0

t=round(((val*4750)/1023)/10);

LCDWriteIntXY(0,1,t,3);//Prit IT!


Wait(1000);

}
}
 
haowhaow your using isis you need to change t=round(((val*4750)/1023)/10);
to this t=round(((val*5000)/1023)/10);

In real life Vdd may not be 5 volts but with ISIS it's 5 volts
 
Last edited:
haowhaow your using isis you need to change t=round(((val*4750)/1023)/10);
to this t=round(((val*5000)/1023)/10);

In real life Vdd may not be 5 volts but with ISIS it's 5 volts

ohh.....but cant get the reading also...can u help me figure out??
 
What are you getting

100 C i js get 1 C
107 C only get 2 C
115 C only get 3 C......

u got my file there right???can u help me try and c??
btw when i build my project(F10)....is failed..but if rebuild again then will successful d....
is that mean anything???
 
I just have the demo of ISIS that plugs in MPLAB it will not let you change parts
 
I tested it on hardware LCD pic 18f452 I didn't have a 4520 and i used the lm35 it 10mv per1C
 
You should be getting the right value to display it works right on real hardware
 
You should be getting the right value to display it works right on real hardware
in read device..my lcd display is blank only....may i know why?? im using hitech compiler...can i use pickit2 to load my hex file??
after i had imported my hex file...it come out a warning sign state as " some configuratiomn words not in hex file. ensure default values above right are acceptable"
 

Attachments

  • untitled.JPG
    untitled.JPG
    95.4 KB · Views: 146
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top