本文整理匯總了C++中ClearBit函數的典型用法代碼示例。如果您正苦於以下問題:C++ ClearBit函數的具體用法?C++ ClearBit怎麽用?C++ ClearBit使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了ClearBit函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: Sprite16
void Sprite16 (short x, short y, short height, const unsigned short *sprite, void *vm_addr, short mode) {
TRACK("Sprite16");
Byte * Dest=(Byte *)vm_addr;
Byte * SpriteData=(Byte *)(void *)sprite;
int SpriteByteNum, ByteNum;
for(int sy=0; sy<height; sy++) {
for(int sx=0; sx<16; sx++) {
SpriteByteNum=((sy)*16)+(15-sx);
ByteNum=((sy+y)*ScreenState.XMax)+sx+x;
if(GetBit(SpriteData[SpriteByteNum/8], SpriteByteNum%8)!=0) {
if(mode==SPRT_XOR) {
if(GetBit(Dest[ByteNum/8], ByteNum%8)!=0) {
ClearBit(&Dest[ByteNum/8], ByteNum%8);
}
else
SetBit(&Dest[ByteNum/8], ByteNum%8);
}
if(mode==SPRT_OR || mode==SPRT_COPY) {
SetBit(&Dest[ByteNum/8], ByteNum%8);
}
}
else {
if(mode==SPRT_AND) {
SetBit(&Dest[ByteNum/8], ByteNum%8);
}
else if(mode==SPRT_COPY) {
ClearBit(&Dest[ByteNum/8], ByteNum%8);
}
}
}
}
}
示例2: LCD_CommonFunc
void LCD_CommonFunc(unsigned char data)
{
#ifdef BUS_4BIT
unsigned char tmp;
tmp = PORT_DATA & 0x0F;
tmp |= (data & 0xF0);
PORT_DATA = tmp; //вывод старшей тетрады
SetBit(PORT_SIG_EN, EN);
_delay_us(LCD_SPEED);
ClearBit(PORT_SIG_EN, EN);
data = __swap_nibbles(data);
tmp = PORT_DATA & 0x0F;
tmp |= (data & 0xF0);
PORT_DATA = tmp; //вывод младшей тетрады
SetBit(PORT_SIG_EN, EN);
_delay_us(LCD_SPEED);
ClearBit(PORT_SIG_EN, EN);
#else
PORT_DATA = data; //вывод данных на шину индикатора
SetBit(PORT_SIG_EN, EN); //установка E в 1
_delay_us(LCD_SPEED);
ClearBit(PORT_SIG_EN, EN); //установка E в 0 - записывающий фронт
#endif
}
示例3: main
main()
{
float speed = *(float *)&persist.UserData[97]; // value stored is actually a float
float LastSpeed = *(float *)&persist.UserData[99]; // get last speed setting
float LastState = persist.UserData[98]; // get last state
if (LastState==1)
{
// if spindle was CW now we want CCW
// spin down
ClearBit(154);
ClearBit(155);
LastSpeed = 0.0;
Jog(SPINDLEAXIS,0);
while (!CheckDone(SPINDLEAXIS)) ;
}
// turn spindle on CCW and ramp to new speed
SetBit(155);
// spindle is already on, so ramp to new speed
if (LastSpeed != speed)
{
LastSpeed = speed;
Jog(SPINDLEAXIS,LastSpeed * FACTOR);
}
*(float *)&persist.UserData[99] = LastSpeed; // save the last speed
persist.UserData[98] = -1; // remember we are CCW
}
示例4: LCDG_WaitFLAG_BUSY
//функция чтения флага занятости
void LCDG_WaitFLAG_BUSY(void)
{
unsigned char stat;
DDRX_LCD_BUS = 0; //конфигурируем порт на вход
PORT_LCD_BUS = 0xff;
SetBit(PORT_LCD_CON, RD_WR); //выставляем управляющие сигналы
ClearBit(PORT_LCD_CON, AO);
asm("nop");
asm("nop");
do{
ClearBit(PORT_LCD_EN, EN);
asm("nop");
asm("nop");
asm("nop");
asm("nop");
asm("nop");
stat = PIN_LCD_BUS; //считываем статусный байт
asm("nop");
asm("nop");
asm("nop");
asm("nop");
asm("nop");
SetBit(PORT_LCD_EN, EN);
}
while((stat & (1<<FLAG_BUSY)) != 0); //сидим в цикле пока не сбросится флаг
DDRX_LCD_BUS = 0xff; //делаем порт снова выходом
PORT_LCD_BUS = 0;
}
示例5: main
main()
{
float speed = *(float *)&persist.UserData[SPEEDVAR]; // value stored is actually a float
float LastState = persist.UserData[STATEVAR]; // get last state
if (LastState==1)
{
// if spindle was CW now we want CCW
// spin down
ClearBit(SPINDLECW_BIT);
ClearBit(SPINDLECCW_BIT);
Jog(SPINDLEAXIS,0);
while (!CheckDone(SPINDLEAXIS)) ;
}
// turn spindle on CCW and ramp to new speed
SetBit(SPINDLECCW_BIT);
// spindle is already on, so ramp to new speed
Jog(SPINDLEAXIS,-speed * FACTOR);
printf("Jogging Spindle %f counts/sec\n",speed * FACTOR);
persist.UserData[STATEVAR] = -1; // remember we are CCW
}
示例6: ClearBit
bool BitTest::test_ClearBit()
{
int x = 2, y = 4;
ClearBit(x,1);
ClearBit(y,1);
return ( (x==0) && (y==4) );
}
示例7: SetupCR0
// ----------------------------------------------------------------------------
void SetupCR0()
{
dword cr0 = __readcr0();
SetBit(cr0, 31); // Set PG 1 (Enable Paging)
ClearBit(cr0, 30); // Set CD 0 (Enable Cache)
ClearBit(cr0, 29); // Set NW 0 (Enable Writethrough)
SetBit(cr0, 16); // Set WP 1 (Enable Write Protect)
SetBit(cr0, 5); // Set NE 1 (Enable Internal FP Mode)
__writecr0(cr0);
}
示例8: main
main()
{
// spin down
ClearBit(SPINDLECW_BIT);
ClearBit(SPINDLECCW_BIT);
Jog(SPINDLEAXIS,0);
printf("Jogging Spindle Stop\n");
persist.UserData[STATEVAR] = 0; // remember we are Off
while (!CheckDone(SPINDLEAXIS)) ;
}
示例9: booz2_analog_init_hw
void booz2_analog_init_hw( void ) {
/* AD0 */
/* PCLK/4 ( 3.75MHz) - BURST - ON */
AD0CR = 0x03 << 8 | 1 << 16 | 1 << 21;
/* disable global interrupt */
ClearBit(AD0INTEN,8);
/* AD1 */
/* PCLK/4 ( 3.75MHz) - BURST - ON */
AD1CR = 0x03 << 8 | 1 << 16 | 1 << 21;
/* disable global interrupt */
ClearBit(AD1INTEN,8);
/* select P0.29 as AD0.2 for bat meas*/
PINSEL1 |= 0x01 << 26;
/* sample AD0.2 */
AD0CR |= 1 << 2;
/* select P0.10 as AD1.2 for baro*/
ANALOG_BARO_PINSEL |= ANALOG_BARO_PINSEL_VAL << ANALOG_BARO_PINSEL_BIT;
/* sample AD1.2 */
AD1CR |= 1 << 2;
/* turn on DAC pins */
PINSEL1 |= 2 << 18;
#ifdef USE_ADC_1
/* select P0.13 (ADC_SPARE) as AD1.4 adc 1 */
PINSEL0 |= 0x03 << 26;
AD1CR |= 1 << 4;
#endif
#ifdef USE_ADC_2
/* select P0.4 (SCK_0) as AD0.6 adc 2 */
PINSEL0 |= 0x03 << 8;
AD0CR |= 1 << 6;
#endif
#ifdef USE_ADC_3
/* select P0.5 (MISO_0) as AD0.7 adc 3 */
PINSEL0 |= 0x03 << 10;
AD0CR |= 1 << 7;
#endif
#ifdef USE_ADC_4
/* select P0.6 (MOSI_0) as AD1.0 adc 4 */
PINSEL0 |= 0x03 << 12;
AD1CR |= 1 << 0;
#endif
booz2_adc_1 = 0;
booz2_adc_2 = 0;
booz2_adc_3 = 0;
booz2_adc_4 = 0;
}
示例10: InitKeyboard
void InitKeyboard(void){
MenuIni();
ClearBit(KEY_PORTIN_OK, KEY_OK_PORT);
ClearBit(KEY_PORTIN_STEP, KEY_STEP_PORT);
#ifdef EXTERNAL_INTERAPTS_USE
MCUCR |= (1<<ISC01) | (1<<ISC00) | //По спадающему уровню на INTo
(1<<ISC11) | (1<<ISC10); //по спадающему на INT1
GICR |= (1<<INT0) | (1<<INT1); //Разрешить прерывание от кнопок
#else
SetTimerTask(KeyScan, SCAN_PERIOD_KEY);
#endif
PrevKey = 0;
Key = 0;
}
示例11: LCDG_CommonFunc
//общая функция
inline void LCDG_CommonFunc(unsigned char data)
{
ClearBit(PORT_LCD_CON, RD_WR);
asm("nop");
asm("nop");
ClearBit(PORT_LCD_EN, EN);
PORT_LCD_BUS = data;
asm("nop");
asm("nop");
asm("nop");
asm("nop");
asm("nop");
SetBit(PORT_LCD_EN, EN);
}
示例12: SetBoxPos
//==================================================================================
void SetBoxPos(U8 _box_num, U16 _boxhl, U16 _boxvt)
{
U8 _rdat_;
_rdat_ = ReadAsicByte(MASTER,DVC_PG2,0x21+_box_num*6);
if(BitSet(_boxhl, BIT0)) SetBit(_rdat_, BIT3);
else ClearBit(_rdat_, BIT3);
if(BitSet(_boxvt, BIT0)) SetBit(_rdat_, BIT1);
else ClearBit(_rdat_, BIT1);
WriteAsicByte(MASTER,DVC_PG2,0x21+_box_num*6,_rdat_);
WriteAsicByte(MASTER,DVC_PG2,0x22+_box_num*6,(U8)(_boxhl>>1));
WriteAsicByte(MASTER,DVC_PG2,0x24+_box_num*6,(U8)(_boxvt>>1));
}
示例13: ServiceKonnectPWM
void ServiceKonnectPWM(void)
{
static int FirstTime=TRUE;
static float Vc=0.0f;
static double T0;
static int State;
double T=Time_sec();
if (FirstTime)
{
FirstTime=FALSE;
T0=T;
State=0;
}
else
{
float V,I;
float RPM=*(float *)&persist.UserData[KMVAR];
float Vout = RPM*(5.0 / 1000.0);
// Compute Voltage applied to Cap
V=Vcc*State;
// Compute current
I=(V-Vc)/R;
// Compute new Cap Voltage
Vc += I/C*(T-T0);
// determine next state
if (Vc > Vout)
{
ClearBit(HIGH_BIT);
SetBit(LOW_BIT);
State=0;
}
else
{
ClearBit(LOW_BIT);
SetBit(HIGH_BIT);
State=1;
}
T0=T; // save time when applied
}
}
示例14: LCDG_SendSymbol
void LCDG_SendSymbol(unsigned char xPos, unsigned char yPos,unsigned char data)
{
unsigned char i;
unsigned char realAdr;
unsigned char realPage = PAGE0 + yPos;
unsigned int pointerFont = ((unsigned int)data<<2) + ((unsigned int)data<<1);
realAdr = PlaceArray[xPos];
xPos = realAdr;
for(i = 0; i<=5; i++){
if (realAdr < 61) {
SetBit(PORT_LCD_CON, CS);
realAdr = realAdr + 19;
}
else {
ClearBit(PORT_LCD_CON, CS);
realAdr = realAdr - 61;
}
data = pgm_read_byte(&(Font_6x8_Data[pointerFont]));
if(flag) data = ~data;
LCDG_SendCom(realPage);
LCDG_SendCom(realAdr);
LCDG_SendData(data);
xPos++;
realAdr = xPos;
pointerFont++;
}
}
示例15: LCDG_PutPixel
//отображает один пиксел на экране
void LCDG_PutPixel(unsigned char xPos, unsigned char yPos)
{
unsigned char realAdr;
unsigned char realPage;
unsigned char data;
unsigned char currentData;
if ((xPos > 122) || (yPos > 31)) return;
realAdr = xPos;
realPage = PAGE0 + (yPos/8);
data = yPos%8;
if (realAdr < 61) {
SetBit(PORT_LCD_CON, CS);
realAdr = realAdr + 19;
}
else {
ClearBit(PORT_LCD_CON, CS);
realAdr = realAdr - 61;
}
LCDG_WaitFLAG_BUSY();
LCDG_SendCom(realPage);
LCDG_SendCom(realAdr);
LCDG_ReadData();
currentData = LCDG_ReadData();
switch(method){
case MET_AND: {currentData &= ~(1<<data); break;}
case MET_OR : {currentData |= (1<<data); break;}
case MET_XOR : {currentData ^= (1<<data); break;}
}
LCDG_SendCom(realAdr);
LCDG_SendData(currentData);
}