Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Pls help me...This is My college miniproject

Status
Not open for further replies.

subinalex

New Member
friends,
I am doing a project on metrotrain.It stops at three stations with a time delay. it has two stepper motors one to drive train forward and the other to open/close the door.It also has an LCD module with it.MY PROBLEM STARTS RYT WITH LCD..this crap is not working.

I burned the code which i got somewhere from net...when i burned it ..all i could see was the 2nd row of LCD with some black squares..actually it shudda displayed station names.
I verified my circuit again and again....found its ok....but the hell is tht am not gettin output..// THIS JUNE 10 is the last date for pjt submission...ALL OTHERS ARE FINISHED....me no improvmt yet....pls help am ATTACHING the ENTIRE CODE HERE

PLS HELP MEEEE...DEAR PPLLLLL:cry:
 
and heres the code dear people.....
data equ p1
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 'Roorkee','0'
show4: db 'Saharanpur','0'
Show5: db 'Meerut','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
acall stepperf ;TRAIN MOTOR RUNS

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
acall delay10
acall stepperf ;TRAIN MOTOR RUNS

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
acall delay10
acall stepperb ;DOOR MOTOR

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
acall delay10
acall stepperb ;DOOR MOTOR


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 ;make accumulator 11111111
loopb:
mov b,#0ffh ;make b register offh
loopa: djnz b,loopa
djnz 0e0h,loopb ;0e0h means accumulator(11111111..)decrsd,..
djnz r0,loopr
pop p1 ;p1 becomes 0
pop p0 ;p0 becomes 0
pop 01h
pop 00h
pop acc

ret

;dlay stepper
delays:
push acc
push 00h
push 01h
push p0
push p1

mov a,#0ffh
loopa1: mov b,#0fh
loopb1: djnz b,loopb1
djnz 0e0h,loopa1
pop p1
pop p0
pop 01h
pop 00h
pop acc
ret


delay10:
mov tmod,#01h
mov tcon,#00h
mov tl0,#0f0h
mov th0,#0f8h
setb tr0
no: jnb tf0,no
clr tr0
clr tf0
ret
;=============== Routine to read data from prog mem

read:
next: clr a
movc a,@a+dptr
cjne a,#'0',aga
sjmp down
aga: acall display
inc dptr
sjmp next
down:
ret
;================ stepper routine

stepperf:
push acc
push p1
mov a,#88h
mov r1,#04h
loop1: mov r0,#0e0h
loop: mov p2,a
acall delays
rr a ;rotate right acc ie..lsb becomes msb
djnz r0,loop
djnz r1,loop1
pop p1
pop acc
ret

stepperb:
push acc
push p1
mov a,#88h
mov r1,#04h
loop12:
mov r0,#0e0h
loop0: mov p2,a
acall delays
rl a ;msb to lsb rotate left of acc
djnz r0,loop0
djnz r1,loop12
pop p1
pop acc
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 data,a
clr rs
clr rw
setb en
clr en
ret

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

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

End
 
Hi Subinalex, welcome to the forum.
First, wrap your code....

Code:
data equ p1
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 'Roorkee','0'
show4: db 'Saharanpur','0'
Show5: db 'Meerut','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
acall stepperf ;TRAIN MOTOR RUNS

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
acall delay10
acall stepperf ;TRAIN MOTOR RUNS

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
acall delay10
acall stepperb ;DOOR MOTOR

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
acall delay10
acall stepperb ;DOOR MOTOR


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 ;make accumulator 11111111
loopb:
mov b,#0ffh ;make b register offh
loopa: djnz b,loopa
djnz 0e0h,loopb ;0e0h means accumulator(11111111..)decrsd,..
djnz r0,loopr
pop p1 ;p1 becomes 0
pop p0 ;p0 becomes 0
pop 01h
pop 00h
pop acc

ret

;dlay stepper
delays:
push acc
push 00h
push 01h
push p0
push p1

mov a,#0ffh
loopa1: mov b,#0fh
loopb1: djnz b,loopb1
djnz 0e0h,loopa1
pop p1
pop p0
pop 01h
pop 00h
pop acc
ret


delay10:
mov tmod,#01h
mov tcon,#00h
mov tl0,#0f0h
mov th0,#0f8h
setb tr0
no: jnb tf0,no
clr tr0
clr tf0
ret
;=============== Routine to read data from prog mem

read:
next: clr a
movc a,@a+dptr
cjne a,#'0',aga
sjmp down
aga: acall display
inc dptr
sjmp next
down:
ret
;================ stepper routine

stepperf:
push acc
push p1
mov a,#88h
mov r1,#04h
loop1: mov r0,#0e0h
loop: mov p2,a
acall delays
rr a ;rotate right acc ie..lsb becomes msb
djnz r0,loop
djnz r1,loop1
pop p1
pop acc
ret

stepperb:
push acc
push p1
mov a,#88h
mov r1,#04h
loop12:
mov r0,#0e0h
loop0: mov p2,a
acall delays
rl a ;msb to lsb rotate left of acc
djnz r0,loop0
djnz r1,loop12
pop p1
pop acc
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 data,a
clr rs
clr rw
setb en
clr en
ret

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

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

Can you post the circuit you built as well?
It'll help the analysis on the program.
 
Last edited:
hey heres ckt

hey bro...actually lcd rs,en,rw are ar p3 in code...not as in pic here...rest all same..i have attached
 

Attachments

  • 1140-221258-metrockt1.jpg
    1140-221258-metrockt1.jpg
    137.5 KB · Views: 326
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top