Discussion in "Project Help" started by    dez    Jan 7, 2008.
Tue Jan 15 2008, 11:51 pm
#31
dez please show me what you have done till now.. I will add things which are needed..!
Wed Jan 16 2008, 12:17 am
#32
;delay function

delay	macro	duration
			local waitf
			mov cx,duration
			loop waitf
			end m
			

			

; cursor function
cursor	macro	r,c
		
			mov	bh,00
			mov ah,02
			mov	dh,r
			mov dl,c
			int 10h
		
		endm


; display function
display macro	str
			mov ah,09h
			mov dx,offset str
			int 21h
		endm

.stack 64
.data

	;Seven Segment Table
	
	zero		db	3fh;		-   |	 -	-	| |	|-	|-	-|	|-|	|-|
	one			db	6;		   | |	|    _|	_|   -  |-  |_	-|	 -	 -
	two			db	5bh;		-	|   |_	_|	  |	 _| |_|	 |	|_|	 _|
	three		db	4fh
	four		db	66h
	five		db	6dh
	six			db	7dh
	seven		db	7
	eight		db	7fh
	nine		db	6fh
	
	speedCtr	db	?
	
	l1			db	'						Welcome									','$'
	l2			db  '			Press f to rotate clockwise							','$'
	l3			db  '		Press r to rotate counter-clockwise						','$'
	l4			db  '	You may adjust the speed by 'u' for up and 'd'for down		','$'
	l5			db  '	  You can see the motor speed on the 7-seg					','$'
	l6			db  '			Press q to quit the program							','$'
	
	
	
.code
		
		mov dx,378h				;parallel port initialization
		mov al,00h				;for writing data
		out dx,al
		; D7 is for forward D6 is for backward D5 is for enabling of dc motor with L293d
		
	main:
		mov	ax,@data
		mov	ds,ax
	
		clr
	
		cursor 2,6
		display l1
		cursor 4,6
		display l2
		cursor 6,6
		display l3
		cursor 8,6
		display l4
		cursor 10,6
		display l5
		cursor 12,6
		display l6
	
		cursor 16,6
	
		mov	[speedCtr],0
		 
	key_check:
		mov ah,07
		int	21h
		
		cmp al,'r'
		je	r_pressed
		cmp al,'f'
		je f_pressed
		cmp al,'u'
		je up_pressed
		cmp al,'d'
		je down_pressed
		cmp al,'q'
		je	quit
		jmp key_check

		
	r_pressed:
		delay 2;					wait for 2 seconds and then start rotating in reverse direction
		mov al,01000000b;			01100000B for reverse direction
		mov dx,378h
		out dx,al
		jmp	key_check

	
	f_pressed:
		delay 2;					Wait for 2 minutes and then start rotation forward direction
		mov al,10000000b;			10000000B for forward direction
		mov dx,378h
		out dx,al
		jmp	key_check

	
	down_pressed:
		add	[speedCtr],-1
		jmp	key_check

	
	up_pressed:
		add [speedCtr],1
		jmp	key_check


		
	quit:
		mov ah,4ch
		int 21h
		end	main
Wed Jan 16 2008, 12:21 am
#33

first i need to define a speedcontrol macro that will increase or decrease the speed when user push 'u' or 'd'.
secondly i need a 7seg function that will send the speed to 7segment which is stored in speedCtr
and thats all.
Wed Jan 16 2008, 12:28 am
#34

are you using x86 processor? :-s
Wed Jan 16 2008, 12:50 am
#35
yes
i m trying to write just a program in dos to control the peripherals. There is no microcontroller
Wed Jan 16 2008, 03:26 am
#36
i cant believe there are many step motor examples around the net
but there is no bloody dc motor by pwm example.
Wed Jan 16 2008, 09:44 am
#37
hmm... but i don't know much about x86 processors.. :-s
Wed Jan 16 2008, 10:16 pm
#38
can you write psuedo code?
Wed Jan 16 2008, 10:18 pm
#39
i can help you with 8051... if you can translate that..then will be possible i guess..
Thu Jan 17 2008, 01:49 am
#40
yes please

Get Social

Information

Powered by e107 Forum System

Downloads

Comments

Bobbyerilar
Thu Mar 28 2024, 08:08 am
pb58
Thu Mar 28 2024, 05:54 am
Clarazkafup
Thu Mar 28 2024, 02:24 am
Walterkic
Thu Mar 28 2024, 01:19 am
Davidusawn
Wed Mar 27 2024, 08:30 pm
Richardsop
Tue Mar 26 2024, 10:33 pm
Stevencog
Tue Mar 26 2024, 04:26 pm
Bernardwarge
Tue Mar 26 2024, 11:15 am