KS0108 128×64 glcd termometre ccs c pic16f88 lm35

| Mayıs 29, 2023 Tarihinde güncellendi
KS0108 128×64 glcd termometre ccs c pic16f88 lm35

Termo metre devresi pic16f88 üzerine kurulu 2 adet lm35 ısı sensörü ile sıcaklık bilgisini kc0108 128×64 grafik lcd üzerinde görüntülüyor. LCD termometre PIC16F88, iki LM35 sensör ve KS0108 grafik LCD ile çok basit termometre.

PCBway Türkiye PCB Manufacturer PCB Assembly

Kod, CCS C derleyicisi için yazılmıştır. Ayrıca Proteus VSM simülasyon dosyası ve derlenmiş hex dosyası da bulunmaktadır.

LCD thermometer Very simple thermometer with PIC16F88, two LM35 sensors and KS0108 graphic LCD. Here’s video where I’m heating sensors with soldering iron. Screenshot from Proteus VSM. Note that almost every pin of PIC16F88 is used. Here’s the source code, I’m sorry it isn’t commented very well. The code is written for CCS C compiler. There’s also Proteus VSM simulation file and compiled hex file.

KS0108 pic16f88 lm35 devre şeması

ks0108-ccs-c-pic16f88-lm35

Grafik lcd termometre çalışma görüntüleri

main.c ccs c yazılım içeriği


#include <16F88.h>
#fuses INTRC_IO,NOWDT,NOPUT,NOMCLR,BROWNOUT,NOLVP,NOCPD,NOWRT,NODEBUG,NOPROTECT,CCPB3
#use delay (clock=8000000)
#byte PORTA = 0x0005
#byte PORTB = 0x0006 
#byte TRISA = 0x0085 
#byte TRISB = 0x0086
#byte ANSEL = 0x009B
#byte ADCON0 = 0x001F
#byte ADCON1 = 0x009F
#byte ADRESH = 0x001E
#byte ADRESL = 0x009E
#bit ADON = ADCON0.0
#bit GO_DONE = ADCON0.2

#define ON  1
#define OFF 0

#include "KS0108.c"
#include "graphics.c"
#include 

float get_temperature(int1 channel);

void main() 
{
	float temp;
	int8 length, str[5]={};
	
	TRISA=0b00000011;	//set RA0 and RA1 to input
	ANSEL=0b00000011;	//set RA0 and RA1 to analog
	ADCON1=0b11000000;	//setup adc
	
	glcd_init(on);
	glcd_fill(OFF);
	
	draw_background();
	glcd_char(0, 26, 11, 1);	
	glcd_char(0, 32, 12, 1);

	while(true)
	{
		temp=get_temperature(0); //get adc value from ADC channel 0 and convert it to temperature

		sprintf(str,"%4.1f",temp);	//convert float value to string
		glcd_string(0,4,str,1);		//and draw it on the screen

		length=(int8)((temp*2))+24;	//then draw some graphics
		if(length>124) length=124;
		if(length<24) length=24;
		glcd_rect(24, 6, length, 19, 1, 1);
		glcd_rect(length+1, 6, 125, 19, 1, 0);


		temp=get_temperature(1);	//same things to channel 1

		sprintf(str,"%4.1f",temp);
		glcd_string(0,40,str,1);

		length=(int8)((temp*2))+24;
		if(length>124) length=124;
		if(length<24) length=24;
		glcd_rect(24, 44, length, 57, 1, 1);
		glcd_rect(length+1, 44, 125, 57, 1, 0);
	}
}

float get_temperature(int1 channel)
{
	int16 value, sum1, sum2;
	int8 i, j;

	if(channel==0)
		ADCON0=0b01000000;	//select adc channel 0
	else
		ADCON0=0b01001000;	//select adc channel 1

	ADON=true;
	delay_us(100);

	sum2=0;
	for(j=0; j<8; j++)
	{
		sum1=0;
		for(i=0; i<8; i++)
		{
			GO_DONE=true;
			while(GO_DONE);
		
			value=make16(adresh,adresl);
		
			sum1+=value;
			delay_us(100);
		}
		sum1/=8;

		sum2+=sum1;
	}
	sum2/=8;
		
	ADON=false;

	return (float)sum2/2;
}

ks0108-128x64-glcd-termometre-ccs-c-pic16f88-lm35

Şifre-Pass: 320volt.com

Yayım tarihi: 2009/11/21 Etiketler: , , , , , , ,



1 Yorum “KS0108 128×64 glcd termometre ccs c pic16f88 lm35

  1. ErdemErdem

    Merhaba hocam devre çok güzel görünüyor fakat lm35 sensörünün ds18b20 kadar hassas olmadığını duymuştum bu devreyi ds18b20 ile çalışacak şekilde tasarlayabilirmisiniz

    CEVAPLA

Bir yanıt yazın

E-posta adresiniz yayınlanmayacak. Gerekli alanlar * ile işaretlenmişlerdir