|
|
View previous topic :: View next topic |
Author |
Message |
fiasgardone
Joined: 19 Jan 2010 Posts: 71
|
GLCD AND DS1307 PROBLEM! |
Posted: Mon Mar 28, 2011 9:57 am |
|
|
Hello gentlemen!
I have a problem with my GLCD and DS1307, the DS1307 sends the time for the GLCD and shows the beginning and then it gets much all characters all white! as shown in photos
How to solve this!
When I turn, all good
And then it gets so?!
the code
Code: | #include <18f452.h>
#FUSES NOWDT //No Watch Dog Timer
#FUSES HS //High speed Osc (> 4mhz)
#FUSES NOPROTECT //Code not protected from reading
#FUSES NOBROWNOUT //Reset when brownout detected
#FUSES NOPUT //No Power Up Timer
#FUSES NODEBUG //No Debug mode for ICD
#FUSES NOLVP //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
//CRISTAL
#use delay(clock=20000000) //A 20MHZ
#include <HDM64GS12.c>
#include <graphics.c>
#
#include <DS1307.c>
#use standard_io(a)
#use standard_io(e)
#use standard_io(c)
#define DAL_SCL PIN_C2
#define DAL_SDA PIN_C3
char v_sec[2]; //
char v_min[2]; //
char v_hrs[2];
char v_day[2];
char v_month[2];
char v_yr[2];
char v_dow[2];
main() {
BYTE sec,min,hrs,day,month,yr,dow;
setup_ccp1(ccp_off);
setup_ccp2(ccp_off);
ds1307_init();//
glcd_init(ON); //
glcd_fillScreen(OFF);
glcd_rect(0,0,127,15,0,1);
while(true){
//ds1307_get_date(day,month,yr,dow);
ds1307_get_time(hrs,min,sec);
sprintf(v_hrs,"%02u",hrs);
glcd_text57(5,5,v_hrs,1,on);
sprintf(v_min,"%02u",min);
glcd_text57(20,5,v_min ,1,on);
sprintf(v_sec,"%02u",sec);
glcd_text57(35,5,v_sec ,1,on);
delay_ms(700);
}
} | [/url] |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9226 Location: Greensville,Ontario
|
|
Posted: Mon Mar 28, 2011 11:47 am |
|
|
You could have 3 or 4 areas of problems.
1) the RTC chip
2) the GLCD
3) the wiring..though it seems OK...
4) the program
I'd do the following..
1)remove all the RTC code and create 3 simple counters( hrs,min,sec) to simulate the RTC data. Have them incremented every second using delay_ms(1000) and then sent to the display, loop for 00 to 60, forever.
Don't worry about illegal 'time' like 33 hours...you're testing the GLCD to be sure it'll display data correctly.
This will show if the GLCD is working right.If it displays properly, perhaps you have a bad RTC chip.
2) to verify the RTC chip , cut code to send the data via RS232 to a PC or terminal. If this shows correctly, then the RTC chip should be fine.
2a) haven't looked at the RTC driver, but some RTC require an 'enable' line or bitset to NOT read the RTC data while it's updataing the time internally.
2b) if I2C bus, you need proper pullup resistors for your speed and VDD.
2c) also disable any other peripheral that might be muxed onto the RTC pins...
3) hardware..be sure to have bypass caps near each chip, real good grounds and a stable power supply with more power than required. |
|
|
fiasgardone
Joined: 19 Jan 2010 Posts: 71
|
|
Posted: Mon Mar 28, 2011 12:52 pm |
|
|
hello gentlemen
temtronic, i made the counters, and the problem continues, as shown in photos.
The resistors are 4.7k pull_up.
The GLCD is new, the DS1307 is new, I think it works well! The power supply is 5 volts.
How to solve this?
Thanks |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Mon Mar 28, 2011 1:19 pm |
|
|
It looks like the over-writing pixel problem.
Look at the code posted by petu65 at the end of this thread:
http://www.ccsinfo.com/forum/viewtopic.php?t=44703
He adds an "else" block after the "if" block, which turns OFF pixels
which are not used by the character font. Edit glcd.c and add the
"else" block to it. See if that fixes your problem. |
|
|
fiasgardone
Joined: 19 Jan 2010 Posts: 71
|
|
Posted: Tue Mar 29, 2011 1:11 pm |
|
|
Hello PCM programmer thanks for helping!
My GLCD not work with the library GLCD.C (not sure why), I made the driver change, but does not work!
But as you can see in the pictures with driver "HDM64GS12.c" the GLCD work, but has the problem of not showing the right numbers!
Has any driver change "HDM64GS12.c"?, searched the forum and not found
I would like what is the solution to this problem!!
thanks |
|
|
|
|
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
|