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.

urgent help regarding Metro train prototype using atmel

Status
Not open for further replies.

ppoonamk

Newbie level 3
Joined
Jan 7, 2010
Messages
4
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,332
ImageShack® - Online Photo and Video Hosting
This is the circuit diagram of the project im working on. I have a few queries.
1) My Leds connected to P0.0 and P0.1 are not glowing. Is the resistance value too high?
2) The lcd backlight glows but no characters are displayed.
3) Are the 2 reset pins required if you are not using interrupts in your program?
This is my code.. Are there any errors?


busy equ p1.7
rs equ p3.5
rw equ p3.4
en equ p3.3
bzr equ p0.2
ledf equ p0.0
ledb equ p0.1

org 400h

show0: db 'Welcome To All','0'
show1: db 'Current Station','0'
show2: db 'Next Station','0'
show3: db 'Zurich','0'
show4: db 'Milan','0'
Show5: db 'Paris','0'

org 0000h
ajmp main

org 0003h
test: mov c,p3.2
jnc halt
setb bzr
reti
halt:
clr bzr ;till zero blow on the bzr
ajmp test

main:
mov ie,#00h
setb ea
setb ex0
here:
mov p2,#00h
acall ini
mov dptr,#show0
acall read
clr ledf ;p1.0
acall delay

mov a,#01h
acall command; Now make memory clear cursor home
mov dptr,#show1
acall read
setb ex0
mov a,#0c0h
acall command
mov dptr,#show3
acall read
acall delay ;Stopage1 time 3 sec rookee
acall delay
clr bzr
acall delay

mov a,#01h
acall command
mov dptr,#show2
acall read
mov a,#0c0h
acall command
mov dptr,#show4
acall read
setb bzr
acall delay10

mov a,#01h
acall command
mov dptr,#show1
acall read
mov a,#0c0h
acall command
mov dptr,#show4
acall read
acall delay ;Stopage2 time 3 sec shsar
acall delay
clr bzr
acall delay

mov a,#01h
acall command
mov dptr,#show2 ;display ne
acall read
mov a,#0c0h
acall command
mov dptr,#show5
acall read
setb bzr


mov a,#01h
acall command
mov dptr,#show1
acall read
mov a,#0c0h
acall command
mov dptr,#show5
acall read

acall delay ;Stopage2 time 3 sec Meerut
acall delay
clr bzr
acall delay

setb ledf ; p1.0 ;off led at p1.0 for forward journey
clr ledb ; p1.1 ; 0n Led for back ward journey

mov a,#01h
acall command
mov dptr,#show2 ;display ne shar
acall read
mov a,#0c0h
acall command
mov dptr,#show4
acall read
setb bzr

mov a,#01h
acall command
mov dptr,#show1
acall read
mov a,#0c0h
acall command
mov dptr,#show4
acall read
acall delay ;Stopage2 time 3 sec shsar
acall delay
clr bzr
acall delay

mov a,#01h
acall command
mov dptr,#show2 ;display ne roor
acall read
mov a,#0c0h
acall command
mov dptr,#show3
acall read
setb bzr

mov a,#01h
acall command
mov dptr,#show1
acall read
mov a,#0c0h
acall command
mov dptr,#show3
acall read
setb ledb ;p1.1
ljmp here
;routine for stepper motor
; Delay Routine ;one sec delay
delay:
push acc
push 00h
push 01h
push p0
push p1
mov r0,#0eh
loopr:
mov a,#0ffh
loopb:
mov b,#0ffh
loopa: djnz b,loopa
djnz 0e0h,loopb
djnz r0,loopr
pop p1
pop p0
pop 01h
pop 00h
pop acc
ret


;=============== Routine to read data from prog mem

read:
nex: clr a
movc a,@a+dptr
cjne a,#'0',aga
sjmp down
aga: acall display
inc dptr
sjmp next
down:
ret ;LCD strobe subroutines

ini: mov a,#38h
acall command
mov a,#38h
acall command
mov a,#38h
acall command
mov a,#38h
acall command
mov a,#0eh
acall command
mov a,#06h
acall command
mov a,#01h
acall command
mov a,#80h
acall command
ret

command:
acall ready
mov p1,a
clr rs
clr rw
setb en
clr en
ret

display:
acall ready
mov p1,a
setb rs
clr rw
setb en
clr en
ret

ready:
clr en
mov p1,#0ffh
clr rs
setb rw
wait: clr en
setb en
jb busy,wait
clr en
Ret

End
 

Thanks! What about the LCD? The backlight glows.. Does that mean my connections and soldering is right and that theres just a problem with either the code or I haven't burned the code properly
 

LCD .... do you see boxes in them... adjust the contrast pot so that you can see the boxes and the text......

It is always good to use a pull up resistor for every port pin and especially for LCD......

---------- Post added at 09:07 ---------- Previous post was at 09:06 ----------

the LCD initialise sequence should be 30, 38, 01, 06, 0f and 80.....
 

Hey i just see the boxes on 1 line. No text :( i am using a potentiometer. The other line has no boxes either
 

do a reset of microcontroller using the reset switch 2 or 3 times and see if you get output... or else change the LCD.

its better you ground the pin for rw in lcd and remove rw related code . after every command to lcd give a sufficient delay of 200 or 500 msecs.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top