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.

Pls help me...This is My college miniproject

Status
Not open for further replies.

subinalex

Junior Member level 1
Joined
May 27, 2010
Messages
15
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
kattappana
Activity points
1,427
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:

Added after 2 minutes:

here is the 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

End
 

how about posting your circuit?

I would change these parts

Code:
;******************************************************* 
;LCD strobe subroutines 

ini: 
acall delay5ms
mov a,#38h 
acall command 
acall delay5ms
mov a,#38h 
acall command 
acall delay5ms
mov a,#38h 
acall command 
acall delay5ms
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: 
mov data,a 
clr rs 
clr rw 
setb en 
clr en 
push r7
mov r7,#40
djnz r7,$
pop r7
ret 

display: 
mov data,a 
setb rs 
clr rw 
setb en 
clr en 
push r7
mov r7,#40
djnz r7,$
pop r7
ret 

delay_5ms:
 push r6
 push r7
	mov	R6,#4
	nop
	nop
	mov	R7,#229
	nop
	nop
	nop
	djnz	R7,$-3
	djnz	R6,$-9
 pop r7
 pop r6
	RET

Added after 1 minutes:

if this doesn't work (at least a properly inited LCD) maybe you have a hardware issue
 

dude! you should change the bit definitions! according to the picture...

Code:
data equ p1
busy equ p1.7
rs equ p2.0 ; here
rw equ p2.1 ; here too!
en equ p2.2 ; and here!
bzr equ p0.2
ledf equ p0.0
ledb equ p0.1

maybe this fix your problem...
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top