To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.handyboardOpen lugnet.robotics.handyboard in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / Handy Board / 7607
7606  |  7608
Subject: 
Re: Non-polaroid Sonar
Newsgroups: 
lugnet.robotics.handyboard
Date: 
Thu, 16 Mar 2000 13:42:47 GMT
Original-From: 
Adam Oliver <oli@wantree.com.auSTOPSPAMMERS>
Viewed: 
1327 times
  
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 and
ended at 7, not 1 to 8 as appears to be the case here. Is this what the
"zero-indexed " means?

sorry if it's a basic question, but if you don't ask you never learn :-)

thanks Again

Adam



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.




Message has 1 Reply:
  Re: Non-polaroid Sonar
 
(...) No, that's a very good question. It had me confused, too. The second argument to bit_set and bit_clear is not actually the index of a bit at all; it's a bit mask. For example, when you do bit_set( 0x1021, 3 ), the 3 becomes 0000 0011 in (...) (25 years ago, 16-Mar-00, to lugnet.robotics.handyboard)

Message is in Reply To:
  Re: Non-polaroid Sonar
 
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) (...) (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
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR