PDA

View Full Version : SRF04 connections


Jordon
03-18-05, 09:04 AM
Is it OK to make the Trigger Pulse Input Connection on pin TA0, and the Echo Pulse Ouput connection on pin TA1 (MiniPod) ?

nmitech
03-18-05, 09:18 AM
Sure, I don't see any problem not to use them.

RMDumse
03-18-05, 01:05 PM
In fact, you don't have to use a timer pin for the Pulse Output either, but could use a GPIO as well. You just have to watch the setup values being put in the timer registers are modified to get to the right input pin on the timer module. In fact, following is an example with 5 SRF04's being run on different timer modules.

HEX
D4A CONSTANT PLSRSLT-CTRBOT EEWORD
D62 CONSTANT PLSRSLT-RIGHT EEWORD
D6A CONSTANT PLSRSLT-LEFT EEWORD
D12 CONSTANT PLSRSLT-CTRTOP EEWORD
D1A CONSTANT PLSRSLT-EXTRA EEWORD

: PULSE
PCNT COUNT
IF
PCNT RESET
0080 D17 ! ( SET FOR FALLING EDGE CAPTURE
7B00 D16 ! ( IP/32 TMRA2 INPUT
0 D45 ! ( ZERO TMRC1 CNTR REG.

0080 D1F ! ( SET FOR FALLING EDGE CAPTURE
7B80 D1E ! ( IP/32 TMRA3 INPUT
0 D1D ! ( ZERO TMRC1 CNTR REG.

0080 D67 ! ( SET FOR FALLING EDGE CAPTURE
7A00 D66 ! ( IP/32 TMRD0 INPUT
0 D65 ! ( ZERO TMRC1 CNTR REG.

0080 D6F ! ( SET FOR FALLING EDGE CAPTURE
7A80 D6E ! ( IP/32 TMRD1 INPUT
0 D6D ! ( ZERO TMRD1 CNTR REG.

0080 D4F ! ( SET FOR FALLING EDGE CAPTURE
7A80 D4E ! ( IP/32 TMRC1 INPUT
( 0 D4D ! ( ZERO TMRC1 CNTR REG. AND

D D47 ! ( TMRC0 HIGH
0 D4D ! ( ZERO TMRC1 CNTR REG. AND WASTE 10uS
5 D47 ! ( TMRC0 LOW

THEN
; EEWORD

: RANGE
( D4A
PLSRSLT-CTRBOT @ AA / . ." in. " CR
PLSRSLT-LEFT @ AA / . ." in. " CR
PLSRSLT-RIGHT @ AA / . ." in. " CR
PLSRSLT-CTRTOP @ AA / . ." in. " CR
PLSRSLT-EXTRA @ AA / . ." in. " CR
; EEWORD

Jordon
03-18-05, 02:05 PM
Randy;

As usual your answers are not only enlightening, but they bring me a deeper level of understanding.

Thanks very much.

Jordon