Академический Документы
Профессиональный Документы
Культура Документы
In this report we described about Naïve Digital Synchronizer (NDS) a dedicated device made
for keeping track of time, date, weeks day, cycle of our RUET’s academic routine, Day of the
cycle, and whole electrical department routine. It also scrolls right to left the name,
designation, mobile number and email address of our project supervisor MD. Sohel Rana,
Lecturer, Dept. of EEE, RUET. We also described about user manual of this device and its part by
part description.
i
Acknowledgement
We the group-4, MD. Al Muhid Shihab, Tanvir Hussain, Nura Alam Shamol, Ashrafun Naher
Pinky and Ahmad Rushd gratefully acknowledge the guidance provided by the project
supervisor MD. Sohel Rana, Lecturer, Dept. of EEE, RUET throughout the development of the
project.
We also thank MD. Syduzzaman Shahin, EEE-061058 and Sheikh Alauddin, IPE for providing
various encouragement, help and support during the development of the project.
ii
Candidate’s Declaration:
We hereby declare that this project report titled “Naïve Digital Synchronizer (NDS)” submitted towards
the completion of 5th semester Electronic Shop Practice Course no. EEE-300 of B.Sc. Eng. in Rajshahi
University of Engineering and Technology (RUET) is an academic record of our work carried under
Lecturer MD. Sohel Rana, Dept. of EEE, RUET.
Date: 05.07.09
Place: Kajla, Rajshahi, Bangladesh.
X X
S.M Al Muhid Shihab, EEE'06-061041 Tanvir Hussain Bappi,EEE'06-061049
X X
MD. Nura Alam, EEE'06-061050 Ashrafun Naher Pinky, EEE'06-061051
X
Ahmad Rushd, EEE'06-061052
Certificate:
This is to certify that the above declaration made by S.M. Al Muhid Shihab, Tanvir Hussain Bappi, MD.
Nura Alam , Ashrafun Naher Pinky and Ahmad Rushd is true to the best of my knowledge and belief.
Date:
Place: Kajla, Rajshahi, Bangladesh
X
MD. Sohel Rana
Lecturer,Dept. of EEE, RUET
iii
Table of Contents:
Chapter Title Page
1 Introduction 1
2 Full Design Concept
10 Glossary of terms 71
11 Bibliography 72
iv
List of Figures:
Name of the Figure Page
Figure 2.1: Basic Full circuit block diagram of NDS 2
Figure 1.2: Full program Conceptual Block Diagram 3
Figure 2.2: Block diagram for Keyboard input 4
Figure 2.3: Emergency Power Backup system's block diagram 5
Figure 3.1: Full circuit Schematic 6
Figure 3.2: Schematic of Keyboard 7
Figure 4.1: Power Backup Circuit Schematic 8
Figure 4.2: 20*4 character LCD 8
Figure 4.3: Diode Real Picture(Right) and its electrical symbol (Left) 11
Figure 4.4: Voltage Regulator 7805 11
Figure 4.5: Zener diode's real picture (Left) and its electrical symbol (Right) 12
Figure 4.6: Relay internal Connection and its real picture 12
Figure 4.7: Crystal's real picture (Left) and its electrical symbol (Right) 12
Figure 4.8: Switch 13
Figure 4.9: 9V Battery 13
Figure 4.10: 9V Battery Connector 13
Figure 5.1: PCB Design of main Circuit Board from opposite to soldering side 16
Figure 5.2: PCB Design of Keyboard from opposite to soldering side 16
Figure 7.1: AVR Studio Processor for Microcontroller 18
Figure 7.2: AVR Studio 4 Starting, Selecting the Assembler 18
Figure 9.1: NDS Display Familiarization 69
Figure 9.2: Keyboard Familiarization 69
v
Naïve Digital Synchronizer 1
Chapter-01
Introduction
In RUET we know that the routine is exclusively followed by different procedure i.e. the cycle day
method. Sometimes it becomes difficult specially after vacation to locate the cycle-day. So we
invented a device which will synchronize our whole RUET’s Academic Routine and time. This device
will show time, date, weeks day, Cycle day, and Cycle no. It also will show the Routine and the name,
designation, mobile no. and email address of the person who owns the device. The name of this
device is Naive digital Synchronizer. “Naïve” because it is the first version of this device as well as
the firmware also at initial stage. “Digital” because everything here are computed and done digitally
and “Synchronizer” because it synchronizes our whole RUET’s academic routine as well as time. For
the completion for our project we are using microcontroller ATmega32. Because using this, the
circuit complexity will reduce to a great minimum level. For the development of our firmware for
ATmega32 we used assembly language. Because everyone knows that for any time critical firmware
it is the best solution to use assembly language. The top engineers of renowned company also
prescribe this. The program written in assembly language runs faster, takes less space than same
program written in other language. How strong your compiler is, it does not matter, no other
programming language can write strong and efficient program as assembly language, whether it is
avr-gcc, betterfly-c, image craft or bascom. For display purpose we used 20×4 character LCD because
it is compact display and saves power. For input we used matrix keyboard. Here we also have
emergency power backup system.
Our experience says that what we are going to do will take much space in flash memory. So we must
have to use such a microcontroller which has large Flash memory. For this reason we used
ATmega32 which has 32KB flash momory.
Naïve Digital Synchronizer 2
Chapter-02
Full Design Concept
Chapter-03
Full Circuit Schematic
Keyboard Connection:
Chapter-04
Circuit Description
A. LCD:
To activate LCD, to write anything on it we must have to first initialize it. For this purpose we have to
send some control command to
the LCD, which includes telling the
LCD about what font size, no. of
lines, cursor will be visible or not,
blinking or underscore, shift the
display or not, work in 8bit mode
or 4bit mode etc. the LCD control
command are given below:
Entry Mode:
0 0 0 0 0 1 I/D S
I/D: Increment/Decrement Cursor bit. If set, the cursor will be post-incremented after any read data
or write data operation. If cleared, the cursor will be post-decremented.
S: If set, the whole display will be shifted, depeding on I/D: If I/D and S are set, the display will be
shifted to the left, if I/D is cleared (S set), the display will be shifted to the right. Usually I/D = 1, S = 0
is used (increment cursor, don't shift display).
Display On/Off:
0 0 0 0 1 D C B
D: Display On/Off. If set, the display is turned on. When the display is turned off, character data
remains unchanged.
B: Cursor blink on/off. If this bit is set, the cursor will blink as a black block. Otherwise the cursor is
shown as an underscore _.
Shift Cursor/Display:
0 0 0 1 S/C R/L x x
S/C: If set, the display is shifted. If cleared, the cursor is shifted. The direction depends on R/L.
R/L: If set, the display/cursor is shifted to the right. If cleared, it's shifted to the left.
Function Set:
0 0 1 DL N F x x
DL: Interface length. If set, 8-bit mode is selected (as in this example). If cleared, 4 bit mode is
selected.
N: Number of display lines. If cleared, the LCD is a one line display. If set, the display is in 2/4 line
mode.
F: Font size. If cleared, 5x7 Font is selected. If set, 5x10 font is selected.
0 1 ACG
ACG is the Address to be set for Character Generator Ram access. The CG can be used to configure
and show custom characters.
Naïve Digital Synchronizer 10
1 ADD
ADD is the address to be set for Display Data Ram access. The display data ram holds the data
displayed (the characters). See below for DD Ram organisation.
BF ADD
If the command register is read, the value actually returned by the LCD is the DD Ram Address (bits
0..6) and the busy flag (bit 7). THe busy flag should be read after every command to achieve max
speed. If the busy flag is set, the controller is still busy executing a command/writig data.
The display controller has to offer a way of addressing all display characters which works for ALL
kinds of displays. That's why the rows don't follow each other. The rows start at fixed addresses:
Display size 1st row 2nd row 3rd row 4th row
Nx8 $00 - $07 $40 - $47 x x
N x 16 $00 - $0F $40 - $4F $10 - $1F $50 - $5F
N x 20 $00 - $13 $40 - $53 $14 - $27 $54 - $67
Of course this list is not complete, but it shows some mean details about using a 16 x 4 display: The
first address of the second row is bigger than the first address of the third row!
Example: For setting the cursor to the 3rd character of the second row in a 16 x 2 display, write 0x42
| 0b10000000 to the display command register.
LCD connection:
D7 -- -- D7 of m32
D6 -- -- D6 of m32
D5 -- -- D5 of m32
D4 -- -- D4 of m32
RS -- -- D3 of m32
R/W -- -- Gnd
VDD -- -- +5V
V0 -- -- Gnd
Naïve Digital Synchronizer 11
Vss -- -- Gnd
LED+ -- -- +5V
LED- -- -- Gnd
E -- -- D2 of m32
B. Diode-1N4007:
The 1N4007 diode here is being used for prevent any reverse current comes from point B to A when
main power is off (Figure 4.1) and B to C when Backup power is off(Figure 4.2). Here maximum
reverse voltage is 5V and the 1N4007 has capability of preventing reverse voltage of about 1000V.
D. Zener Diode:
Here the zener diode we used
for protection purpose, so that if
the input voltage rises more that
5.6V it will be clipped at this
level. As a result our device will
not damage for over voltage.
Figure 4.5: Zener diode's real picture (Left) and its electrical
E. Relay: symbol (Right)
circuit, but in our schematic we used Figure 4.6: Relay internal Connection and its real
connection 3 and 5. At this time no voltage picture
comes to the input point of voltage regulator 7805 IC. When main power is off 3 and 5 is short
circuited and 9V battery finds a path to supply to the input of 7805 IC.
F. Crystal:
Figure 4.7:Crystal's real picture (Left) and its electrical symbol (Right)
Here we used a 4.00MHz crystal for more specific time, and it is connected to the ATmega32 to the
pin 11 and 12, XTAL1 and XTAL2.
Naïve Digital Synchronizer 13
G. Switch:
Here we are using push to make switch as in any keyboard this type of switch is used. This switch
short circuits when it is pushed and open circuited when it is released. We also used two Stay put
switch for stopping the Cycle’s Day, for controlling main power supply and for controlling the power
supply from battery.
H. 9V Battery:
In our project to maintain the time when main power goes off we are using a
9V battery. A nine-volt battery, sometimes referred to as a PP3 battery, is
shaped as a rounded rectangular prism and has a nominal output of nine
volts. Its nominal dimensions are 48 mm × 25 mm × 15 mm (ANSI standard
1604A). In this type of battery normally no Ah rating is written, so we can’t
say how long this battery will last. Figure 4.9: 9V Battery
I. 9V Battery connector:
To connect the battery to the main circuit we are using a 9V battery connector.
not more than 4ms For safety we will take here 10ms that we need backup to reach power from
battery to main power point B. (Figure 4.1)
P=5×.3
P=1.5Watt … … … … (i)
Energy, W = Pt
W = 1.5 × 10ms
This power must come from a capacitor. We know energy stored in capacitor is
1
W = ×C×V2 … … … …(iii)
2
Or, C = 200µF
Power, P = V×I
P = 5.6×.3
P = 1.68 Watt
1.68×24×30
In one month = KW-hour
1000
=1.2096 KW-hour
Naïve Digital Synchronizer 15
A = [2.6×M-.2]+D+Y+[Y/4]+[C/4]-2C … … …(iv)
Here,
M = number of month
D = number of Date
C = 1st two digits of a year
Y = last two digits of a year
Code of Month:
Month Mar Apr May Jun Jul Aug Sep Oct Nov Dec Jan Feb
Code 1 2 3 4 5 6 7 8 9 10 11 12
Code of Day:
It has to be note that for January and February We have to calcutate using the previous year that is if
the year is 2000 then we have to calculate using year 1999.
Example:
Here,
D = 24
M =9
C =19
Y =75
A = [2.6×9-0.2]+24+75+[75/4]+[19/4]-(2×19)
= 23+24+75+18+4-38=106
Code = A%7 = 1; threrefor “Monday”
Naïve Digital Synchronizer 16
Chapter-05
Printed Circuit Board (PCB)
Figure 5.1: PCB Design of main Circuit Board from opposite to soldering side
Chapter-06
Component List and Sources
In this project we used various kinds of parts. Below we are giving a table containing details cost of
this project. As we are using MCU so our circuit has reduced to so much easy. Though the circuit has
reduced the complexity of the program has increased. So the cost has also reduced at a great
amazing level.
Source:
TELECOM SPARES
36/9, Hossain Market, Patuatuly
Dhaka-1100
Website: www.tsparesbd.com
Email: humayun_ts@yahoo.com
HOSSAIN ELECTRONICS
S.L. Shopping Plaza, Rani Bazar
Rajshahi
Mobile-01556312856
Naïve Digital Synchronizer 18
Chapter-07
Assembler and Simulator
As assembler and simulator here we used AVR-Studio. After Writing the program we debugged it,
assembled it and everything has been done with this software then we simulated this program on
this software. As downloader to download hex file we used stk200 programmer and bascom.
Chapter-08
Conclusion and Future Scope
This project can be further enriched by adding here a rechargeable battery power backup system
instead of fixed battery. More Application can be added in this project such as Alarm Clock, Sound,
Stop watch and many other things, in that case bigger character LCD or Graphic LCD must be used.
The whole academic calendar and other vacation of RUET can be included here. If here a more
advanced keyboard and program are used then any kind of massage, mobile no. email address as
well as any kind of information such as Result or CGPA can be saved here in the EEPROM of the
microcontroller. Further Research Can be done to reduce power consumption.
Naïve Digital Synchronizer 20
Appendix-A
Datasheet
In the upcoming some pages datasheet of ATmega32,Voltage regulator IC 7805, Relay, Diode
1N4007 and are given from original source without any modification.
i. Datasheet of ATmega32:
Naïve Digital Synchronizer 21
ii.Datasheet of MR6247:
Naïve Digital Synchronizer 22
Naïve Digital Synchronizer 23
iii.Datasheet of LM7805:
Naïve Digital Synchronizer 24
Naïve Digital Synchronizer 25
v.Datasheet of LCD:
Naïve Digital Synchronizer 27
Appendix-B
Full Program
;***********************************************************
;* Project Name:Naive Digital Synchronizer (NDS) *
;* Written by:Group 4 *
;* Date:11.06.2009 *
;* Version: 1.00 *
;* For AVR: ATmega32 *
;* Clock Frequency: 4.00MHz *
;* Group Members:061041,061049,061050,061051,061052 *
;* Al Muhid Shihab, Tanvir Hussain, Nura Alam, Ashrafun Naher *
;* Ahamad Rushd *
;* Rajshahi University of Engineering and Technology(RUET) *
;* EEE’06-A section *
;***********************************************************
; This program is free software: you can redistribute it and/or modify
; it under the terms of the GNU General Public License as published by
; the Free Software Foundation, either version 3 of the License, or
; (at your option) any later version.
; You should have received a copy of the GNU General Public License
; along with this program. If not, see <http://www.gnu.org/licenses/>.
; N.B. Comment is not well described.
;
;latest update of this program can be found on “the-xenox.yolasite.com”
;***********including header file for atmega32*******
.include "m32def.inc"
;**********defining registers.***********************
.def today =r1
.def second =r2
.def min =r3
.def hour =r4
.def ampm =r5
.def cycle =r6
.def date =r7
.def seven =r8
.def f_digit =r9
.def s_digit =r10
.def yearl =r11
.def zero =r12
.def ten =r13
Naïve Digital Synchronizer 28
mov month,general
ldi general,0x09
mov yearl,general
;****************************************************
ldi general, 0x00 ;Day starting at 'A' day
mov c_day,general
;****************************************************
ldi general, 0x06 ;Cycle starting at "06"
mov cycle,general
;***************************************************
ldi general, low(RAMEND)
out SPL, general
ldi general, high(RAMEND)
out SPH, general
;###############SRAM initialization####################
clr yh
ldi yl,0x90 ;Period code 0 means first code
ldi general,0
st y,general
clr yh
ldi yl,0x91 ;scroll counter
ldi general,0
st y,general
;0x92 = temporary subcode
;0x93 = temporary roomcode
;###################################################
rcall LCD_init ;initialize lcd. it needs initialization only for once
ldi general,0b11000111 ;Porta.0,porta.1,porta.2=output
out ddra,general ;porta.3,porta.4,porta.5=input
nop
sbi porta,0 ;set bit 0 in porta
nop
;**************Writing our Credit to LCD*******************
ldi control, 0x00|0x80 ;cursor in 1st row first column
rcall lcdcontrol
ldi zh,high(2*credit1) ;Writing to lcd the Designation
ldi zl,low(2*credit1)
ldi xl,20 ;xl as counter
credit1x:
lpm general,z+
rcall LCD_write
dec xl
brne credit1x
ldi control, 0x40|0x80 ;cursor in 2nd row first column
rcall lcdcontrol
Naïve Digital Synchronizer 30
cur:
ldi zh,high(2*_count)
ldi zl,low(2*_count)
clc
add zl,xh
adc zh,zero
lpm yh,z
mov control,yh
rcall lcdcontrol
rcall LCD_delay
rjmp sd
;************count decreasing*******************
deccount:
rcall _30ms ;for debouncing 30ms
dec xh
cpi xh,0 ;compare it to 0
breq setcur0
rjmp cur0
setcur0:
ldi xh,12
cur0:
ldi zh,high(2*_count)
ldi zl,low(2*_count)
clc
add zl,xh
adc zh,zero
lpm yh,z
mov control,yh
rcall lcdcontrol
rcall LCD_delay
rjmp sd
;***********30 ms delay unit*************
_30ms:
;200ms
ldi control,100
mor:
rcall LCD_delay
dec control
brne mor
nop
ret ;completes here
inccountx:
rjmp inccount
set_done:
rcall _30ms
Naïve Digital Synchronizer 32
rcall LCD_delay
ldi zh,high(2*_count)
ldi zl,low(2*_count)
clc
add zl,xh
adc zh,zero
lpm yh,z
mov control,yh
rcall lcdcontrol
ldi control, 0x0f ;cursor visible and blinking
rcall lcdcontrol
;read eeprom
rcall makeadd ;address in general
push yh ;don't touch yh, never ever!
clr yh
mov yl,general
push general ;save the address
rcall eeprom_read ;code in general
ldi yl,0x92
st y,general ;store subcode
pop general
inc general
mov yl,general
rcall eeprom_read ;code in general
ldi yl,0x93
st y,general ;store room code
pop yh
sd: ;set/done button check
rcall _30ms
sbi porta,0
nop
in general,pina ;checking for left button pressed?
andi general,$09 ;0000 1001
cpi general,$09
breq inccountx
in general,pina ;checking for right button pressed?
andi general,$11 ;0001 0001
cpi general,$11
breq deccount
in general,pina ;checking for done button pressed?
andi general,$21 ;0010 0001
cpi general,$21
breq start1x
cbi porta,0
nop
Naïve Digital Synchronizer 33
sbi porta,1
nop
in general,pina ;checking for checking for increament button
andi general,$0a ;pressed?
cpi general,$0a ;0000 1010
breq incment
in general,pina ;checking for decreament button pressed
andi general,$22 ;0010 0010
cpi general,$22
breq decment
cbi porta,1
nop ;0001 0100 ;14
sbi porta,2
nop
in general,pina ;checking for save button pressed
andi general,$14
cpi general,$14
breq savex
cbi porta,2
nop
rjmp sd
savex:
rjmp save
start1x:
rjmp start1
incment: ;the section for increamenting
cpi yh,$15|$80 ;is cursor on hour box?
breq inchour ;if yes then jump to inc hour section
cpi yh,$18|$80
breq incmin ;jump to inc min section
cpi yh,$1b|$80
breq incsecond
cpi yh,$1c|$80
breq incampm ;considering the ampm
cpi yh,$26|$80
breq inccycle
cpi yh,$55|$80
breq incday
cpi yh,$58|$80
breq incmonth
cpi yh,$5d|$80
breq incyearl
cpi yh,$63|$80
breq inccday
cpi yh,$40|$80 ;inc period
Naïve Digital Synchronizer 34
breq incperiod
cpi yh,$4a|$80 ;inc subject
breq incsub
cpi yh,$53|$80 ;inc room
breq incroom
rjmp sd ;if no maches found then jump to sd
inchour:
rjmp inchourx
incmin:
rjmp incminx
incsecond:
rjmp incsecondx
incampm:
rjmp incampmx
inccycle:
rjmp inccyclex
incday:
rjmp incdayx
incmonth:
rjmp incmonthx
incyearl:
rjmp incyearlx
inccday:
rjmp inccdayx
incperiod:
rjmp incperiodx
incsub:
rjmp incsubx
incroom:
rjmp incroomx
decment:
cpi yh,$15|$80 ;is cursor on hour box?
breq dechour ;if yes then jump to inc hour section
cpi yh,$18|$80
breq decmin ;jump to inc min section
cpi yh,$1b|$80
breq decsecond
cpi yh,$1c|$80
breq decampm ;considering the ampm
cpi yh,$26|$80
breq deccycle
cpi yh,$55|$80
breq decday
cpi yh,$58|$80
breq decmonth
Naïve Digital Synchronizer 35
cpi yh,$5d|$80
breq decyearl
cpi yh,$63|$80
breq deccday
cpi yh,$40|$80 ;dec period
breq decperiod
cpi yh,$4a|$80 ;dec subject
breq decsub
cpi yh,$53|$80 ;dec room
breq decroom
rjmp sd ;if no maches found then jump to sd
dechour:
rjmp dechourx
decmin:
rjmp decminx
decsecond:
rjmp decsecondx
decampm:
rjmp decampmx
deccycle:
rjmp deccyclex
decday:
rjmp decdayx
decmonth:
rjmp decmonthx
decyearl:
rjmp decyearlx
deccday:
rjmp deccdayx
decperiod:
rjmp decperiodx
decsub:
rjmp decsubx
decroom:
rjmp decroomx
save: ;for saving in eeprom
push yh
rcall _30ms ;for debouncing
rcall makeadd ;will make a address depending on period and day
mov control,general ;address in general
clr yh
ldi yl,0x92 ;subcode
ld general,y ;read the subcode from SRAM
mov yl,control
rcall eeprom_write
Naïve Digital Synchronizer 36
incminx:
inc min
mov general,min
cpi general,60 ;compare minute to 60
breq setmin
minsetted:
ldi control, 0x17|$80 ;now moving the cursor just 1 bit ahead.
rcall lcdcontrol
mov split,min ;split min
rcall section ;split it in two part to write LCD
mov general,f_digit
rcall LCD_write
mov general,s_digit
rcall LCD_write
ldi control, 0x18|$80 ;now moving the cursor to the init position
rcall lcdcontrol
rcall _30ms
rjmp sd
setmin:
ldi general,$01
mov min,general
rjmp minsetted
;*****************end of inc min section********************
incsecondx:
inc second
mov general,second
cpi general,60 ;compare second to 60
breq setsecond
secondsetted:
ldi control, 0x1a|$80 ;now moving the cursor just 1 bit ahead.
rcall lcdcontrol
mov split,second ;split min
rcall section ;split it in two part to write LCD
mov general,f_digit
rcall LCD_write
mov general,s_digit
rcall LCD_write
ldi control, 0x1b|$80 ;now moving the cursor to the init position
rcall lcdcontrol
rcall _30ms
rjmp sd
setsecond:
ldi general,$01
mov second,general
rjmp secondsetted
Naïve Digital Synchronizer 38
ldi control, 0x26|$80 ;now moving the cursor to the init position
rcall lcdcontrol
rcall _30ms
rjmp sd
setcycle:
ldi general,$01
mov cycle,general
rjmp cyclesetted
;**************end of cycle setted************************
incdayx:
inc day
mov general,day
cpi general,31 ;compare day to 31
breq setday
daysetted:
ldi control, 0x54|$80 ;now moving the cursor just 1 bit ahead.
rcall lcdcontrol
mov split,day ;split min
rcall section ;split it in two part to write LCD
mov general,f_digit
rcall LCD_write
mov general,s_digit
rcall LCD_write
ldi control, 0x55|$80 ;now moving the cursor to the init position
rcall lcdcontrol
rcall _30ms
rjmp sd
setday:
ldi general,$01
mov day,general
rjmp daysetted
;**************end of day setted************************
incmonthx:
inc month
mov general,month
cpi general,13 ;compare month to 13
breq setmonth
monthsetted:
ldi control, 0x57|$80 ;now moving the cursor just 1 bit ahead.
rcall lcdcontrol
mov split,month ;split min
rcall section ;split it in two part to write LCD
mov general,f_digit
rcall LCD_write
mov general,s_digit
Naïve Digital Synchronizer 40
rcall LCD_write
ldi control, 0x58|$80 ;now moving the cursor to the init position
rcall lcdcontrol
rcall _30ms
rjmp sd
setmonth:
ldi general,$01
mov month,general
rjmp monthsetted
;**************end of month setted************************
incyearlx:
inc yearl
mov general,yearl
cpi general,41 ;compare month to 13
breq setyearl
yearlsetted:
ldi control, 0x5c|$80 ;now moving the cursor just 1 bit ahead.
rcall lcdcontrol
mov split,yearl ;split min
rcall section ;split it in two part to write LCD
mov general,f_digit
rcall LCD_write
mov general,s_digit
rcall LCD_write
ldi control, 0x5d|$80 ;now moving the cursor to the init position
rcall lcdcontrol
rcall _30ms
rjmp sd
setyearl:
ldi general,$01
mov yearl,general
rjmp yearlsetted
;***************end of yearl increase*******************
inccdayx:
inc c_day
mov general,c_day
cpi general,5 ;compare cycle day to 5
breq setc_day
c_daysetted:
ldi control, 0x63|$80 ;Cursor will be in the same position
rcall lcdcontrol
ldi zh,high(2*c_dayx)
ldi zl,low(2*c_dayx)
clc
add zl,c_day
Naïve Digital Synchronizer 41
adc zh,zero
lpm general,z
rcall LCD_write
ldi control, 0x63|$80 ;now moving the cursor to the init position
rcall lcdcontrol
rcall _30ms
rjmp sd
setc_day:
ldi general,$00
mov c_day,general
rjmp c_daysetted
;****************set the period*******************************
incperiodx:
push yh ;save yh for cursor movement
clr yh
ldi yl,$90
ld general,y
inc general
cpi general,9
breq speriod
periods:
clr yh
ldi yl,$90
st y,general
ldi zh,high(2*pcode)
ldi zl,low(2*pcode)
ldi control,3
mul control,general
clc
add zl,r0
adc zh,zero
ldi xl,3
pback:
lpm general,z+
rcall LCD_write
dec xl
brne pback
ldi control, 0x40|$80 ;now moving the cursor to the init position
rcall lcdcontrol
rcall _30ms
pop yh
rjmp sd
speriod:
clr general
rjmp periods
Naïve Digital Synchronizer 42
;****************inc subject********************************
incsubx:
push yh
clr yh
ldi yl,0x92
ld general,y
inc general
cpi general,47 ;total subject 47 subcode-->0-46
breq sscode
sscodes:
clr yh
ldi yl,0x92
st y,general ;temorarily save subcode
;read subcode
ldi zh,high(2*subcode)
ldi zl,low(2*subcode)
ldi control,3
mul general,control
clc
add zl,r0
adc zh,zero
ldi xl,3
ldi control, 0x48|$80 ;now moving the cursor just 1 bit ahead.
rcall lcdcontrol
back1s:
lpm general,z+
rcall LCD_write
dec xl
brne back1s
ldi control, 0x4a|$80 ;now moving the cursor just 1 bit ahead.
rcall lcdcontrol
pop yh
rcall _30ms
rjmp sd
sscode:
ldi general,0
rjmp sscodes
;****************inc room code********************************
incroomx:
push yh
clr yh
ldi yl,0x93
ld general,y
inc general
cpi general,16 ;total room 16 subcode-->0-15
Naïve Digital Synchronizer 43
breq rcode
rcodes:
clr yh
ldi yl,0x93
st y,general ;temorarily save rcode
;read subcode
ldi zh,high(2*room)
ldi zl,low(2*room)
ldi control,3
mul general,control
clc
add zl,r0
adc zh,zero
ldi xl,3
ldi control, 0x51|$80 ;now moving the cursor just 1 bit ahead.
rcall lcdcontrol
rback:
lpm general,z+
rcall LCD_write
dec xl
brne rback
ldi control, 0x53|$80 ;now moving the cursor just 1 bit ahead.
rcall lcdcontrol
pop yh
rcall _30ms
rjmp sd
rcode:
ldi general,0
rjmp rcodes
;****************##################***************************
;**********start of decreasing section***********************
dechourx:
dec hour
mov general,hour
cpi general,-1 ;compare hour to -1
breq nsethour
nhoursetted:
ldi control, 0x14|$80 ;now moving the cursor just 1 bit ahead.
rcall lcdcontrol
mov split,hour ;split hour
rcall section ;split it in two part to write LCD
mov general,f_digit
rcall LCD_write
mov general,s_digit
rcall LCD_write
Naïve Digital Synchronizer 44
ldi control, 0x15|$80 ;now moving the cursor to the init position
rcall lcdcontrol
rcall _30ms
rjmp sd
nsethour:
ldi general,12
mov hour,general
rjmp nhoursetted
;*****************end of inc hour section********************
decminx:
dec min
mov general,min
cpi general,-1 ;compare minute to 60
breq nsetmin
nminsetted:
ldi control, 0x17|$80 ;now moving the cursor just 1 bit ahead.
rcall lcdcontrol
mov split,min ;split min
rcall section ;split it in two part to write LCD
mov general,f_digit
rcall LCD_write
mov general,s_digit
rcall LCD_write
ldi control, 0x18|$80 ;now moving the cursor to the init position
rcall lcdcontrol
rcall _30ms
rjmp sd
nsetmin:
ldi general,59
mov min,general
rjmp nminsetted
;*****************end of inc min section********************
decsecondx:
dec second
mov general,second
cpi general,-1 ;compare second to 60
breq nsetsecond
nsecondsetted:
ldi control, 0x1a|$80 ;now moving the cursor just 1 bit ahead.
rcall lcdcontrol
mov split,second ;split min
rcall section ;split it in two part to write LCD
mov general,f_digit
rcall LCD_write
mov general,s_digit
Naïve Digital Synchronizer 45
rcall LCD_write
ldi control, 0x1b|$80 ;now moving the cursor to the init position
rcall lcdcontrol
rcall _30ms
rjmp sd
nsetsecond:
ldi general,59
mov second,general
rjmp nsecondsetted
;*****************end of inc second section********************
decampmx:
dec ampm
mov general,ampm
cpi general,-1 ;compare ampm to 2
breq nsetampm
nampmsetted:
ldi control, 0x1c|$80 ;Cursor will be in the same position
rcall lcdcontrol
ldi zh,high(2*_ampm)
ldi zl,low(2*_ampm)
ldi xl,0x2 ;xl as counter
ldi general,0x2
mul general,ampm ;result is in r1:r0
clc
add zl,r0
adc zh,zero
ntodayx1:
lpm general,z+
rcall LCD_write
dec xl
brne ntodayx1
ldi control, 0x1c|$80 ;now moving the cursor to the init position
rcall lcdcontrol
rcall _30ms
rjmp sd
nsetampm:
ldi general,$01
mov ampm,general
rjmp nampmsetted
;*****************end of inc ampm section********************
deccyclex:
dec cycle
mov general,cycle
cpi general,-1 ;compare cycle to 14
breq nsetcycle
Naïve Digital Synchronizer 46
ncyclesetted:
ldi control, 0x25|$80 ;now moving the cursor just 1 bit ahead.
rcall lcdcontrol
mov split,cycle ;split cycle
rcall section ;split it in two part to write LCD
mov general,f_digit
rcall LCD_write
mov general,s_digit
rcall LCD_write
ldi control, 0x26|$80 ;now moving the cursor to the init position
rcall lcdcontrol
rcall _30ms
rjmp sd
nsetcycle:
ldi general,$13
mov cycle,general
rjmp ncyclesetted
;**************end of cycle setted************************
decdayx:
dec day
mov general,day
cpi general,-1 ;compare day to 31
breq nsetday
ndaysetted:
ldi control, 0x54|$80 ;now moving the cursor just 1 bit ahead.
rcall lcdcontrol
mov split,day ;split min
rcall section ;split it in two part to write LCD
mov general,f_digit
rcall LCD_write
mov general,s_digit
rcall LCD_write
ldi control, 0x55|$80 ;now moving the cursor to the init position
rcall lcdcontrol
rcall _30ms
rjmp sd
nsetday:
ldi general,30
mov day,general
rjmp ndaysetted
;**************end of day setted************************
decmonthx:
dec month
mov general,month
cpi general,-1 ;compare month to 13
Naïve Digital Synchronizer 47
breq nsetmonth
nmonthsetted:
ldi control, 0x57|$80 ;now moving the cursor just 1 bit ahead.
rcall lcdcontrol
mov split,month ;split min
rcall section ;split it in two part to write LCD
mov general,f_digit
rcall LCD_write
mov general,s_digit
rcall LCD_write
ldi control, 0x58|$80 ;now moving the cursor to the init position
rcall lcdcontrol
rcall _30ms
rjmp sd
nsetmonth:
ldi general,12
mov month,general
rjmp nmonthsetted
;**************end of month setted************************
decyearlx:
inc yearl
mov general,yearl
cpi general,8 ;compare month to 13
breq nsetyearl
nyearlsetted:
ldi control, 0x5c|$80 ;now moving the cursor just 1 bit ahead.
rcall lcdcontrol
mov split,yearl ;split min
rcall section ;split it in two part to write LCD
mov general,f_digit
rcall LCD_write
mov general,s_digit
rcall LCD_write
ldi control, 0x5d|$80 ;now moving the cursor to the init position
rcall lcdcontrol
rcall _30ms
rjmp sd
nsetyearl:
ldi general,9
mov yearl,general
rjmp nyearlsetted
;***************end of yearl increase*******************
deccdayx:
dec c_day
mov general,c_day
Naïve Digital Synchronizer 48
brne npback
ldi control, 0x40|$80 ;now moving the cursor to the init position
rcall lcdcontrol
rcall _30ms
pop yh
rjmp sd
nsperiod:
ldi general,8
rjmp nperiods
;***************dec subject********************************
decsubx:
push yh
clr yh
ldi yl,0x93
ld general,y
dec general
cpi general,-1 ;total subject 47 subcode-->0-46
breq nsscode
nsscodes:
clr yh
ldi yl,0x93
st y,general ;temorarily save subcode
;read subcode
ldi zh,high(2*subcode)
ldi zl,low(2*subcode)
ldi control,3
mul general,control
clc
add zl,r0
adc zh,zero
ldi xl,3
ldi control, 0x48|$80 ;now moving the cursor just 1 bit ahead.
rcall lcdcontrol
nback1s:
lpm general,z+
rcall LCD_write
dec xl
brne nback1s
ldi control, 0x4a|$80 ;now moving the cursor just 1 bit ahead.
rcall lcdcontrol
pop yh
rcall _30ms
rjmp sd
nsscode:
Naïve Digital Synchronizer 50
ldi general,46
rjmp nsscodes
;********************dec room code*************************
decroomx:
push yh
clr yh
ldi yl,0x93
ld general,y
dec general
cpi general,-1 ;total room 16 subcode-->0-15
breq nrcode
nrcodes:
clr yh
ldi yl,0x93
st y,general ;temorarily save rcode
;read subcode
ldi zh,high(2*room)
ldi zl,low(2*room)
ldi control,3
mul general,control
clc
add zl,r0
adc zh,zero
ldi xl,3
ldi control, 0x51|$80 ;now moving the cursor just 1 bit ahead.
rcall lcdcontrol
nrback:
lpm general,z+
rcall LCD_write
dec xl
brne nrback
ldi control, 0x53|$80 ;now moving the cursor just 1 bit ahead.
rcall lcdcontrol
pop yh
rcall _30ms
rjmp sd
nrcode:
ldi general,15
rjmp nrcodes
;*******************###########******************************
set_donex:
rjmp set_done
dec xl
tst xl
breq _yearl
rjmp _x
month4:
inc month
ldi day,0x1
rjmp _yearl
_30feb:
cpi month,0x2 ;is february
brne jump ;no it is not then go to yearl
inc month ;yes it is february, then inc month
ldi day,0x1 ;inc day to 01
jump:
rjmp _yearl
_isfeb:
cpi month,0x2 ;is february?
breq c_lp_year ;if yes, then is leap year?
rjmp _yearl
not_l_year: ;not leap year
inc month
ldi day,0x1
rjmp _yearl
c_lp_year:
ldi zh,high(2*l_year)
ldi zl,low(2*l_year)
ldi xl,0x8 ;For loop 8 times
xx:
lpm general,z+ ;load program memory to general
cp yearl,general
breq _yearl ;Yes leap year and branch
dec xl
tst xl ;testing xl if it is zero?
breq not_l_year ;if equal to zero then branch.
rjmp xx
_yearl:
cpi month,13
brne c_day_calc
ldi month,0x1
inc yearl
c_day_calc: ;what day it is calcualtion starting.
mov c_month,month
cpi c_month,0x3
brlo fejan ;select month code
subi c_month,0x2
Naïve Digital Synchronizer 54
rjmp calculate
fejan:
add c_month,ten
dec yearl
calculate:
ldi zh,high(2*_c_day)
ldi zl,low(2*_c_day)
mov general,c_month
clc
add zl,general ;increamenting z pointer as c_month
adc zh,zero
lpm ;load program memory
add r0,day ;[2.6m-0.2]+d+c
add r0,yearl ;[2.6m-0.2]+d+y+c
mov general,yearl
lsr general
lsr general ;divide by 4 of yearl
add r0,general ;[2.6m-0.2]+d+y+[y/4]+c
mov general,r0
subi general,40 ;[2.6m-0.2]+d+y+[y/4]+c+[c/4]-40, c=20
brmi minus ;if result is minus then branch
cp general,seven
brge plus ;branch if greater than six
mov today,general ;if inbetween 0-6 then direct jump to bar calc.
rjmp _bar
minus:
add general,seven
brmi minus
mov today,general
rjmp _bar ;now it is not minus
plus:
sub general,seven
cp general,seven ;compare between seven and general
brge plus ;branch if general>=seven
mov today,general
rjmp _bar
_bar:
mov c_month,month
cpi c_month,0x3
brlo _fejan ;select month code
rjmp _now
_fejan:
inc yearl
_now:
brtc LCD_show ;Moving day to today
Naïve Digital Synchronizer 55
brne pm
;load the x low register for dec
am:
lpm general,z+
rcall LCD_write
dec xl
brne am
rjmp loop1
pm:
adiw zl,0x2
pm2:
lpm general,z+
rcall LCD_write
dec xl
brne pm2
rjmp loop1
loop1:
ldi general,0xff
rcall LCD_write
ldi zh,high(2*_cycle) ;Writhing to lcd the name cycle
ldi zl,low(2*_cycle)
ldi xl,0x6
cyc:
lpm general,z+
rcall LCD_write
dec xl
brne cyc
;Now writing cycle number
mov split,cycle ;split hour
rcall section ;write to LCD
mov general,f_digit
rcall LCD_write
mov general,s_digit
rcall LCD_write
;*********now move cursor to fourth line first char******
rcall LCD_delay
ldi control, 0x54|0x80 ;fourth row 1st character
rcall lcdcontrol
;now write date
mov split,day ;split day
rcall section ;write to LCD
mov general,f_digit
rcall LCD_write
mov general,s_digit
rcall LCD_write
Naïve Digital Synchronizer 57
ldi general,'-'
rcall LCD_write
mov split,month ;split day
rcall section ;write to LCD
mov general,f_digit
rcall LCD_write
mov general,s_digit
rcall LCD_write
ldi general,'-'
rcall LCD_write
ldi general,'2'
rcall LCD_write
ldi general,'0'
rcall LCD_write
mov split,yearl ;split day
rcall section ;write to LCD
mov general,f_digit
rcall LCD_write
mov general,s_digit
rcall LCD_write
ldi general,0xff
rcall LCD_write
;*********Writing LCD date is complete here***********
ldi zh,high(2*_dayx) ;Writhing to lcd the name of day
ldi zl,low(2*_dayx)
ldi xl,0x4
dayx:
lpm general,z+
rcall LCD_write
dec xl
brne dayx
ldi zh,high(2*c_dayx) ;Writhing to lcd the Day
ldi zl,low(2*c_dayx)
add zl,c_day
adc zh,zero
lpm general,z
rcall LCD_write
;Writing LCD the today name
;*************************************************
ldi general,0xff
rcall LCD_write
ldi zh,high(2*_today) ;Writing to lcd today name day
ldi zl,low(2*_today)
ldi xl,0x3 ;xl as counter
ldi general,0x3
Naïve Digital Synchronizer 58
showpcode:
ldi control, 0x40|0x80
Naïve Digital Synchronizer 59
rcall lcdcontrol
ldi zh,high(2*pcode)
ldi zl,low(2*pcode)
ldi general,3
clr yh
ldi yl,$90
ld control,y ;Read from SRAM
mul control,general
clc
add zl,r0
adc zh,zero
ldi xl,3
back:
lpm general,z+
rcall LCD_write
dec xl
brne back
;finish writing
;********writing subject label**************
ldi zh,high(2*sublabel)
ldi zl,low(2*sublabel)
ldi xl,5
back0:
lpm general,z+
rcall LCD_write
dec xl
brne back0
;**********making of address**********
rcall makeadd
push general ;save address
;read eeprom
clr yh
mov yl,general
rcall eeprom_read ;code in general
;read subcode
ldi zh,high(2*subcode)
ldi zl,low(2*subcode)
ldi control,3
mul general,control
clc
add zl,r0
adc zh,zero
ldi xl,3
back1:
lpm general,z+
Naïve Digital Synchronizer 60
rcall LCD_write
dec xl
brne back1
;writing room label
ldi zh,high(2*lroom)
ldi zl,low(2*lroom)
ldi xl,6
back2:
lpm general,z+
rcall LCD_write
dec xl
brne back2
pop general ;getting the address back
inc general ;--> next address
;read room code from eeprom
clr yh
mov yl,general
rcall eeprom_read ;code in general
ldi zh,high(2*room)
ldi zl,low(2*room)
ldi control,3
mul general,control
clc
add zl,r0
adc zh,zero
ldi xl,3
back3:
lpm general,z+
rcall LCD_write
dec xl
brne back3
;time synchronization-not necessary
rcall scroll
;time synchronization-put here
ldi xl,5
ag1:
rcall LCD_delay
dec xl
brne ag1
ldi general,0xff
mov delay1,general
mov delay1,general
ldi xl,8
floop:
dec delay1
Naïve Digital Synchronizer 61
brne floop
dec delay2
brne floop
dec xl
brne floop
rcall scroll
;exact timing
rcall LCD_delay
rcall LCD_delay
ldi xl,4
ldi general,133
mov delay1,general
exact:
dec delay1
brne exact
dec xl
brne exact
;time synchronization-put here
ldi general,0xff
mov delay1,general
mov delay1,general
ldi xl,8
sloop:
dec delay1
brne sloop
dec delay2
brne sloop
dec xl
brne sloop
;completed 1s
rjmp start
;End of main Program
;#####################################################
;***********address making******************
makeadd:
push yh
clr yh ;first clear yh
ldi yl,0x90 ;period on address hex 90
ld general,y
ldi control,2
mul general,control ;necessary result in r0
ldi zh,high(2*daybonus)
ldi zl,low(2*daybonus)
mov general,c_day
clc
Naïve Digital Synchronizer 62
add zl,general
adc zh,zero
lpm general,z ;day bonus found
add general,r0 ;desired address of eeprom in general for sub.
pop yh
ret
;***********************************************
scroll: ;function for scrolling
clr yh
ldi yl,0x91
ld general,y
push general
cpi general,21
brlo less20
cpi general,66
brge finishx
rjmp greater20
finishx:
rjmp finish
less20:
ldi control,0x13
sub control,general
ori control,0x80
rcall lcdcontrol
ldi zh,high(2*desig)
ldi zl,low(2*desig)
pop xl
push xl
inc xl
back5:
lpm general,z+
rcall LCD_write
dec xl
brne back5
pop general
inc general
clr yh
ldi yl,$91
st y,general
ret
greater20:
ldi control,$00|$80
rcall lcdcontrol
ldi zh,high(2*desig)
ldi zl,low(2*desig)
Naïve Digital Synchronizer 63
pop general
push general
subi general,20
clc
add zl,general
adc zh,zero
ldi xl,20
back6:
lpm general,z+
rcall LCD_write
dec xl
brne back6
pop general
inc general
clr yh
ldi yl,$91
st y,general
ret
finish:
ldi control,$00|$80
rcall lcdcontrol
ldi zh,high(2*desig)
ldi zl,low(2*desig)
pop general
push general
subi general,20
clc
add zl,general
adc zh,zero
ldi general,108
pop control
push control
sub general,control
cpi general,20
brge fixed20
mov xl,general
rjmp back7
fixed20:
ldi xl,20
back7:
lpm general,z+
rcall LCD_write
dec xl
brne back7
pop general
Naïve Digital Synchronizer 64
inc general
cpi general,108
breq setcounter
countersetted:
clr yh
ldi yl,$91
st y,general
ret
setcounter:
ldi general,0
rjmp countersetted
;###################################################
eeprom_write: ;address on y
sbic eecr,eewe ;data on general register
rjmp eeprom_write
out eearh,yh
out eearl,yl
out eedr,general
sbi eecr,eemwe
sbi eecr,eewe
ret
eeprom_read: ;data will be get back on general
sbic eecr,eewe
rjmp eeprom_read
out eearh,yh
out eearl,yl
sbi eecr,eere
in general,eedr
ret
;***************function:section***********************
section:
ldi general,$0
mov howmtimes,general ;set howmtimes to zero
mov divideby,general ;set divideby to zero
sectionx:
sub split,divideby ;substract divideby from split
cpi split,$a ;compare with 10
brlo result ;branch if less than 10,goto result
add split,divideby ;now add divideby to split
add divideby,ten ;increase divideby value by 10
inc howmtimes ;increase howmtimes
rjmp sectionx ;relative jump to sectionx
result:
ldi zh,high(2*digit) ;conver binary to ASCII of seconds
ldi zl,low(2*digit) ;first digit
Naïve Digital Synchronizer 65
add zl,howmtimes
adc zh,zero
lpm f_digit,z
ldi zh,high(2*digit) ;conver binary to ASCII of seconds
ldi zl,low(2*digit) ;second digit
add zl,split
adc zh,zero
lpm s_digit,z
ret
;**************end of section function********************
;************LCD delay time*******************************
LCD_delay: ;2ms delay takes 8000 cycle
ldi general,0x0b
mov delay1,general
ldi general,0x60 ;divide by 255
mov delay2,general
loop:
dec delay2
brne loop ;total 3 cycle
dec delay1
brne loop
ret
;***************end of LCD_delay*************************
;********Tell LCD to work in 4bit mode*******************
lcd_commandbit: ;used for init (we need some 8-bit commands to switch to 4-
bit mode!)
ldi general,0b00100000
out portd, general
sbi portd, LCD_E ;now strobe E
nop
nop
nop
cbi portd, LCD_E
nop
rcall LCD_delay
ret
;***********end of 4bit mode set function****************
;************function for writing LCD********************
LCD_write:
mov rawdata,general
cbr rawdata,0b00001111
sbr rawdata,0b00001000 ;making RS high for writing
out portd,rawdata
sbi portd, LCD_E ;now strobe E
nop
Naïve Digital Synchronizer 66
nop
nop
cbi portd, LCD_E
nop
swap general
mov rawdata,general
cbr rawdata,0b00001111
sbr rawdata,0b00001000 ;making RS high for writing
out portd,rawdata
sbi portd, LCD_E ;now strobe E
nop
nop
nop
cbi portd, LCD_E
nop
rcall LCD_delay
ret
;**********End of LCD_write Function*********************
;**************LCD_control function**********************
lcdcontrol:
mov rawdata,control
cbr rawdata,0b00001111
out portd,rawdata
sbi portd, LCD_E ;now strobe E
nop
nop
nop
cbi portd, LCD_E
nop
swap control
mov rawdata,control
cbr rawdata,0b00001111
out portd,rawdata
sbi portd, LCD_E ;now strobe E
nop
nop
nop
cbi portd, LCD_E
nop
rcall LCD_delay
ret
;************end lcd control*************************
;**************LCD_initialization function***********
LCD_init:
rcall LCD_delay ;first, we'll tell the LCD that we want to use it in 4-bit mode.
Naïve Digital Synchronizer 67
rcall LCD_commandbit ;LCD is still in 8-BIT MODE while writing this command!!!
ldi control, 0x28 ;NOW: 4 lines, 5*7 font, 4-BIT MODE!
rcall lcdcontrol ;
ldi control, 0x0c ;now proceed as usual: Display on, cursor not blinking
rcall lcdcontrol ;also not visitble
ldi control, 0x01 ;clear display, cursor -> home
rcall lcdcontrol
ldi control, 0x06 ;auto-inc cursor
rcall lcdcontrol
ret
;*******************end of LCD_initialization function***********************
l_year: ;for leap year
.db 12,16,20,24,28,32,36,40
_m4: ;for apr,june,sept,novem.
.db 4,6,9,11
_c_day: ;[2.6m-0.2] value for ease
.db 0,7,10,12,15,17,20,23,25,28,30,33,36,0
digit:
.db '0','1','2','3','4','5','6','7','8','9'
_ampm: ;writing ampm to lcd
.db "AMPM"
_cycle:
.db "Cycle-"
c_dayx:
.db 'A','B','C','D','E','0'
_dayx:
.db "DAY-"
_today:
.db "SUNMONTUEWEDTHUFRISAT0"
_count:
.db
0,$40|$80,$4a|$80,$53|$80,$15|$80,$18|$80,$1b|$80,$1c|$80,$26|$80,$55|$80,$58|$80,$5d|$
80,$63|$80,0
credit1:
.db "This Project made by"
credit2:
.db " EEE'06 - A Section "
members1:
.db "Shihab,Tanvir,Shamol"
members2:
.db " Pinky and Rushd "
pcode:
.db "1st2nd3rd4th5th6th7th8th9th "
sublabel:
.db ":EEE- "
Naïve Digital Synchronizer 68
daybonus:
.db 0,22,44,66,88,0
subcode:
.db
"10110219010310415115220021121222122220121321423323425125225325430031131232132234
1351352301302313314350361371372381382400461462481482463465466 "
lroom:
.db " ROOM:"
room:
.db "304305306307217MLEMLWECLEMLELLEILPELMTLEWLCMLN/A"
.org $0cff
dseg:
.db " MD.SOHEL RANA,LECTURER,Dept. of EEE,RUET,MOBILE-01725431631
Email:sohel_ieee@yahoo.com "
;eeprom image
.eseg ;initial value of routine is set to zero
A:
.db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
B:
.db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
C:
.db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
D:
.db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
E:
.db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Naïve Digital Synchronizer 69
Appendix-C
User Manual
NDS Familiarization:
Subject Code
Scrolling designation
Period no.
Time Room no.
Date Cycle no.
Weeks Day
Save in EEPROM
Move Cursor Right
Increase Value
Set/Done
Move Cursor Left
Stop C_day Counting Decrease Value
Keyboard Familiarization:
In this keyboard in total we have 8 button. But here we are using 7 button and one is reserved for
future use and compatibility. For any change first we have to press the Set/Done button. The key
and is used for moving the Cursor on LCD left or Right. ↑ and ↓is used for increasing or
decreasing value where the cursor lies. If in vacation we want to stop the Cycle Day counting then
we have to press ones the Stop C_Day button. To Save Routine we have to press the Save button.
After Completion we have to press Set/Done button again.
It is not Applicable. As the NDS will automatically findout the Day by its own algorithm.
We just have to press the Stop C_Day button to stop the C_day before vacation. After coming back
from vacation we will have to release the button again pressiang it. But here you have to increase it
manually one day to update yourself with routine.
N/A:
If no period is going to held then the set the room no. to N/A position. This will indicate that no class
is going to held at that time.
Naïve Digital Synchronizer 71
Chapter-10
Glossary of Terms
http://en.wikipedia.org/wiki/Simulation
Hex file - Intel HEX is a file format for conveying binary information for applications like
programming microcontrollers, EPROMs, and other kinds of chips. It is one of the oldest file
formats available for this purpose, having been in use since the 1970s.
The format is a text file, with each line containing hexadecimal values encoding a sequence
of data and their starting offset or absolute address.
http://en.wikipedia.org/wiki/.hex
STK200 - The STK200 Flash MCU Starter Kit is a complete low-cost evaluation system for the Atmel’s
8-bit FLASH microcontrollers made by AVR technology.
Naïve Digital Synchronizer 72
Chapter-11
Bibliography
Books:
Internet Links:
[1]. www.scribd.com
[2]. www.atmel.com
[3]. www.avr-asm-tutorial.net/avr-en/
[4]. www.alldatasheet.com
[5]. www.datasheetcatalog.com
[6]. www.avrfreaks.net
[7]. http://attiny.com/
[8]. http://avr-asm.tripod.com/
[9]. http://www.avr-asm-download.de/
[10]. http://www.avrbeginners.net/
[11]. http://www.aimscientific.com/products/projects.htm