PDA

View Full Version : SRF04 - PlugaPod


Kavaipatti
07-05-04, 03:27 PM
Hi All,

I am using Devantech SRF04 Range Finder with PlugaPod. I am connecting the sensor Trigger Input to PWA0/ISA0 and Output to AD6. I downloaded the code from the website and made few changes but was not successful in getting the output. It would be great if you could help me modify the code for my application.

Thanks,
Kavaipatti

nmitech
07-06-04, 02:13 PM
The original example program is using Timer-C of the IsoPod to trigger the sonar input. I would use the Timer-A on the PugaPod instead of PWMA0 if you want to have a minimal modification from the sample program,

( --- Use Timer-C on IsoPod --- )
HEX
: PLS
D D47 ! ( TMRC0 HIGH
0 D46 ! ( ZERO TMRC0 CNTR REG. AND WASTE 10uS
5 D47 ! ( TMRC0 LOW
0 D4D ! ( ZERO TMRC1 CNTR REG. AND WASTE 10uS
0080 D4F ! ( SCR REG. TMRC1 CAP MODE RISING EDGE
7880 D4E ! ( CTRL REG. TMRC1 CNT RISING IP/16
;

EVERY C350 CYCLES SCHEDULE-RUNS PLS

: RANGE D4A @ 127 / . ." in." ;

: Z DECIMAL BEGIN D EMIT RANGE ?TERMINAL UNTIL ;


( --- Replace with Timer-A on PlugaPod --- )

HEX
: PLS
D D07 ! ( TMRA0 HIGH
0 D06 ! ( ZERO TMRA0 CNTR REG. AND WASTE 10uS
5 D07 ! ( TMRA0 LOW
0 D0D ! ( ZERO TMRA1 CNTR REG. AND WASTE 10uS
0080 D0F ! ( SCR REG. TMRA1 CAP MODE RISING EDGE
7880 D0E ! ( CTRL REG. TMRA1 CNT RISING IP/16
;

EVERY C350 CYCLES SCHEDULE-RUNS PLS

: RANGE D0A @ 127 / . ." in." ;

: Z DECIMAL BEGIN D EMIT RANGE ?TERMINAL UNTIL ;

Kavaipatti
07-08-04, 04:20 PM
Hi,

I connected Devantech Ultrasonic Ranger (SRF04) to PlugaPod and downloaded the code. I am getting a constant output irrespective of the distance.

I have the following doubts:

1. I connected Trigger Pulse Input to TA0 and Echo Pulse Output to AD6 in PlugaPod. Are these connections right?

2. If wrong where do I need to connect these in PlugaPod?

Thanks,
Kavaipatti

nmitech
07-08-04, 05:33 PM
Based on the example program, TA0 is triggering the Sonar Input, and TA1 is measuring the output pulse from the sonar. So you need to connect the output of the sonar to TA1 instead of AD6. After you download the program, just enter "Z" then hit return. It will continuing display the data range on the screen. Hit any key again to stop displaying data.

Kavaipatti
07-09-04, 04:28 PM
Thanks for your help. I am getting perfect output.

Kavaipatti