[Elecraft] K3 Programmer's Reference - Noise Reduction

Wayne Burdick n6kr at elecraft.com
Tue Nov 2 11:15:41 EDT 2010


Hi Tom,

To test the value of bit 0 in an 8-bit variable X in C, you can use  
the bitwise AND operator (&):

    if( X & 0b1 )
       do_something()

0b1 is a binary constant that's the equivalent of a byte with only bit  
0 set. It is used by the & operator as a "mask". If bit 0 of byte X is  
also set, then the tested "if" statement will be true.

The other bits from 1 to 7 can be accessed with constant masks of  
0b10, 0b100, 0b1000, 0b10000, 0b100000, 0b1000000, and 0b10000000. Or  
you could use constant values of 1, 2, 4, 8, 16, 32, 64, and 128  
(decimal) or 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80  
(hexadecimal).

73,
Wayne
N6KR


On Nov 2, 2010, at 7:59 AM, Amateur Radio Operator N5GE wrote:

> On Tue, 2 Nov 2010 07:32:50 -0700 (PDT), Stan wrote:
>
> Thanks to both of you guys!
>
> I see the DS and IC commands and had considered using the IC command
> last night but I'm embarased to say that I don't know how to get the
> bits out of a byte.
>
> Is there a function in the C# language to do that?  Or does one of you
> have  'C' or C# code that does this?
>
> I searched all of the online doc for C# but found nothing that I
> understood and unfortunately no example that fit my needs.
>
> Thanks
>
> Tom
> Radio Amateur N5GE
>
>>
>> In K31 mode, the "DS" command returns the state of main NR in bit  
>> 2.  (Page
>> 8)
>>
>>
>> Radio Amateur N5GE wrote:
>>>
>>> How do I query the K3 for the state of the NR?
>>>
>>
>>
>> -----
>> 73, Stan - KR7C



More information about the Elecraft mailing list