Discussion in "Project Addition or Changes" started by    pinky    Apr 29, 2007.
Sun Apr 29 2007, 10:23 AM
#1
i am trying to implement a real time clock using an 16x2 LCD microcontroller AT89C5131 in our project.
we want only the clock part without the alarm and i removed some part of the clock.asm program and tried but its not working.our lcd is working properly.we are trying to display date,time and day only
i want to know if the code given below will work
additional change is i have given a small delay before actual starting.

Code removed!



[ Edited Mon Apr 30 2007, 07:48 AM ]
Tags real time clockasm program16x2 lcdmicrocontrollerrtc
Sun Apr 29 2007, 03:29 PM
#2
actually you did not edited the code properly.
you removed many things which were necessary for the clock. I am giving you one example...
In your code above there is a mistake..
done:
mov sec,#00h ;For more information about the RTC DS1307
mov min,#0h ;Please refer to the datasheet
mov hour,#51h ;21h for 24 hour format
mov days,#01h
mov date,#1h
mov month,#1h
mov year,#05h
;;;LINE MISSING;;;
mov sig,#'~'
mov r6,#07h
mov r0,#30h
mov r1,#00h
acall rtc_ini ;initializing RTC if required

there is a line missing.. i mentioned where...
you missed..
mov alarm,#0

the reason is.. if you take a look at the datasheet of DS1307 then register #7 is SQWT register so.. as we are not using it, so we have to make it 0. The reason i made kept its name as alarm was, i was first driving the alarm from internal square wave generator but then i changed it. if you want you can keep the old name. or change the alarm to sqwt for your knowledge.
so make these changes in above code..
put the missing line there and change this
mov r6,#08h

make it 08H u using 07H

and i do not understand why you are putting this code
MOV R7,#0FFH
BACK1:MOV TMOD,#01H
MOV TL0,#00H
MOV TH0,#00H
SETB TR0
HER:JNB TF0,HER
CLR TF0
CLR TR0
DJNZ R7,BACK1

Please explain the use of this. and check what all things are missing in the code. i think you must start reviewing the original code again and rewrite the original one according to your need.
Tags movrtcr7r6wave generator
Mon Apr 30 2007, 07:24 AM
#3
thanks for the advice...
actually had a doubt in understanding the code.
wanted to know why exactly time flag and alarmflag used...and also the increament and decreament flag.
can we do without using switches.i.e is it for setting time in clock or setting time for alarm...
Tags setting timetime flagswitchesdoubtclock
Mon Apr 30 2007, 08:32 AM
#4
I removed the code from the first post, coz no more needed.
So regarding the information about the flags i used.. i am gonna explain then one by one.. all the defination in the code.
sec equ 30h       ;second register *needed*
to store RTC seconds
min equ 31h      ;minutes register *needed*
to store mins
hour equ 32h     ;hour register *needed*
to store hr
days equ 33h     ;days register *needed*
to store days
date equ 34h     ;date register *needed*
to store date
month equ 35h   ;month register *needed*
to store month
year equ 36h      ;year register *needed*
to store year
alarm equ 37h    ;alarm register *needed*
it is written as alarm but it is used for SQWT register of
your RTC. so is also needed, if you want change the name to
sqwt or something u want.
sig equ 38h       ;signature for data checking in RTC RAM *needed*
needed for checking of valid ram content of RTC
ahour equ 39h   ;alarm hour register
for alarm only can be removed
amin equ 3Ah    ;alarm minute register
for alarm only can be removed
sda equ P1.1     ;Serial data pin *needed*
SDA pin for I2C
scl equ P1.0       ;Serial clock pin *needed*
SCL pin for I2C communication
rw equ p3.6        ;read write pin of LCD
for LCD
en equ p3.5       ;enable pin of LCD
for LCD
rs equ p3.7        ;register select pin of LCD
for LCD
alarm_key equ p3.3   ;Alarm set key
to set alarm.. not needed.. so one key can be removed. and
also the subroutine at location 0x13H
time_key equ p3.2    ;Time ser key *needed*
to set time of clock
increment equ p1.3   ;Increment value *needed*
to set time and alarm, but for u it will only time
decrement equ p1.2   ;Decrement Value *needed*
to set time and alarm, used to reduce the value
alarm_port equ p1.4   ;Alarm Buzzer port
not required
alarm_flag equ 20h    ;flag for alarm
not required
time_flag equ 21h      ;flag for time *needed*
when u press time set key this flag is set.
ampm_flag equ 22h    ;am/pm flag *needed*
used in display am/pm
alarm_on equ 23h       ;Alarm on flag
not required
alarm_off equ 24h       ;alarm off flag
not required
alarm_ring equ 25h      ;alarm ring flag
not required
alarm_hrs equ 58h       ;Alarm hour register
not required
alarm_min equ 59h      ;Alarm Minutes register
not needed
alarm_chk_hour equ 5Ah ;Alarm hour check register
not needed
alarm_chk_min equ 5Bh  ;Alarm min check register
not required
ampm equ 61h           ;AM/PM register *needed*
needed 
BELL equ 0h               ;Bell icon *needed*
SPEAKER_OFF equ 1h  ;speaker off icon *needed*
SPEAKER_ON equ 2h    ;speaker on icon *needed*
CLOCK equ 3h           ;clock icon *needed*
OK equ 4h                 ;ok icon *needed*
HEART equ 5h            ;heart icon *needed*
MUSIC equ 6h            ;music icon *needed*

U can see what things are needed, what variables or flags
needed. Please carefully edit the code now.


[ Edited Mon Apr 30 2007, 08:34 AM ]
Tags rtcp1sdacoz
Fri May 04 2007, 02:27 PM
#5
great help! keep it up Rickey!
Sun May 06 2007, 02:56 AM
#6
Well i need help and contribution from other forum members too.. not just me.. ok?
Tue May 08 2007, 02:50 PM
#7
In your code , there's a label i dont understand .it's the
algorthm to read data from ds1307

recv: ;Recieving data from I2C bus
mov r7,#08
back2:
setb sda
setb scl
lcall delay ;nop nop nop;
mov c,sda
rlc a
clr scl
lcall delay ;nop nop nop;
djnz r7,back2
setb sda
clr scl
lcall delay ;nop nop nop;
clr sda
setb scl
lcall delay ;nop nop nop;
clr scl
lcall delay ;nop nop nop
mov @r0,a
inc r0
ret

SDA=1 => C=1 , then A =11111111 after 8 times shift left ??????????
Tue May 08 2007, 03:09 PM
#8


In your code , there's a label i dont understand .it's the
algorthm to read data from ds1307

recv: ;Recieving data from I2C bus
mov r7,#08
back2:
setb sda
setb scl
lcall delay ;nop nop nop;
mov c,sda
rlc a
clr scl
lcall delay ;nop nop nop;
djnz r7,back2
setb sda
clr scl
lcall delay ;nop nop nop;
clr sda
setb scl
lcall delay ;nop nop nop;
clr scl
lcall delay ;nop nop nop
mov @r0,a
inc r0
ret

SDA=1 => C=1 , then A =11111111 after 8 times shift left ??????????

NiceThou


I thought everything was mentioned clearly...
recv: ;Receiving data from I2C bus
it is to receive data from I2C bus...
and yes, if u keep SDA = 1 so while reading C will also be 1.
but everytime the clock changes, the new data comes on the SDA pins. so next can be 0 or 1.
if whole data is 1, then u get a = 11111111
Wed May 09 2007, 01:19 PM
#9
Thankz u .Now i understand
Wed May 09 2007, 03:02 PM
#10
you're welcome

Get Social

Information

Powered by e107 Forum System

Conversation

scena
Tue May 19 2020, 06:29 PM
Does anyone have microcontroller programming software for STC15F104W (core 8051, 4 k, 128 byte, 6 I/O pin, UART ... DIL8), that works?
Sat May 02 2020, 03:38 PM
Tamu Gurung
Hi I am looking for a assembly language program for a digital decimal counter. Time counts max limit of 2 mins starting from 2.00 mins and ending at 0.00. time is to be displayed on 4 7-segment LED displays. Edsim51 simulator to be used. Thanks
Wed Mar 25 2020, 09:39 AM
Tajammul
Sir kindly send the code file i2c for 8051
ExperimenterUK
Fri Mar 13 2020, 06:36 PM
@ Rohitnani,ABEBE..which project ?
Fri Mar 13 2020, 08:55 AM
ABEBE
how can get hadwere of this project
Rohitnani
Sat Mar 07 2020, 12:11 PM
Sir, Could you please send me the zip file input password....
Wed Feb 26 2020, 11:58 AM
Peter Parker
Is it possible to send multiple messages using only 1 GSM module?
Sat Feb 01 2020, 05:12 AM
Pearl Olin
Hello,
Wed Jan 22 2020, 01:16 PM
MINU CHAUDHARY
I m getting errors while simulation process during interfacing socket output and lcd... Can i get the report of ur project which is same as us.
Tue Jan 14 2020, 02:08 AM
shubham kharade
when i am trying to simulate the program in Proteus 8 professional, I am getting some errors as cannot find module file dhtxx.md can u help me

Downloads

Comments

Davidthils
Thu May 21 2020, 08:44 AM
Jakeror
Wed May 20 2020, 09:28 PM
motorCar
Wed May 20 2020, 03:05 PM
Vordrync
Wed May 20 2020, 07:52 AM
JadenjiT
Wed May 20 2020, 03:15 AM
scena
Tue May 19 2020, 06:08 PM
CodySiz
Tue May 19 2020, 02:22 PM
ClaireSat
Mon May 18 2020, 09:50 PM

Online

Guests: 57, Members: 0 ...

most ever online: 182184
(Members: , Guests: 182184) on 06 Aug 2010: 01:37 AM

Members: 38211
Newest member: Davidthils
Forum Activity
xrxx Avatar
Posted By xrxx
Thu Apr 30 2020, 06:59 AM
BCD MULTIPLICATIONAssume that you have to 2 BCD nu...
liqian Avatar
Posted By liqian
Tue Apr 28 2020, 05:26 AM
I happened to see your post and I got many useful ...
ExperimenterUK Avatar
Posted By ExperimenterUK
Tue Apr 28 2020, 04:21 AM
The code is hard to read.Please zip it and attach ...
rogermado Avatar
Posted By rogermado
Sun Apr 26 2020, 01:53 AM
@ExperimenterUK, thanks for your reply. You'll fin...
ExperimenterUK Avatar
Posted By ExperimenterUK
Sat Apr 25 2020, 05:42 PM
Some simulators handle displays better than others...
rogermado Avatar
Posted By rogermado
Sat Apr 25 2020, 03:59 PM
Hello everyone, sorry in advance if i'm not in the...
PHANTOM28 Avatar
Posted By PHANTOM28
Fri Feb 28 2020, 10:25 AM
Hi.I hope you all can help me. I am relatively ne...
ExperimenterUK Avatar
Posted By ExperimenterUK
Fri Feb 21 2020, 05:05 PM
ajay_bhargav Avatar
Posted By ajay_bhargav
Fri Feb 21 2020, 04:45 AM
Yes you can do that.1. Create a channel @Thingspea...
ananyagupta Avatar
Posted By ananyagupta
Thu Feb 20 2020, 03:58 AM
With regards to the particular characters sent to ...