Vous êtes sur la page 1sur 1

CTA Soles BCP 193-16523453-0-55 a nombre de Rmulo Bentez

''''''''''''''''''''''''''''''''''''''''''''
'
SRF05 single pin reading with lcd 03
'
'
example in PicBasic PRO
'
'
by James Henderson 2009
'
''''''''''''''''''''''''''''''''''''''''''''
define OSC 8
define CHAR_PACING 102
make 2 for LCD03

' 8Mhz oscillator


' 1 stop bit time to

RES con 5
resolution of the pulsin reading

' Constant that is the

w0 var word
the srf05

' Stores the pulse from

serout PORTC.1,2,[12,4]
hide cursor

' Clear lcd screen and

loop:
LOW PORTB.5
Pulsout PORTB.5,5
PULSin PORTB.5,1,w0
SRF05
w0 = (w0*5)/58
8Mhz resonator the resolution of the pulse in is
multiply by this first to get an acurate reading
serout PORTC.1,2,[1,"Range: ",#w0," "]
pause 100
goto loop

' Start with pin low


' Pulse out to SRF05
' Measure pulse from
' As we are using an
5us therfore we have to
' Display range

http://www.robot-electronics.co.uk/htm/picbasicpro_examples.htm

Vous aimerez peut-être aussi