Discussion in "Project Addition or Changes" started by    pinky    Apr 29, 2007.
Sun Apr 29 2007, 02:23 PM
#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, 11:48 AM ]
Tags real time clockasm program16x2 lcdmicrocontrollerrtc
Sun Apr 29 2007, 07: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, 11: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, 12:32 PM
#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, 12:34 PM ]
Tags rtcp1sdacoz
Fri May 04 2007, 06:27 PM
#5
great help! keep it up Rickey!
Sun May 06 2007, 06:56 AM
#6
Well i need help and contribution from other forum members too.. not just me.. ok?
Tue May 08 2007, 06: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, 07: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, 05:19 PM
#9
Thankz u .Now i understand
Wed May 09 2007, 07:02 PM
#10
you're welcome

Get Social

Information

Powered by e107 Forum System

Conversation

Sun Oct 13 2019, 02:02 AM
Aline Hutchinson
Hey there,
ExperimenterUK
Sat Oct 12 2019, 10:23 PM
Log in.. then post your code in the 8051 forum
Sat Oct 12 2019, 10:18 AM
Bhadra Sajikumar
i am doing a countdown timer with 8051 for my project, unfortunately our professor had to take a leave of absence before he could teach us most of it.. can someone explain the .asm code of it for me?
Mon Sep 23 2019, 07:37 AM
Nathaniel
I am doing a project for my schools wireless security system with cameras,sensors and spot lights using 8051 micro controller, could you help me out with the design and its source code.
Wed Sep 18 2019, 08:48 PM
Caryn Kover
Thank you for your time,
ExperimenterUK
Mon Aug 05 2019, 07:09 PM
@Ismail ..post in forum, give details
Mon Aug 05 2019, 04:33 PM
Ismail balghmi
Hello. Please I won't download
ExperimenterUK
Wed Jul 24 2019, 12:47 AM
@BUSTER123 Please post in the forum
Tue Jul 23 2019, 06:13 PM
BUSTER123
hello! newbie here. i am kind of a guy who hates using ready - made existing libraries, so this helped a lot as i was trying to control and write to a character lcd display. however, i can't figure out how to set the cursor position. for example, i want to set it to the 5th column in the first row, so position 5. so according to the table, i am sending 10000101 on the 8 data lines of the lcd (register select pulled low). the cursor does not move there however. and i cant move the cursor left or right too. is it something wrong that i am doing? thank you.
ExperimenterUK
Thu Jul 11 2019, 07:55 PM
@ramos https://www.theengineeringprojects.com/2017/09/l298-motor-driver-library-proteus.html

Downloads

Comments

Sat Oct 05 2019, 02:38 PM
zexalo
Thu Oct 03 2019, 09:53 AM
thanhle12345
Thu Oct 03 2019, 07:37 AM
ramon_vsc
Fri Sep 20 2019, 04:53 PM
youssoufba
Thu Sep 19 2019, 11:57 AM
Taiphan000
Tue Sep 17 2019, 04:21 AM
mawantha
Fri Sep 13 2019, 10:42 AM
jonelily954
Mon Sep 02 2019, 12:34 PM

Online

Guests: 66, Members: 0 ...

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

Members: 38095
Newest member: [email protected]
Forum Activity
ExperimenterUK Avatar
Posted By ExperimenterUK
Sun Oct 13 2019, 06:10 PM
This code does some scrolling.You will need to fin...
ExperimenterUK Avatar
Posted By ExperimenterUK
Sat Oct 12 2019, 10:19 PM
This code does not scroll, that will be complicate...
s_dinesh40@yahoo.com Avatar
Posted By [email protected]
Sat Oct 12 2019, 06:44 AM
Sir, Please share code, i m unable to scroll messa...
ExperimenterUK Avatar
Posted By ExperimenterUK
Sat Oct 12 2019, 02:45 AM
Okay I got it !Data is not automatically passed on...
s_dinesh40@yahoo.com Avatar
Posted By [email protected]
Fri Oct 11 2019, 05:36 AM
please find below attachment. Att...
ExperimenterUK Avatar
Posted By ExperimenterUK
Fri Oct 11 2019, 02:33 AM
You seem to be 95% of the way there.Can you post y...
s_dinesh40@yahoo.com Avatar
Posted By [email protected]
Thu Oct 10 2019, 07:49 AM
sir, i m trying to scroll message on dot matrix di...
ExperimenterUK Avatar
Posted By ExperimenterUK
Thu Oct 10 2019, 01:31 AM
max 7219 dout pin not giving serial out data.Try t...
s_dinesh40@yahoo.com Avatar
Posted By [email protected]
Wed Oct 09 2019, 08:48 AM
Dear sirall dot matrix display scroll same data.
s_dinesh40@yahoo.com Avatar
Posted By [email protected]
Wed Oct 09 2019, 08:46 AM
please find below attachment of circuit diagram. ...