Discussion in "Project Addition or Changes" started by    koushal    Apr 21, 2007.
Sat Apr 21 2007, 05:49 PM
#1
HI ,
i just want to know how to set 5 different alarms and store it in rtc ram location ,i am getting confused....
 tienduhieu like this.
Tags alarmsdigital clockpgmrtc
Sun Apr 22 2007, 02:28 PM
#2
setting alarm, this is just an example...

eg you create two variables, alarm_hr and alarm_min
alarm_hr will have the address where hr of the alarm is going to be stored and alarm_min will have the address where min of the alarm is going to be stored, so before calling the alarm set routine, you fill these variables with the addresses, where you want to store the alram.
say...
for alarm 1: hr is stored in 20H and min is stored in 21H
for alarm 2: hr is stored in 22H and min is stored in 23H
for alarm 3: hr is stored in 24H and min is stored in 25H
for alarm 4: hr is stored in 26H and min is stored in 27H
for alarm 5: hr is stored in 28H and min is stored in 29H

so whenever you want to set alarm.. say you want to set alarm #3

you call the routine something like this..
mov alarm_hr,#23H
mov alarm_min,#24H
lcall set_alarm

so this way you are actually passing address where your alarm time is going to be stored. so this way you can do the alarm set... for any number of alarms you want.
 tienduhieu like this.
Tags 24hvariablesalarm timetime is goingmov
Thu Apr 26 2007, 01:03 PM
#3


setting alarm, this is just an example...

eg you create two variables, alarm_hr and alarm_min
alarm_hr will have the address where hr of the alarm is going to be stored and alarm_min will have the address where min of the alarm is going to be stored, so before calling the alarm set routine, you fill these variables with the addresses, where you want to store the alram.
say...
for alarm 1: hr is stored in 20H and min is stored in 21H
for alarm 2: hr is stored in 22H and min is stored in 23H
for alarm 3: hr is stored in 24H and min is stored in 25H
for alarm 4: hr is stored in 26H and min is stored in 27H
for alarm 5: hr is stored in 28H and min is stored in 29H

so whenever you want to set alarm.. say you want to set alarm #3

you call the routine something like this..
mov alarm_hr,#23H
mov alarm_min,#24H
lcall set_alarm

so this way you are actually passing address where your alarm time is going to be stored. so this way you can do the alarm set... for any number of alarms you want.

Rickey




sir can u tell me how to compare 5 different alarms
and where exactly r u ciomparing the actual time and alarm time
 tienduhieu like this.
Tags 24halarm timealarmsvariablestime is going
Fri Apr 27 2007, 07:07 AM
#4
In the display RTC routine i am checking for the Alarm
PASS:	inc r1
	mov a,#0C7h
	acall command
	mov a,@r1
	mov 51h,@r1
	mov alarm_chk_min,@r1
	acall disp_val
PASS1:	inc r1
	mov a,#0c4h
	acall command
	mov a,@r1
	mov 52h,@r1
	mov alarm_chk_hour,@r1
	mov r4,a

here i am moving the current time to alarm_chk_hour and min registers so that i can use them while comparing.
	inc r1
	inc r1
	inc r1
	mov a,@r1
	cjne a,52h,PASS6
	inc r1
	mov a,@r1
	cjne a,51h,PASS6
	setb alarm_ring
	setb alarm_ring
PASS6:	ret

Here at the end of the display RTC routine i am reading the alarm time from RTC and comparing it with current time. I used 52H and 51H i could have used alarm_chk_hour and min...
for your 5 alarm case.. you can make use of these variables and pass them to a new routine alarm check where you are going to do all the compares.
 tienduhieu like this.
Tags r1movsetbchk
Sun Apr 29 2007, 05:19 PM
#5
thanks mr.RICKEY ( THE ONE )!!!
 tienduhieu like this.
Sat May 05 2007, 04:16 PM
#6
Hi Rickey,

I'm working on a clock project but using different code. Please see the attachment.

I want to use the value displayed (LCD) in the alarm time (alm_hour and alm_min in the attached code) as input values (in seconds) for my below timer code as I want to turn on/off lamp with the duration according to the value displayed.

For example, lcd display 20 for alm_hour will be treated as 20 second by below timer. My problem is the value displayed on lcd was converted (BCD to ASCII ?). Please see the attached code (attchment).

This is my timer code.

TIMER:
MOV TMOD,#01H
MOV TICKS,#20
MOV SECONDS,#00

AGAIN_A:
MOV TH0,#76
MOV TL0,#01
SETB TR0

WAIT_A:
JNB TF0,WAIT_A
CLR TF0
CLR TR0
DJNZ TICKS,AGAIN_A
MOV TICKS,#20
INC SECONDS
MOV A,SECONDS
CJNE A,ALM_HOUR,AGAIN_A
RET

Rickey, please help me solve the problem.

Thanks,
SGH


 tienduhieu like this.
Sun May 06 2007, 07:00 AM
#7
you need to do HEX to BCD conversion and then send the data for display.. i mean.. if seconds are 20 in decimal then convert it to 20 in hex for displaying them and u can directly use your write_bcd routine to display them.
make sure that only for displaying you are converting to hex then again u have to change it back to decimal.
in my code, there are two small routines for hex to dec and dec to hex. i am using them for the same purpose. you take a look at them and use them in your program.
 SGHtienduhieu like this.
Wed May 09 2007, 05:09 AM
#8
Rickey, many thanks for your previous info.

In my previous post dated May 05 with clock code attached, how to modify the I2C routine so it can be used for SEEPROM AT24C01A ?. I'm confused with the ACC.7 in one line of the Send_Byte routine.

Which line in the codes needed to be changed ?. Other routine looks ok (for me), any changes required for other routines ?.


Thanks,
SGH

 tienduhieu like this.
Wed May 09 2007, 07:23 AM
#9

  JNB	  ACC.7,NOTONE		
  SETB    SDA        		
  JMP     ONE

NOTONE:
  CLR     SDA 


in the above code, its checking if the MSB is 1 then make SDA 1 otherwise make SDA 0.
because in I2C the data is transferred MSB to LSB. so ACC.7(MSB of ACC) first.
using EEPROM is little tricky, you have to see the datasheet for coding information. coz after writing a byte to EEPROM you need some kind of delay. I dont have any EEPROM IC with me so never tested I2C code.
 tienduhieu like this.
Thu May 31 2007, 03:26 AM
#10
Hi Rickey,

I want to add a Totalize Timer function into my RTC w/DS1307 + AT89S51.

Here some details how it will work. The totalize timer will check the condition of port 1.0 (port number for example only, other port available). When this port in low state, it will start the timer to count the time how long this port in low state. When the port in high state, time counting process is terminated and duration of time counted then stored in DS1307 RAM. The process will continue until total time counted equal with preset value.

Other example, Port 1.0 in low state for 5 seconds then turn high for 40 second and turn low again for 15 second, etc.. The timer will have a value of 5 second + 15 second = 20 second.

Could you please give me some hints how to implement it. If possible I'm avoiding external timer interrupt. Also I don't want to be stucked with this counting process (of course if possible).


Thanks,
SGH
 tienduhieu like this.
Tags 8051 timerDS1307 rtc

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

ilylily07
Tue Oct 15 2019, 04:32 PM
hientran123
Tue Oct 15 2019, 02:27 AM
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

Online

Guests: 44, Members: 0 ...

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

Members: 38097
Newest member: ilylily07
Forum Activity
s_dinesh40@yahoo.com Avatar
Posted By [email protected]
Sun Oct 20 2019, 03:09 PM
s_dinesh40@yahoo.com Avatar
Posted By [email protected]
Sun Oct 20 2019, 03:02 PM
sir, when i on display ,sometime 3rd display is no...
s_dinesh40@yahoo.com Avatar
Posted By [email protected]
Sun Oct 20 2019, 02:53 PM
sir, when i on display ,sometime 3rd display is no...
ExperimenterUK Avatar
Posted By ExperimenterUK
Sun Oct 20 2019, 12:21 AM
Your code seems okay on my simulationTry my code o...
ExperimenterUK Avatar
Posted By ExperimenterUK
Sun Oct 20 2019, 12:21 AM
Your code seems okay on my simulationTry my code o...
s_dinesh40@yahoo.com Avatar
Posted By [email protected]
Sat Oct 19 2019, 07:13 PM
please find video attachment. 3rd & 4th displa...
s_dinesh40@yahoo.com Avatar
Posted By [email protected]
Sat Oct 19 2019, 07:05 PM
sir, 3rd and 4th dot matrix display flickering, ...
ExperimenterUK Avatar
Posted By ExperimenterUK
Fri Oct 18 2019, 09:18 PM
Hopefully you understand some of the program.Which...
s_dinesh40@yahoo.com Avatar
Posted By [email protected]
Thu Oct 17 2019, 09:38 PM
ExperimenterUK Avatar
Posted By ExperimenterUK
Thu Oct 17 2019, 08:35 PM
Do you understand how this code works?If so, addin...