free 8051 Microcontroller Projects AVR PIC Microcontroller Projects Tutorials Ebooks Libraries, interfacing tutorials, lcd tutorial, stepper motor, dc motor 8051 assembly language programming electronics and communication ECE CSE pdf ebooks library BE final year project ideas Embedded systems

 
8051 microcontroller 8051 microcontroller
Forums

8051 Microcontroller Projects AVR PIC Projects Tutorials Ebooks Libraries codes :: Forums :: Project Development :: Project Addition or Changes
 
<< Previous thread | Next thread >>
HOW TO SET 5 DIFFERNET ALARMS IN THE DIGITAL CLOCK PGM
Go to page  [1] 2 3
Moderators: Ajay, Junied , abbas1707, Arun Kumar V, pdi33, Shailesh NAYAK, ۞ TPS ۞, shyam, sashijoseph
Author Post
koushal.v.v
Sat Apr 21 2007, 10:49AM
 User Offline
Registered Member #298
Joined: Mon Jan 08 2007, 09:52AM

Posts: 8
Thanked 3 times in 3 posts
HI ,
i just want to know how to set 5 different alarms and store it in rtc ram location ,i am getting confused....




koushal.vv
Back to top

alarms   digital clock   pgm   rtc   



This post has been thanked 1 time
Ajay
Sun Apr 22 2007, 07:28AM
Rickey's World Admin

 User Offline

Registered Member #1
Joined: Fri Feb 24 2006, 04:56AM

Posts: 3745
Thanked 695 times in 654 posts
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.

www.rickeyworld.info
If you feel satisfied with the user's forum reply please click on the thank button.

Obey forum rules!
Respect others!
Back to top

24h   variables   alarm time   time is going   mov   



This post has been thanked 1 time
koushal.v.v
Thu Apr 26 2007, 06:03AM
 User Offline
Registered Member #298
Joined: Mon Jan 08 2007, 09:52AM

Posts: 8
Thanked 3 times in 3 posts
Rickey wrote ...

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.



sir can u tell me how to compare 5 different alarms
and where exactly r u ciomparing the actual time and alarm time

koushal.vv
Back to top

24h   alarm time   alarms   variables   time is going   



This post has been thanked 1 time
Ajay
Fri Apr 27 2007, 12:07AM
Rickey's World Admin

 User Offline

Registered Member #1
Joined: Fri Feb 24 2006, 04:56AM

Posts: 3745
Thanked 695 times in 654 posts
In the display RTC routine i am checking for the Alarm
CODE:

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.
CODE:

        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.

www.rickeyworld.info
If you feel satisfied with the user's forum reply please click on the thank button.

Obey forum rules!
Respect others!
Back to top

r1   mov   setb   chk   



This post has been thanked 1 time
koushal.v.v
Sun Apr 29 2007, 10:19AM
 User Offline
Registered Member #298
Joined: Mon Jan 08 2007, 09:52AM

Posts: 8
Thanked 3 times in 3 posts
thanks mr.RICKEY ( THE ONE )!!!

koushal.vv
Back to top



This post has been thanked 1 time
SGH
Sat May 05 2007, 09:16AM
 User Offline
Registered Member #672
Joined: Tue Mar 06 2007, 10:47PM

Posts: 38
Thanked 3 times in 3 posts
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


1178381810_672_FT730_cds1307.txt
Back to top



This post has been thanked 1 time
Ajay
Sun May 06 2007, 12:00AM
Rickey's World Admin

 User Offline

Registered Member #1
Joined: Fri Feb 24 2006, 04:56AM

Posts: 3745
Thanked 695 times in 654 posts
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.

www.rickeyworld.info
If you feel satisfied with the user's forum reply please click on the thank button.

Obey forum rules!
Respect others!
Back to top



This post has been thanked 2 times
 SGH , tienduhieu 
SGH
Tue May 08 2007, 10:09PM
 User Offline
Registered Member #672
Joined: Tue Mar 06 2007, 10:47PM

Posts: 38
Thanked 3 times in 3 posts
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

Back to top



This post has been thanked 1 time
Ajay
Wed May 09 2007, 12:23AM
Rickey's World Admin

 User Offline

Registered Member #1
Joined: Fri Feb 24 2006, 04:56AM

Posts: 3745
Thanked 695 times in 654 posts
wrote ...
CODE:
 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.

www.rickeyworld.info
If you feel satisfied with the user's forum reply please click on the thank button.

Obey forum rules!
Respect others!
Back to top



This post has been thanked 1 time
SGH
Wed May 30 2007, 08:26PM
 User Offline
Registered Member #672
Joined: Tue Mar 06 2007, 10:47PM

Posts: 38
Thanked 3 times in 3 posts
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
Back to top

8051 timer   DS1307 rtc   



This post has been thanked 1 time
Go to page  [1] 2 3  

Jump:     Back to top

Syndicate this thread: rss 0.92 Syndicate this thread: rss 2.0 Syndicate this thread: RDF
Powered by e107 Forum System

8051 Microcontroller Projects 8051 AVR tutorials PIC microcontroller, 8051 assembly language programming electronics and communication ECE CSE pdf ebooks library BE final year project ideas Embedded systems