Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

DS 1307 with 8051 assembly code (NO ALARMS) URGENT!!!!!!!!!

Status
Not open for further replies.

snehal_975

Newbie level 2
Joined
Jan 19, 2010
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
Pune
Activity points
1,313
HIiiiii
I need assembly code for DS 1307 with 8051 with display on lcd. Alarms not needed.I have my own code but it is showing garbage values.
PLS HELP ME
ITS URGENT!!!!!!!!!!!!!!!!!!!!!!!
Giving my code below----------






org 00h

SCL EQU P1.0 ;IN THIS EXAMPLE I USED PORT 1.0
SDA EQU P1.1 ;AND PORT 1.1 FOR THE I2C LINES

SEC EQU 64H
MIN EQU 65H
HOUR EQU 66H
DAY EQU 67H
DATE EQU 68H
MONTH EQU 69H
YEAR EQU 6AH

ljmp begin

org 100h
begin: ; writing 26th jan 2005 and time 15:50:27
lcall lcd1
lcall I2CSTART
MOV A,#0D0H
LCALL I2CSEND
MOV A,#00H
LCALL I2CSEND
MOV A,#27H
LCALL I2CSEND
MOV A,#50H
LCALL I2CSEND
MOV A,#15H
LCALL I2CSEND
MOV A,#03H
LCALL I2CSEND
MOV A,#26H
LCALL I2CSEND
MOV A,#01H
LCALL I2CSEND
MOV A,#05H
LCALL I2CSEND
LCALL I2CSTOP


READ: LCALL I2CSTART
MOV A,#0D0H
LCALL I2CSEND
MOV A,#00H
LCALL I2CSEND
LCALL I2CSTOP

READ7: LCALL I2CSTART
MOV A,#0D1H
LCALL I2CSEND
LCALL I2CREAD
MOV SEC,A
LCALL I2CREAD
MOV MIN,A
LCALL I2CREAD
MOV HOUR,A
LCALL I2CREAD
MOV DAY,A
LCALL I2CREAD
MOV DATE,A
LCALL I2CREAD
MOV MONTH,A
LCALL I2CREAD
MOV YEAR,A
LCALL I2CREAD
LCALL I2CSTOP

Display:
MOV A,HOUR ;DISPLAY HOURS
MOV B,#0AH
DIV AB
ADD A,#30H
LCALL DATASND

MOV A,B
ADD A,#30H
LCALL DATASND
MOV A,#':'
LCALL DATASND

MOV A,MIN ;DISPLAY MINUTES
MOV B,#0AH
DIV AB
ADD A,#30H
LCALL DATASND

MOV A,B
ADD A,#30H
LCALL DATASND
MOV A,#':'
LCALL DATASND

MOV A,SEC ;DISPLAY SECONDS
MOV B,#0AH
DIV AB
ADD A,#30H
LCALL DATASND

MOV A,B
ADD A,#30H
LCALL DATASND

MOV A,DATE
MOV B,#0AH
DIV AB
ADD A,#30H
LCALL DATASND

MOV A,B
ADD A,#30H
LCALL DATASND
MOV A,#'/'
LCALL DATASND

MOV A,MONTH ;
MOV B,#0AH
DIV AB
ADD A,#30H
LCALL DATASND

MOV A,B
ADD A,#30H
LCALL DATASND
MOV A,#'/'
LCALL DATASND

MOV A,YEAR
MOV B,#0AH
DIV AB
ADD A,#30H
LCALL DATASND

MOV A,B
ADD A,#30H
LCALL DATASND

RET


I2CSTOP:CLR SDA
LCALL RTCDELAY
SETB SCL
LCALL RTCDELAY
ORL C,/SCL ; this is for complementing and then oring
SETB SDA
LCALL RTCDELAY
ORL C,/SDA
RET


I2CSEND:MOV R2,#9
I2C_S2: RLC A
MOV SDA,C
LCALL RTCDELAY
SETB SCL
LCALL RTCDELAY
MOV C,SDA
CLR SCL
DJNZ R2,I2C_S2
RET

I2CREAD:MOV A,#0FFH
LCALL I2CSEND
RET

I2CSTART: setb sda
setb scl
lcall rtcdelay
clr sda
lcall rtcdelay
clr scl



lcd1: mov A,#38h ;2 LINES,5*7 MATRIX
lcall CMDSND
lcall delay
mov A,#0Eh ;DISPLAY ON,CURSER OFF
lCALL CMDSND
lcall delay
mov A,#01h ;CLEAR DISPLAY SCREEN
lCALL CMDSND
lcall delay
mov A,#06h ;CURSER SHIFT TO RIGHT
ACALL CMDSND
lcall delay
mov A,#83h ;CURSER ON FIRST LINE
ACALL CMDSND
lcall delay
ret


CMDSND:
MOV P2,A ;MOVE ACCUMULATOR DATA TO P2
clr P3.7 ;SELECT COMMAND REGISTER
clr P3.6 ;WRITE OPERTION
Setb P3.5 ;ENABLE PULSE
Clr P3.5
RET


DATASND:
MOV P2,A ;MOVE P2 DATA TO P2
Setb P3.7 ;SELECT DATA REGISTER
clr P3.6 ;WRITE OPERTION
Setb P3.5 ;ENABLE PULSE
Clr P3.5
RET

DELAY: mov R2,#250
HERE1: mov R3,#255
AGAIN: DJNZ R3,AGAIN
DJNZ R2,HERE1
RET

rtcdelay:
NOP
NOP
NOP
NOP
RET
end
 

Re: DS 1307 with 8051 assembly code (NO ALARMS) URGENT!!!!!

Hi,

check this attached code for DS1307 with 8051, and you can modify it according to your needs

hope this will help you

regards
bassa
 
To bassa;
Thanks for reply!
I tried this earlier but.......
My assembler not supporting Macro
 

Re: DS 1307 with 8051 assembly code (NO ALARMS) URGENT!!!!!

hi snehal, download your project from here www.free8051projects.blogspot.com under user request.

you can try using mide 8051 assembler which is also available in my site.

regards
kj

Added after 1 minutes:

the problem with your code is you didnt provide enough delay in writing data to lcd.
refer 8051 micro controller by mazidi.


regards
kj
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top