ВходНаше всё Теги codebook 无线电组件 Поиск Опросы Закон Понедельник
25 ноября
52481 Топик полностью
misyachniy (28.02.2006 13:32, просмотров: 4) ответил PlainUser на Нарисуйте красивый сравним.
У меня есть чужой, но красивый. 
/*======================================================================
 * vbits.h  -  bit manipulation macros
 *
 * Based on code by Askold Volkov (http://www.inp.nsk.su/~volkov/home.html)
 *----------------------------------------------------------------------
 *
 *  $Name:  $
 *
 *  $Id: vbits.h,v 1.2 2004/09/11 08:15:58 real Exp $
 *
 *  $Log: vbits.h,v $
 *  Revision 1.2  2004/09/11 08:15:58  real
 *  Indentation changed only.
 *
 *  Revision 1.1.1.1  2004/09/05 09:56:51  real
 *  Initial release, based on code by Ascold Volkov.
 *
 *
 */


#ifndef H_VBITS_H
#define H_VBITS_H

/*----------------------------------------------------------------------
 * BIT DEFINITION
 *
 * Bits must be defined in form
 * #define BITNAME  VAR, BITNO, LEVEL
 * where
 *   VAR   - SFR or variable where the bit placed
 *   BITNO - number of bit
 *   LEVEL - active level for this bit, H for high and L for low
 *
 * Example:
 *
 * #define MYINP PINB,2,L    - input from bit 2 of port PINB, active Low
 * #define MYOUT PORTD,5,H   - output to bit 5 of PORTD, active High
 *
 * Use:
 *  bit_on(b) and bit_off(b) for setting output bit in active and passive state,
 *  bit_active(b) to check if input bit is in active state
 *
 */


#define bit_setL(var,bit) (var)&=~(1<