|
CatsEyes Hints and Tips Division by Two
The division by two is just a right-shift by one
bit position. To divide by multiples of two, just repeat the shift operation.
Similarly, to multiply by two, left-shift by one bit position. One way to
think of it is using the decimal system equivalent. To divide by 10, shift the
digits in the number right by one position and to multiply by 10, shift it
left.
The operation to do a right-shift in the
PIC12F629/675 is RRF (rotate right through carry). You'll note that it shifts
the bit in the carry flag into the left-most bit position. Since we want to
make sure we shift a "0" into this position, we have to clear the carry flag
first. We can do this with the BCF instruction, since the carry flag is part
of the STATUS register.
So, assume you have a value from 0 to 255 in the
variable TRIM that represents the position of your trimmer pot. You want to
divide this by 8 (2 to the power of 3) to get a value from 0 to 31. So we can
do three right-shifts (clearing the carry flag prior to each one):
Flashing LEDs
You can use flashing LEDs to enhance aircraft visibility and provide orientation cues. Flashing LEDs would be an advantage over continuously lit for three reasons: * A flashing LED should inherently be more visible to the eye The LEDs I'm using are rated at 70mA. I've tried pulsing them at about double
that, 150mA for a 50mS flash about once per second. Any more than 150mA seems to
give diminishing returns in terms of light output. 50mS seems to be the shortest
flash than appears as full brightness to the eye.
RC Groups Thread: http://www.rcgroups.com/forums/showthread.php?s=&postid=1832728#post1832728
What Type of Transistor and What Type of MOSFET to Use to Switch Loads
with a PIC Pin
![]()
If the pin is "normally" low and you want to switch the load "on" by having the pin go high, use an NPN.
<<<<=========
![]()
If the pin is "normally" high and you want to switch the load "on" by having the pin go low, us a PNP. ========>>>>
And for MOSFETS...
If the pin is "normally" low and you want to
switch the load "on" by having the pin go high, use an N-Channel.
<<<<=======
![]()
If the pin is "normally" high and you want to switch the load "on" by
having the pin go low, us a P-Channel.
========>>>>
|
Send mail to
ironsidz@hotmail.com with
questions or comments about this web site.
|