Subject:
|
Re: Non-polaroid Sonar
|
Newsgroups:
|
lugnet.robotics.handyboard
|
Date:
|
Wed, 15 Mar 2000 16:30:33 GMT
|
Original-From:
|
Will Bain <willb@selway.AVOIDSPAMumt.edu>
|
Viewed:
|
1258 times
|
| |
| |
In the sonar code from the web site, the rising edge detection on timer input channel 3 (TIC3) is set like this:
bit_clear( 0x1021, 2 ); bit_set( 0x1021, 1 );
According to the little pink book, address 0x1021 is the Timer Control Register 2 (TCTL2) (in the Register & Control Bit Assignments section). To set channel 3 to capture falling edges only, you'd make the last two bits (set, clear) instead of (clear, set), like this:
bit_set( 0x1021, 2 ); bit_clear( 0x1021, 1 );
Hope this helps!
-- Will
BTW, can anyone tell me why the bit_set and bit_clear commands aren't zero-indexed WRT the bit index (like everything else in C and machine code is)? Just curious.
> Adam Oliver wrote:
>
> Greetings all,
>
> I've just finished building Kam Leang's sonar circuit as published on his web site, and it all seems to be working well. I am having a problem interfacing it to the handyboard however.
> I'm not entirely sure how to set bits high and low etc on the SPI port, which is where I intend to hook this up. I have looked at the other sonar code thats around, but it hasn't been of much help.
>
> This particular circuit doesn't use any kind of inhibitor to remove extreme close range signals. All I need is a ping out, then to count time before it bounces back. All the examples I've seen have used a rising edge signal, however this circuit is normally high and drops low when an echo is detected. The pink book just confused me even more (I hate to say).
>
> Could anyone out there give me a few pointers of what bits need setting/resetting, and how to go about it? It would be greatly appreciated.
>
> thanks
> Adam
>
|
|
Message has 1 Reply: | | Re: Non-polaroid Sonar
|
| Thanks for your help :-D Just so I'm clear, ref pink book page 10-17. Does the "bit_set( 0x1021, 1 );" refer to bit 0 -EDG3B, and bit_clear( 0x1021, 2 ); " refer to bit 1 -EDG3A. This is what was throwing me, I always thought bits started at zero (...) (25 years ago, 16-Mar-00, to lugnet.robotics.handyboard)
|
Message is in Reply To:
| | Non-polaroid Sonar
|
| Greetings all, I've just finished building Kam Leang's sonar circuit as published on his web site, and it all seems to be working well. I am having a problem interfacing it to the handyboard however. I'm not entirely sure how to set bits high and (...) (25 years ago, 15-Mar-00, to lugnet.robotics.handyboard)
|
7 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
This Message and its Replies on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|