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.

Errors in Car Park System program in Assembly

Status
Not open for further replies.

saeedakhan

Junior Member level 1
Joined
Mar 1, 2005
Messages
15
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,283
Activity points
1,407
Car Park System

I want to design a Car Park System For 100 Cars. I have Written The Program In Assymbly For 89C51 Microcontroller. But This Program Does not Work. Anybody Can Help Me That What's The Error In This Program.
In This Program P3.4 Is For TImer0 External Input And P1.0 For Driving Garage Door Controlling Motor.

Org 001H
Mov Tmod,#02H
Mov THo,#-100
Setb TRo
Out: Jnb P3.4,Out
Clr TFo
Setb P1.0
End
 

Car Park System

Are you sure you can load a negative value in the TH0 register of Timer 0 ???

I Know it isn't much help, but check that out.

Regards

Helder Silva
 

Re: Car Park System

HelderS said:
Are you sure you can load a negative value in the TH0 register of Timer 0 ???

YES he CAN load a negative value in TH0. -100 in decimal means 9C hex (156 decimal)

As I understand he want to count the number of cars that get in or leave out the garage and drive a motor.
For this he decided to use timer 0 and external input (that it's the timer will count external pulses, maybe one for each car).
Thus, he set the timer for 8-bit auto-reload, but he forgot to set for counter operation by setting bit C/T
MOV TMOD, #06H

Setting reload TH0 with -100 it's correct because the timer will start counting from decimal 156 and oveflow 100 counts later, which is correct for his application.
But after starting timer 0, SETB TR0, he waits in a loop until timer input P3.4 goes to 1 logic.
Because he didn't use timer interrupts, he should wait for timer overflow when TF0 is set.
Thus instead
Out: JNB P3.4, Out
he should write
Out: JNB TF0, Out


But I believe that lead time for home work has passed and teacher gave him another one.

zpc said:
why not use PIC or other MCU????

This isn't nice behaviour earning points this way. Be constructive zpc. Don't spam !
 

Re: Car Park System

It must be TH0 and TL0
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top