|
From: | E. Weddington |
Subject: | Re: [avr-gcc-list] Re: What Happened to the sbi() and cbi() Macros???? |
Date: | Wed, 02 Feb 2005 00:11:53 -0700 |
User-agent: | Mozilla Thunderbird 1.0 (Windows/20041206) |
Panther Alarm & Communication technologies wrote:
Dear Eric,I have it with me already, A solid printed Version, Make a Quick refThanks a lot for that and the WinAVRBTW the posting to the list was if you could just give a example out to Newbies Some thing Like Joerg Example of the LED_set
Here you go: Checking if a bit is set: if (var & bit_mask) { // The bit defined in the bit_mask is set. } Checking if a bit is clear: if (! (var & bit_mask)) { // The bit defined in the bit_mask is clear. }Of course, the above uses the concept of a *bit mask*, not just a *bit number*.
And next time, please respond to the list and not just to me personally. Thanks.
Eric
Bye Srikanth Kamath T On Tue, 01 Feb 2005 23:35:25 -0700, E. Weddington wrote:Panther Alarm & Communication technologies wrote:Dear Eric, ".....AFAIK, bit_is_set, bit_is_clear are both still in. But sbi, cbi, inb, inw, outb, outw, outp, inp are all gone now." would please inform How to go about the following more efficiently in C without using the existing Macros for these, and a few extra noted will be a added help 1. bit_is_set() 2. bit_is_clear()See this primer on bit operations at AVR Freaks: <http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&t=876 4&highlight=programming+101> Go down to the post that starts with "Programming 101" which should be highlighted.
[Prev in Thread] | Current Thread | [Next in Thread] |