Microcontroller › 8051 › Digital Clock using 8051 and RTC DS12C887
- This topic has 3 replies, 2 voices, and was last updated 12 years, 1 month ago by
AJISH ALFRED.
-
AuthorPosts
-
December 8, 2012 at 3:09 pm #4929
poovi
ParticipantHI,
I tried to implement the circuit but was unable to get any message on the LCD. Also I did not clearly understand how the initial setting of the circuit is done i.e connecting P3.3 = 0 and start =0 and setting hour and minute and then removing them. Please help me as I am trying to implement this from a long time and seem to be getting nowhere
Also is a picture of the microcontroller board that I am using. There is no availability of connection from pin 30 so I have soldered a wire to the board. But there is still no display on the LCD but the gree LED on the board flickers. What does it stand for?
December 9, 2012 at 1:52 pm #8816AJISH ALFRED
Participantthe lcd is too brighter than normally it should be. thanks for posting the image. I think you’ve connected pin 15 and pin 16 directly to vcc and ground respectievely without using a current limiting resistor. Suggest you to post the circuit diagram again, in this post it is not legible
December 11, 2012 at 2:28 pm #8821poovi
ParticipantI have checked the LCD separately using a sample code and it displays properly. So I decided to check the RTC separately and gave the code as below. The code executed correctly on Kiel Simulator. (it constantly displayed 16:55:58) However when I burnt the same code into the microcontroller and connected the hardware, there was no output on Hyper terminal.. ( I am not exactly sure how to use Hyper terminal) . PLease help me as I need to submit this as my project
//Program to interface RTC DS12C887 with 8051 microcontroller (AT89C51)
#include<reg51.h>
#include<absacc.h>
char hr, min, sec;
void delay(int time)
{
int i,j;
for(i=0;i<time;i++)
for(j=0;j<1275;j++);
}serial(char x) // Function to transmit data serially using RS232
{
SBUF=x;
while(TI==0);
TI=0;
}void bcdconv(char mybyte) // Function to convert data into BCD format.
{
char x,y;
x=mybyte&0x0F;
x=x|0x30;
y=mybyte&0xF0;
y=y>>4;
y=y|0x30;
serial(y);
serial(x) ;
}void main()
{
TMOD=0x20;
TH1=0xFD;
SCON=0X50;
TR1=1;
delay(220);
XBYTE[10]=0x20;
delay(20);
XBYTE[10]=0x30;
XBYTE[11]=0x83;
XBYTE[0]=0x55;
XBYTE[2]=0x58;
XBYTE[4]=0x16;
XBYTE[7]=0x02;
XBYTE[8]=0x02;
XBYTE[9]=0x02;
XBYTE[11]=0x03;
while(1)
{
XBYTE[10]=0x20;
delay(500);
hr=XBYTE[4];
bcdconv(hr);
serial(‘:’);
min=XBYTE[2];
bcdconv(min);
serial(‘:’);
sec=XBYTE[0];
bcdconv(sec);
serial(0x0D);
serial(0x0A);
}
}December 14, 2012 at 5:23 pm #8830AJISH ALFRED
ParticipantYou need to set the following things exactly same on your code and the hyperterminal
baud rate = 9600
data bits = 8
start bit = 1
stop bit = 1
parity bit = 0
hardware flow = none (only in hyperterminal) -
AuthorPosts
- You must be logged in to reply to this topic.