need help. Control ultrasonic sensor using PIC16F84

Status
Not open for further replies.

atehbusuk

New Member
I needed your help to check my program. I want to control a basic mobility robot using Ultrasonic sensor and PIC 16F84A. I have using PING))) Ultrasonic Sensor by parallax company. This type about feature of these sensor :
Voltage supply : 5 V
Range : 2cm to 3meter
Burst frequency : 40 Hz
Input Triger : Positive TTL pulse, min 2us, 5us typ.
Encho pulse : Positive TTl pulse min 115us to 18.5ms
Encho hold-off : 750us
Delay before Next measurement 200us.
Burst travels through the air: 1130 feet per second.
I have tried these program, but it's not available. I want these sensor recomand high if it detact some object <80cm. So, can u help me to check this program :

-------------------------------------------------------------------------------------------------------
;Ping ultrasonic sensor
list p=16f84
radix hex

;----------------------------------------------------------------------

status equ 0x03
porta equ 0x05
portb equ 0x06
PWM equ 0x0c
count equ 0x0d
temp equ 0x0e
loop equ 0x0f
as equ 0dh
;---------------------------------------------------------------------

c equ 0

;---------------------------------------------------------------------


org 0x000

start movlw 0x00
tris portb
movlw 0xFF
tris porta
movlw 0x00
movwf portb
main clrf count
clrf PWM
bsf portb,3 ;start command to sensor 6us
movlw d'2' ;delay 2*3 clock delay
movwf count
call delay
bcf portb,3 ;
movlw 50 ; wait 500us
movwf as
X2 nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
decfsz ,X2
goto X2
movlw d'5'
movwf count
A0LOW btfss porta,0
goto A0LOW
A0HIGH incf PWM ; recived signal measurement by sensor
call delay
nop
btfsc porta,0
goto A0HIGH
movf PWM,w
sublw d'200'
btfsc status,c
goto skip1
movlw d'200'
movwf PWM
skip1 movf PWM,w
sublw d'20'
btfss status,c
goto skip2
movlw d'20'
movwf PWM
skip2 movlw d'1'
movwf count
bsf portb,0
LoopPWM call delay
nop
nop
nop
decfsz PWM
goto LoopPWM
bcf portb,0
movlw d'15'
movwf loop
del15 movlw d'255'
movwf count
call delay
decfsz loop
goto del15
goto main

;----------------------------------------------------------------------

delay movf count,w ; delay loop
movwf temp
del decfsz temp ; 3 clock cycles per delay loop
goto del
return

;----------------------------------------------------------------------

end

;----------------------------------------------------------------------

-------------------------------------------------------------------------------------------------------
It's program is compatable or not. Please tell me what its problem. Thanks for ur help.
 
Please do not post the same message in different forums. It does not help you to get more responses and just makes it harder for everyone to keep track of what you have been told.
 
I agree but I can't find any other threads, perhaps a moderator has done the decent thing and deleted them.

Notice how the emphasis of this thread has changed from your question to the fact that you've made duplicate threads? You know how to prevent this from happening don't you? Do not make duplicate threads!
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…