doubt in srf05

nevil010

Member
Code:
symbol trig = C.1 			; Define pin for Trigger & Echo (All M2, X2 parts)
symbol range = w1 			; 16 bit word variable for range

main:	low b.1
      pulsout trig,2 			; produce 20uS trigger pulse (must be minimum of 10uS)
	pulsin trig,1,range 		; measures the range in 10uS steps
	pause 20			; recharge period after ranging completes

	; now convert range to cm (divide by 5.8) or inches (divide by 14.8)
	; as picaxe cannot use 5.8, multiply by 10 then divide by 58 instead

	let range = range * 10 / 58	; multiply by 10 then divide by 58
      if range < 5 then gosub hig
	goto main			; and around forever
	
	hig:
	high b.1
	pause 10
	return

	; Note that X2 parts operate at 8MHz instead of 4MHz and so modify the calculation
	; let range = range * 10 / 58 / 2 ; multiply by 10 then divide by 58 then divide by 2
the code is copied from picaxe..

the srf works perfectly but if i take it in my hand..the led just flash every 1 min...

please reply :D
 

hippy

Ex-Staff (retired)
the srf works perfectly but if i take it in my hand..the led just flash every 1 min...
There's a punchline to a set of old jokes along the lines of; well don't do that then !

If you analyse the code it flashes when range < 5, so if it's not flashing then one could guess range is >= 5.

You could add a DEBUG or SERTXD to check that. If it is, you have your answer.

It's also not necessary to add "please reply" to your posts; people either will or won't, and asking may even drive some people away !
 

nevil010

Member
:D agreed with that hippy.
the diagram?
i have just connecter srf05 to 18m2 high power board c.1.
the program just to test srf05 if it is working or not..it just blink led when srf reads something infront of it in 5 cm..
i tried adding debug but it's not showing any change if i move my hand above it
And if i disconnect the power for some time and wait for like 30 min it will again start working
 

hippy

Ex-Staff (retired)
The code is tested and known to work so there is perhaps something in your set-up which is not right. There are a whole range of possibilities there.

After you have disconnected for 30 min and it starts working, does it continue to keep working or does it again stop after some time ? After what time ?

What does DEBUG show when it is working ? Are the results what would be expected ? Where did you put the DEBUG command in your code ?

It could be something as simple as batteries used as a power supply getting low on juice; what power supply do you have ?

How have you connected the rest of the SRF05 pins ? Is this a genuine SRF05 or is it some 'Chinese copy' ?

The more detailed information you can provide the less stabbing in the dark for possible causes of the problem there will be.
 

Bill.b

Senior Member
Have you connected the mode pin to 0v on the srf005 to allow
input and output on the same picaxe pin.

srf0005.jpg

Bill
 
Top