PDA

View Full Version : Regarding Sonar Program


NAVNEET ACHARYA
05-14-04, 10:31 AM
Sir,

I am finding problem in understanding following codes,I am

using my own code but that is slower than this,Therefore I want

to know action of following program.

I am writting what I am getting by this code,please Help me to
Understand this code.

HEX
: PLS
D D47 ! ( TMRC0 HIGH It is for triggering i.e.Triggering start?
0 D46 ! ( ZERO TMRC0 CNTR REG. AND WASTE 10uS


5 D47 ! ( TMRB0 LOW Why we are using TMRB0 ?

0 D4D ! ( ZERO TMRB1 CNTR REG. AND WASTE 10uS
( At timerB1 we are applying Echo Pulse which we are receiving from SONAR ?

0080 D4F ! (
7880 D4E ! (
RANGE
;

EVERY C350 CYCLES SCHEDULE-RUNS PLS

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

: Z DECIMAL BEGIN D EMIT RANGE ?TERMINAL UNTIL ;


I have written my doubts in Comments,Please Clear My doubts

So,that I may Proceed further.

Watting for Response.

Thanks

Regards,

RMDumse
05-14-04, 12:20 PM
D D47 ! ( TMRC0 HIGH It is for triggering i.e.Triggering start?


Yes, for ease of hooking up, two consecuetive timer pins were chosen. The sonar needs a 10uS or greater pulse to start a ranging conversion. So the TMRC0 line was used to create this pulse. But none of the timer features of this pin are used. A port line could have been used just as well. But since we are dealing with the timer registers directly, this is a very fast procedure. Faster than we could have done with a regular port line, using the OO words, like ON or OFF.


5 D47 ! ( TMRB0 LOW Why we are using TMRB0 ?


Typo, mistake in comment. Originally this code was written for another timer (TMRB0), and when changed to TMRC0, editing missed the old refenece. Should have been updated to TMRC0 not TMRB0, which is at another address, not D47.


0 D4D ! ( ZERO TMRB1 CNTR REG. AND WASTE 10uS
( At timerB1 we are applying Echo Pulse which we are receiving from SONAR ?


Again, typo, the original set up of the code was for TMRB0, but later changed and editing changed the address to D4D, but the comment was missed. SHould be TMRC1. Notice D4D is part of TMRC1 address range.

LC, maybe you should update the web example if it hasn't been already. I know I've gotten rid of the typos in this example on my computer, but it must still be unchanged somewhere on the web download page.

NAVNEET ACHARYA
05-15-04, 01:50 AM
Thanks,for Response,Now my Doubts are cleared.

Thanks once again.

Regards,