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.

help,any teacher here? Just a simply question!

Status
Not open for further replies.

johnny01hk

Junior Member level 1
Joined
Apr 8, 2010
Messages
19
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,432
I want to develop assembler program for a DC motor.
Actullay, I have no concept how to wirte it.
So any one can teach me?

The concept as below:
I will have two input into the IC (may be the P1.0 and P1.1),
The input will be a digital signal.

When P1.0 Input signal is 1.
Then Will have output, It may be P2.5,
And it will output 5second times 5V signal to the motor.

In other ways, The P1.1 will be the same,
But the output is P2.6.

Any one can help me or teach me?
My msn is pimepime01hk@yahoo.com.hk
And I live in HongKong,
A electronics engeering student.
Thx
 

P1.0 and P2.0 indicate 8051 microcontroller ..
If so:

Code:
       MCS-51 Family Macro Assembler   A S E M - 5 1   V 1.3
       =====================================================



	Source File:	p10_p21.txt
	Object File:	p10_p21.hex
	List File:	p10_p21.lst



 Line  I  Addr  Code            Source

    1:				; INPUT CLOCK VALUE IN MEGAHERTZ...: 11.0592
    2:				; WANTED TIME DELAY IN MICROSECONDS: 60000000
    3:				; PROCESSOR CYCLE TIME (12)....... : 1085 ns
    4:				; TOTAL REQUIRED CYCLES........... : 55296000
    5:				; TOTAL TIME (INCLUDING CALL)..... : 60000.0 mS
    6:
    7:	  0000			START:
    8:	  0000	C2 A0			CLR	P2.0		; motor output "L" ..
    9:
   10:	  0002	30 90 FD		JNB	P1.0, $		; read P1.0, if not "H" stay here ..
   11:	  0005	75 F0 FF		MOV	B, #0FFh
   12:	  0008	D5 F0 FD		DJNZ	B, $		; wait a while ..
   13:
   14:	  000B	D2 A0			SETB	P2.0		; set P2.0 output to "H" ..
   15:
   16:	  000D	7C 02			MOV R4,#2		; set delay for 60s ..
   17:	  000F	7B A6			MOV R3,#166
   18:	  0011	7A DF			MOV R2,#223
   19:	  0013	79 75			MOV R1,#117
   20:
   21:	  0015			TT1:
   22:	  0015	D9 FE			DJNZ R1,TT1
   23:
   24:	  0017	20 90 06		JB	P1.0, Stop_Motor	; read P1.0 and if not "L" set motor output "L" ..
   25:
   26:	  001A	DA F9			DJNZ R2,TT1
   27:	  001C	DB F7			DJNZ R3,TT1
   28:	  001E	DC F5			DJNZ R4,TT1
   29:
   30:	  0020			Stop_Motor:
   31:
   32:	  0020	C2 A0			CLR	P2.0
   33:	  0022	02 00 00		LJMP	START
   34:
   35:				END
   36:

                     no errors

To start the ball rolling, have a look at the above code ..
Anything can be done to it, but at least there is a starting point ..

Rgds,
IanP
:D

Code:
; INPUT CLOCK VALUE IN MEGAHERTZ...: 11.0592 
; WANTED TIME DELAY IN MICROSECONDS: 60000000 
; PROCESSOR CYCLE TIME (12)....... : 1085 ns 
; TOTAL REQUIRED CYCLES........... : 55296000 
; TOTAL TIME (INCLUDING CALL)..... : 60000.0 mS 

START:
	CLR	P2.0		; motor output "L" ..

	JNB	P1.0, $		; read P1.0, if not "H" stay here .. 
	MOV	B, #0FFh
	DJNZ	B, $		; wait a while ..

	SETB	P2.0		; set P2.0 output to "H" ..

	MOV R4,#2		; set delay for 60s ..
	MOV R3,#166 
	MOV R2,#223 
	MOV R1,#117 

TT1:
	DJNZ R1,TT1

	JB	P1.0, Stop_Motor	; read P1.0 and if not "L" set motor output "L" ..

	DJNZ R2,TT1 
	DJNZ R3,TT1 
	DJNZ R4,TT1

Stop_Motor:

	CLR	P2.0
	LJMP	START

END
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top