Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
04/06/06 19:00
Read: times


 
#113762 - And then formatted
Responding to: ???'s previous message
;Name: .asm
; By Edgardo Gonzalez

; This Program takes input from port 1 from a quadrant shaft encoder
; to increment or decrement a variable for use elsewhere. Here the variable


; *****************************Equates*******************************
echo	equ	p1.0	;Equates "echo" to address p3.0
init	equ	p1.1	;Equates "init" to address p3.1

; ***************************Main Program****************************

	org	00
	mov	TMOD,#01H	;Use both timers ... T0=16 Bit timer mode T1=13 Bit timer mode
	lcall	INTB		;Allows sensor to finish internal blanking

MAIN:	mov	R0,#10		;Sets how many times R0 is going to repeate
	clr	init
;	mov	P3,#0

LOOP:	mov	TH1,#00		;Sets the timer
	mov	TL1,#00		;;;;; to zero
	setb	TR1		;Starts the Timer 1
	setb	init		;Sends out the pulse
WAIT2:	jnb	echo,wait2	;Waits untill there is a return signal
	clr	TR1		;Stops Timer 1
	clr	init		;Stops sending the pulse
	clr	TF1		;Clears the overflow flag in Timer 1
	mov	R1,TH1
	mov	p1,r1
	ret

; *******************************Sub Routines************************

INTB:	mov	TH0,#-04H	;Set the timer for approximitly
	mov	TL0,#-0F8H
	setb	TR0		;Starts Timer 0
WAIT:	jnb	TF0,wait	;Waits till the overflow flag is set
	clr	TR0		;Stops Timer 0
	clr	TR0		;Clear overflow flag in Timer 0
	ret


List of 17 messages in thread
TopicAuthorDate
8052 with Polaroid Ultrasonic Sensor            01/01/70 00:00      
   confused            01/01/70 00:00      
      it does            01/01/70 00:00      
         ok well            01/01/70 00:00      
   Problem?            01/01/70 00:00      
   That's a fast sensor!            01/01/70 00:00      
      Copy paste it in notepad            01/01/70 00:00      
         sry wrong code            01/01/70 00:00      
         And then formatted            01/01/70 00:00      
            At first glance...            01/01/70 00:00      
   im going to switch P3 and P1            01/01/70 00:00      
      Won't make any difference            01/01/70 00:00      
      Read this            01/01/70 00:00      
   Thanks            01/01/70 00:00      
   code description            01/01/70 00:00      
      thank you so much            01/01/70 00:00      
         better site            01/01/70 00:00      

Back to Subject List