|
|
View previous topic :: View next topic |
Author |
Message |
oburak90
Joined: 19 Nov 2011 Posts: 10
|
ds18b20 glcd problem? Help! |
Posted: Sat Nov 19, 2011 3:07 pm |
|
|
I want see temperature on glcd, but I can't.
My problem is ds18b20 and glcd 128x64 ks0108.
I take the codes http://www.ccsinfo.com/forum/viewtopic.php?t=28425
When I use 16f877a and 2x16 lcd I can read temperature but I use 16f877a and 128x64 glcd I can't read it (I read 0.0).
I use same codes, only change is:
#include <lcd.c> >==> #include <hdm64gs12.c>
and #include <graphics.c>
printf(lcd_putc,"%s ", c_temp); >==> glcd_text57(1,1,c_temp,1,on);
I need help. Thanks.
Codes for 2x16 lcd:
Code: |
#include <16F877A.h>
#fuses xt,nowdt,noprotect,nobrownout,nolvp,noput,nowrt,nodebug,nocpd
#use delay(clock=4000000)
#include<lcd.c>
#include<1wire.c>
#include<ds1820.c>
void main()
{
float f_temp;
char c_temp[15];
setup_comparator(nc_nc_nc_nc);
setup_psp(psp_disabled);
setup_timer_1(t1_disabled);
setup_timer_2(t2_disabled,0,1);
setup_adc_ports(no_analogs);
setup_adc(adc_off);
setup_ccp1(ccp_off);
setup_ccp2(ccp_off);
lcd_init();
lcd_putc("\f");
while (1)
{
delay_ms(100);
f_temp = ds1820_read();
lcd_gotoxy(1,1);
sprintf(c_temp,"TEMP: %2.1f C",f_temp);
printf(lcd_putc,"%s ", c_temp);
}
}
|
and codes for 128x64 glcd;
Code: |
#include <16F877A.h>
#fuses xt,nowdt,noprotect,nobrownout,nolvp,noput,nowrt,nodebug,nocpd
#use delay(clock=4000000)
#include<HDM64GS12.c>
#include<graphics.c>
#include<1wire.c>
#include<ds1820.c>
void main()
{
float f_temp;
char c_temp[15];
setup_comparator(nc_nc_nc_nc);
setup_psp(psp_disabled);
setup_timer_1(t1_disabled);
setup_timer_2(t2_disabled,0,1);
setup_adc_ports(no_analogs);
setup_adc(adc_off);
setup_ccp1(ccp_off);
setup_ccp2(ccp_off);
glcd_init(on);
while (1)
{
delay_ms(100);
f_temp = ds1820_read();
sprintf(c_temp,"TEMP: %2.1f C",f_temp);
glcd_init(on);
glcd_text57(1,1,c_temp,1,on);
}
} |
_________________ Ömer Burak ÖZKESKİN |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9221 Location: Greensville,Ontario
|
|
Posted: Sat Nov 19, 2011 4:19 pm |
|
|
Since your program works fine with the 2x16 LCD the problem is either the graphics LCD or the driver.
Perhaps the pins chosen for the GLCD are not correct ?
I'd write a 'Hello World' program just to confirm the GLCD is OK.
I don't use GLCDs so I can't test that part of your code. The DS16B20 and 16F877 do work for me though. |
|
|
oburak90
Joined: 19 Nov 2011 Posts: 10
|
|
Posted: Sat Nov 19, 2011 5:15 pm |
|
|
I must use glcd. This codes for begin my project. My glcd's output "TEMP: 0.0 C" 2x16lcd works fine, but glcd don't work with ds18b20.
Code: |
f_temp = ds1820_read();
|
is not working with glcd.
I erase f_temp = ds1820_read(); and write f_temp=23.5
I see it on glcd =(
How I can? =) Tthanks your write temtronic. I think use 4x20 but I draw some graphic, it's too easy but not working. =( _________________ Ömer Burak ÖZKESKİN |
|
|
oburak90
Joined: 19 Nov 2011 Posts: 10
|
|
Posted: Sat Nov 19, 2011 5:16 pm |
|
|
my english is bad.. sorry for this =).. _________________ Ömer Burak ÖZKESKİN |
|
|
necati
Joined: 12 Sep 2003 Posts: 37 Location: istanbul
|
|
Posted: Sun Nov 20, 2011 12:39 am |
|
|
data = (float)isi ;
glcd_rect(57,24,110,40, YES,0); //arayi sil
sprintf(str,"%4.1f",data);
glcd_text57(60,25,str,2,1); |
|
|
necati
Joined: 12 Sep 2003 Posts: 37 Location: istanbul
|
|
Posted: Sun Nov 20, 2011 12:42 am |
|
|
data = (float)f_temp;
glcd_rect(57,24,110,40, YES,0); //arayi sil ** burasi 0 ise
sprintf(str,"%4.1f",data);
glcd_text57(60,25,str,2,1); //**burasi 1 olacak
//veya tersi
arayı silmez isen yazilar üst üste cikar
glcd_rect(57,24,110,40, YES,0); //siyah yaziyi sil yeşil yap
glcd_rect(57,24,110,40, YES,1); //siyah icindekiyaziyi sil siyah yap
glcd_text57(60,25,str,2,1); // yesil ustune siyah yaz
glcd_text57(60,25,str,2,0); // siyah icine yesil yaz
Last edited by necati on Sun Nov 20, 2011 1:50 am; edited 3 times in total |
|
|
oburak90
Joined: 19 Nov 2011 Posts: 10
|
|
Posted: Sun Nov 20, 2011 1:02 am |
|
|
float tipinde data diye bir değişken tanımladım,
str diye 15 elemanlı bir char dizisi tanımladım,
glcd_rect(57,24,110,40, YES,0); //arayi sil ==> yazımızı glcd den temizledik..
data=(float)f_temp; kodu ne işe yarıyor onu anlamadım..
Code: | while (1)
{
delay_ms(100);
f_temp = ds1820_read();
data=(float)f_temp;
glcd_rect(57,24,110,40,1,0); //arayi sil
sprintf(str,"%4.1f",data);
glcd_text57(60,25,str,2,1);
} |
diye birşey çıktı orataya ama buda 0.0 gösteriyor =(
birşeyleri eksik yada yanlışmı yapıyorum? şimdiden yardımın ve ilgin için teşekkür ederim. _________________ Ömer Burak ÖZKESKİN |
|
|
oburak90
Joined: 19 Nov 2011 Posts: 10
|
|
Posted: Sun Nov 20, 2011 1:22 am |
|
|
necati wrote: | data = (float)f_temp;
glcd_rect(57,24,110,40, YES,0); //arayi sil ** burasi 0 ise
sprintf(str,"%4.1f",data);
glcd_text57(60,25,str,2,1); //**burasi 1 olacak
//veya tersi
arayı silmez isen yazilar üst üste cikar |
şimdi Necati burası 0 ise burası 1 veya tersi dediğin glcd ye sadece yazılar aktif kalanı pasif piksel veya tersi olması içinmidir?
arayı sil diyorsun hangi arayı sileyim? yoksa yeni uyandım diyemi çalışmıyor kafam anlamadım birşey =)
++++++++++++++++++++++
Please use English on the forum.
For Turkish discussions, please use PM's.
- Forum Moderator
++++++++++++++++++++++
_________________ Ömer Burak ÖZKESKİN |
|
|
oburak90
Joined: 19 Nov 2011 Posts: 10
|
|
Posted: Sun Nov 20, 2011 2:02 am |
|
|
necati wrote: |
arayı silmez isen yazilar üst üste cikar
glcd_rect(57,24,110,40, YES,0); //siyah yaziyi sil yeşil yap
glcd_rect(57,24,110,40, YES,1); //siyah icindekiyaziyi sil siyah yap
glcd_text57(60,25,str,2,1); // yesil ustune siyah yaz
glcd_text57(60,25,str,2,0); // siyah icine yesil yaz |
.. I understand it. but i have same problem still. i read 0.0 on glcd. but i erase glcd codes and use 2x16 lcd the problem solved(i read the temparature (example: 23.0).. i want use glcd because i write lots of things on glcd.. _________________ Ömer Burak ÖZKESKİN |
|
|
ezflyr
Joined: 25 Oct 2010 Posts: 1019 Location: Tewksbury, MA
|
|
Posted: Mon Nov 21, 2011 11:42 am |
|
|
Hi,
It seems clear that something about the GLCD is adversely effecting your DS18b20 readings. I assume that the 2x16 and the GLCD are not connected simultaneously, so you've made a lot of wiring changes to go from one configuration to another. This is a prime area for investigation. Also, we have no idea which PIC pins you are using for the DS18b20, or the GLCD. Perhaps there is a conflict in your pin selection?
I think you'll have to provide a more complete description of the wiring you are using (providing a link to a schematic would be optimal), and also the pin defines used for your DS18b20, and your GLCD.
Good luck!
John |
|
|
oburak90
Joined: 19 Nov 2011 Posts: 10
|
|
Posted: Mon Nov 21, 2011 5:29 pm |
|
|
Firstly thanks John..
2x16 lcd schematic and codes;
-Click for schematic
-Click for codes
128x16 glcd schematic and codes;
-Click for schematic
-Click for codes
Download all of the files (pjt,dsn,hex,c)
-Click for 1wire and ds1820 drivers - http://www.ccsinfo.com/forum/viewtopic.php?t=28425
-Click for 2x16 lcd
-Click for 128x64 glcd
Also codes here..
2x16 lcd pins are default(lcd.c) portd ds18b20 data pin to porta.0
Code: | #include <16F877A.h>
#fuses xt,nowdt,noprotect,nobrownout,nolvp,noput,nowrt,nodebug,nocpd
#use delay(clock=4000000)
#include<lcd.c>
#include<1wire.c>
#include<ds1820.c>
void main()
{
float f_temp;
char c_temp[15];
setup_comparator(nc_nc_nc_nc);
setup_psp(psp_disabled);
setup_timer_1(t1_disabled);
setup_timer_2(t2_disabled,0,1);
setup_adc_ports(no_analogs);
setup_adc(adc_off);
setup_ccp1(ccp_off);
setup_ccp2(ccp_off);
lcd_init();
lcd_putc("\f");
while (1)
{
delay_ms(100);
f_temp = ds1820_read();
lcd_gotoxy(1,1);
sprintf(c_temp,"TEMP: %2.1f C",f_temp);
printf(lcd_putc,"%s ", c_temp);
}
} |
128x64 glcd pins are default(hdm64gs12.c) ds18b20 data pin to porta.0
Code: | #include <16F877A.h>
#fuses xt,nowdt,noprotect,nobrownout,nolvp,noput,nowrt,nodebug,nocpd
#use delay(clock=4000000)
#include<HDM64GS12.c>
#include<graphics.c>
#include<1wire.c>
#include<ds1820.c>
void main()
{
float data=0,f_temp=0;
int8 str[5]={};
setup_comparator(nc_nc_nc_nc);
setup_psp(psp_disabled);
setup_timer_1(t1_disabled);
setup_timer_2(t2_disabled,0,1);
setup_adc_ports(no_analogs);
setup_adc(adc_off);
setup_ccp1(ccp_off);
setup_ccp2(ccp_off);
glcd_init(on);
while (1)
{
delay_ms(100);
f_temp = ds1820_read();
data=(float)f_temp*1;
glcd_init(on);
sprintf(str,"%4.1f",data);
glcd_text57(60,25,str,2,1);
}
} |
_________________ Ömer Burak ÖZKESKİN |
|
|
ezflyr
Joined: 25 Oct 2010 Posts: 1019 Location: Tewksbury, MA
|
|
Posted: Tue Nov 22, 2011 7:44 am |
|
|
Hi,
A quick question. Is this a "real" project, ie. you are actually building and testing physical hardware, or is this strictly a "virtual" project, ie. you are simulating it exclusively using Proteus?
Thanks,
John |
|
|
oburak90
Joined: 19 Nov 2011 Posts: 10
|
|
Posted: Tue Nov 22, 2011 11:23 am |
|
|
both =).. i try on proteus its dont work i search on google and i cant found anything after i use 2x16 lcd it is work.. i thinks proteus have a bug i build it on board and try it. i build on board glcd version and its dont work i change glcd to 2x16lcd and codes it is work =(.. i say "i have a problem =)" and i write this topic =)
also i try sht11 on proteus. i is work with 2x16 lcd but dont work on with glcd on glcd only static values its dont increase or decrease.. glcd is a big problem =) or glcd is a very big problem for me =( _________________ Ömer Burak ÖZKESKİN |
|
|
ezflyr
Joined: 25 Oct 2010 Posts: 1019 Location: Tewksbury, MA
|
|
Posted: Tue Nov 22, 2011 2:32 pm |
|
|
Hi,
The DS18b20 and the SHT11 use a completely different hardware interface, so it's somewhat suspicious that they both seem to exhibit the same failure! It suggests that you might be overwriting something in memory, or that you've got a wiring error. Can you post a couple of pictures of your actual hardware?
Thanks,
John |
|
|
oburak90
Joined: 19 Nov 2011 Posts: 10
|
|
Posted: Tue Nov 22, 2011 4:28 pm |
|
|
sht11 only build on proteus and i see on temp=-40.0 HUD=-4.6 and not change =( glc is a problem. _________________ Ömer Burak ÖZKESKİN |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|