//中断使能和中断停止 void nrf24l01_int_en() { P2IFG = 0x00; P2IES = 0x40; P2IE = 0x40; _EINT(); }
void switch_to_normal_mode(void) { /* Switch to full speed, full power mode */ meter_status |= STATUS_PHASE_VOLTAGE_OK; set_normal_indicator(); #if defined(__MSP430_HAS_TA3__) /* Disable the TIMER_A0 interrupt */ TACTL = 0; TACCTL0 = 0; #endif _DINT(); init_analog_front_end_normal(); samples_per_second = SAMPLES_PER_10_SECONDS/10; _EINT(); enable_ir_receiver(); operating_mode = OPERATING_MODE_NORMAL; }
void init_hardware() { _DINT(); WDTCTL = WDTPW + WDTHOLD; // + WDTNMI + WDTNMIES; // WDT off NMI hi/lo //IE1 |= NMIIE; // Enable NMI //IFG1 |= NMIIFG; init_timer(); init_uarts(); P1OUT = 0x10; P1DIR = 0x01|0x10; #ifndef GOODFET VJTAGDIR |= VJTAG; VJTAGOUT |= VJTAG; #endif /* P1OUT |= 10;*/ /* P1DIR |= 0x10;*/ /* P1OUT |= 10;*/ _EINT(); }
void init_usart(void) { unsigned char i; BCSCTL1&=~XT2OFF; do { IFG1&=~OFIFG; for(i=0xff;i;i--); }while((IFG1&OFIFG)!=0); BCSCTL2|=SELM1+SELS;//MCLK=SMCLK=XT2; ME1|=UTXE0+URXE0; // ME2|=UTXE1+URXE1; P3SEL|=0x30;//+0xc0;//别忘了这里要设为第二功能! U0CTL|=SWRST; U0CTL|=CHAR; U0TCTL=SSEL1; U0BR1=3; U0BR0=65; U0MCTL=0x24; // U1CTL|=SWRST; // U1CTL|=CHAR; // U1TCTL=SSEL1; // U1BR1=3; // U1BR0=65; // U1MCTL=0x24; U0CTL&=~SWRST; // U1CTL&=~SWRST; IE1|=URXIE0; _EINT(); }
/**************************************************************************** * 名 称:AD7708Init * 功 能:初始化AD7708 * 入口参数:chop:斩波允许标志 为1,斩波允许,0则不允许 * 出口参数:无 * 说 明: 完成AD7708的初始化工作 ****************************************************************************/ void AD7708Init(char chop) { P3DIR|=BIT0; P3OUT&=~BIT0; //CS选中 //主机模式,115200,8位数据位,三线模式,时钟模式1(具体见spi.c) SpiMasterInit(115200,8,3,1); //时钟不是准确的115200(具体见spi.c) _EINT(); //开中断,spi读写程序要需要中断 char filter; adccon = 0x0f; if(chop == 0) { filter = 0x03; //滤波寄存器设为最小值,可以更改 mode = 0x91; //斩波禁止,10通道,无缓冲,空闲模式 } else { filter = 0x0D; //滤波寄存器设为最小值,可以更改 mode = 0x11; //斩波启用,10通道,无缓冲,空闲模式 } AD7708WriteRegister(0x07,0x00); //IO寄存器,不用== AD7708WriteRegister(0x03,filter); //滤波寄存器 AD7708WriteRegister(0x02,0x0F); //ADC控制寄存器,0通道,单极性 AD7708WriteRegister(0x01,mode); //模式寄存器 if(chop == 0) for(int i = 0; i<5;i++) { //校准,因只有5个失调寄存器,多的就会覆盖之前的,只校准5个即可 AD7708Cal(5); } _DINT(); }
void switch_to_limp_mode(void) { /* Switch to minimum consumption, current measurement only mode */ meter_status &= ~(STATUS_REVERSED | STATUS_PHASE_VOLTAGE_OK); clr_normal_indicator(); clr_reverse_current_indicator(); #if defined(__MSP430_HAS_TA3__) /* Enable the TIMER_A0 interrupt */ TACTL = TACLR | MC_1 | TASSEL_1; TACCTL0 = CCIE; #endif _DINT(); init_analog_front_end_limp(); samples_per_second = LIMP_SAMPLES_PER_10_SECONDS/10; disable_ir_receiver(); _EINT(); operating_mode = OPERATING_MODE_LIMP; }
void main(void) { #if !defined(MAX_UART_RX_BUF_CNT) #error "Define MAX_UART_RX_BUF_CNT > 0 in config.h for this example" #endif WD_STOP(); ClockConfig(16); HardwareInit(); // init uart at 115k UartInit(115200); _EINT(); printf("\n\nEnter your name: "); static uint8_t buf[30]; uint8_t* cur_char = &buf[0]; while(1) { // poll the rx buffer for new data if (!UartBufEmpty()) { // pull the data out one byte at a time *cur_char = getchar(); // was the last character a carriage return? if (*(cur_char - 1) == '\r') { printf("\nHello %s",buf); } } } }
/* * main.c */ int main(void) { WDTCTL = WDTPW | WDTHOLD; // Stop watchdog timer gpio_port1_init(); Timer0_init(); Timer1_init(); GPIO_PORT1.out = S2_BIT; // Set S2 pin out register for pullup GPIO_PORT1.direction = ~S2_BIT; // Set LED pin to output mode GPIO_PORT1.resistor_enable = S2_BIT; // Enable S2 pin pullup GPIO_PORT1.select = LED2_BIT; // Select TA0.1 GPIO_PORT1.select_2 = 0; GPIO_PORT1.interrupt_edge_select = S2_BIT; // Set for falling edge GPIO_PORT1.interrupt_flag = 0; // Clear interrupt flags GPIO_PORT1.interrupt_enable = S2_BIT; // Enable interrupt GPIO_PORT2.direction = BUZZER_BIT; // Set buzzer pin to output mode GPIO_PORT2.select = BUZZER_BIT; // Select TA1.0 GPIO_PORT2.select_2 = 0; GPIO_PORT1_registerCallback(S2_PIN, &LED2_One_Shot); // Should blink the LED when the button is pressed. Timer0_A1_registerCallback (1, &TA0CCR1_ISR_Handler); _EINT(); LPM0; return 0; }
void main (void) { WDTCTL = WDTPW | WDTHOLD; // Stop watchdog timer // Set 16MHz clock BCSCTL1 = CALBC1_16MHZ; DCOCTL = CALDCO_16MHZ; // Startup Delay _delay_cycles(2000); // Initialize serial port SERIAL_init(); // Enable interrupt _EINT(); rxEchoPos = 0; // Set the servo port to digital output P2DIR |= BIT2; int deg; // servo rotation degree // Main loop while(1) { // load the target degree from the serial port deg = checkSerial(); // if there is a new value if(deg > -1) { // Move the servo moveServo(deg); } __delay_cycles(1000); } }
TIMERID TakeTimer(TIMERID RequiredTimer,unsigned int Interval,unsigned char mode,void (*f)()) //if RequiredTimer = 0, timer is selected by ID { unsigned int i,*pTBCCR,*pTBCCTL; if (RequiredTimer == RANDOM){ for (i=TB2 ; i<TIMERB_AMOUNT ; i++){ //TB0 and TB1 is usd for ADC; RequiredTimer = i; if (TimerB_Array[i].Timer_Function_Pointer == 0) break; } TimerB_Error |= ERROR_CREAT_TIMER; }else{ if (TimerB_Array[i].Timer_Function_Pointer != 0){ TimerB_Error |= ERROR_CREAT_TIMER; return NO_SERV; } } _DINT(); TimerB_Array[RequiredTimer].Period = Interval; TimerB_Array[RequiredTimer].Operated_Mode = mode; TimerB_Array[RequiredTimer].Timer_Function_Pointer = f; _EINT(); pTBCCR = (unsigned int *)(&TBCCR0 + RequiredTimer); pTBCCTL = (unsigned int *)(&TBCCTL0 + RequiredTimer); *pTBCCR = TBR + Interval; *pTBCCTL = CCIE; return RequiredTimer; }
void main(void) { volatile unsigned int i; WDTCTL = WDTPW+WDTHOLD; // Stop watchdog timer ADC12CTL0 = ADC12ON+REFON+REF2_5V+SHT0_6; // Setup ADC12, ref., sampling time ADC12CTL1 = SHP; // Use sampling timer ADC12MCTL0 = INCH_10+SREF_1; // Select channel A10, Vref+ ADC12IE = 0x01; // Enable ADC12IFG.0 for (i=0; i<0x3600; i++) // Delay for reference start-up { } ADC12CTL0 |= ENC; // Enable conversions _EINT(); // Enable interrupts while(1) { ADC12CTL0 |= ADC12SC; // Start conversion _BIS_SR(LPM0_bits); // Enter LPM0 // DegC = (Vsensor - 986mV)/3.55mV // Vsensor = (Vref)(ADCresult)/4095) // DegC -> ((ADCresult - 1615)*704)/4095 DegC = ((((long)ADCresult-1615)*704)/4095); DegF = ((DegC * 9/5)+32); // Calculate DegF _NOP(); // SET BREAKPOINT HERE } }
void EEPROM_AckPolling(void) // Description: // Acknowledge Polling. The EEPROM will not acknowledge if a write cycle is // in progress. It can be used to determine when a write cycle is completed. { unsigned int count; while (I2CDCTL&I2CBB); // wait until I2C module has finished all operations U0CTL &= ~I2CEN; // clear I2CEN bit => necessary to re-configure I2C module I2CTCTL |= I2CRM; // transmission is software controlled U0CTL |= I2CEN; // enable I2C module I2CIFG = NACKIFG; // set NACKIFG while (NACKIFG & I2CIFG) { I2CIFG=0x00; // clear I2C interrupt flags U0CTL |= MST; // define Master Mode I2CTCTL |= I2CTRX; // I2CTRX=1 => Transmit Mode (R/W bit = 0) _DINT(); // **** disable interrupts. following code lines should not be interrupted (time critical!!!) I2CTCTL |= I2CSTT; // start condition is generated while (I2CTCTL&I2CSTT); // wait till I2CSTT bit was cleared I2CTCTL |= I2CSTP; // stop condition is generated after slave address was sent // => I2C communication is started _EINT(); //**** enable interrupts again while (I2CDCTL&I2CBB); // wait till stop bit is reset } U0CTL &= ~I2CEN; // clear I2CEN bit => necessary to re-configure I2C module I2CTCTL &= ~I2CRM; // transmission is by the I2C module U0CTL |= I2CEN; // enable I2C module return; }
void main(void) { volatile unsigned int i; // Use volatile to prevent removal WDTCTL = WDTPW + WDTHOLD; // Stop watchdog if (CALBC1_1MHZ ==0xFF || CALDCO_1MHZ == 0xFF) { while(1); // If calibration constants are erased // do not load, trap CPU!! } BCSCTL1 = CALBC1_1MHZ; // Set DCO DCOCTL = CALDCO_1MHZ; P1OUT = 0xC0; // P1.6 & P1.7 Pullups P1REN |= 0xC0; // P1.6 & P1.7 Pullups P1DIR = 0xFF; // Unused pins as outputs P2OUT = 0; P2DIR = 0xFF; USICTL0 = USIPE6+USIPE7+USIMST+USISWRST;// Port & USI mode setup USICTL1 = USII2C+USIIE; // Enable I2C mode & USI interrupt USICKCTL = USIDIV_3+USISSEL_2+USICKPL;// Setup USI clocks: SCL = SMCLK/8 (~120kHz) USICNT |= USIIFGCC; // Disable automatic clear control USICTL0 &= ~USISWRST; // Enable USI USICTL1 &= ~USIIFG; // Clear pending flag _EINT(); while(1) { USICTL1 |= USIIFG; // Set flag and start communication LPM0; // CPU off, await USI interrupt _NOP(); // Used for IAR for (i = 0; i < 5000; i++); // Dummy delay between communication cycles } }
void SystemInit(void) { /*下面六行程序关闭所有的IO口*/ P1DIR = 0XFF;P1OUT = 0XFF; P2DIR = 0XFF;P2OUT = 0XFF; P3DIR = 0XFF;P3OUT = 0XFF; P4DIR = 0XFF;P4OUT = 0XFF; P5DIR = 0XFF;P5OUT = 0XFF; P6DIR = 0XFF;P6OUT = 0XFF; WDTCTL = WDTPW + WDTHOLD; // 关闭看门狗 P6DIR |= BIT2;P6OUT |= BIT2; //关闭电平转换 P3SEL |= 0x30; // 选择P3.4和P3.5做UART通信端口 ME1 |= UTXE0 + URXE0; // 使能USART0的发送和接受 UCTL0 |= CHAR; // 选择8位字符 UTCTL0 |= SSEL0; // UCLK = ACLK UBR00 = 0x03; // 波特率9600 UBR10 = 0x00; // UMCTL0 = 0x4A; // Modulation UCTL0 &= ~SWRST; // 初始化UART状态机 IE1 |= URXIE0; // 使能USART0的接收中断 _EINT(); //打开全局中断 }
int main() { WDTCTL = WDTPW + WDTHOLD; // Stop WDT Clock_Init(0,0,0,12); // 12M DCO TimerB_ConMode_Init(2, 4); // 3M的持续计数模式. LCD5110_Init(); LCD5110_Write_String(0,0,LCD_BUFFER1); Drive_UTL_Init(); _EINT(); while(1) //间隔1s 进行一次超声波测距 { ULT_TRIG1; DELAY_US(30); ULT_TRIG0; DELAY_MS(300); Drive_UTL_DISTANCE(); UTL_START_TIME = 0; LCD5110_Long2Char(UTL_BUFFER); LCD5110_Write_String(0,1,0); UTL_FLAG = 0; } }
void uart_report(char *line) { to_print = line; #if 0 char *buf = report; unsigned int cnt1_A; _DINT(); cnt1_A = cnt1_a; cnt1_a = 0; _EINT(); buf = cat_ul(buf, jiffies); buf = cat_str(buf, "\t"); buf = cat_ul(buf, cnt1_A); buf = cat_str(buf, "\t"); buf = cat_ul(buf, cnt1_b); # if 0 buf = cat_ul(buf, curr_state); buf = cat_str(buf, "\t"); buf = cat_ul(buf, temp_up); buf = cat_str(buf, "\t"); buf = cat_ul(buf, temp_bottom); buf = cat_str(buf, "\t"); buf = cat_ul(buf, temp_ctl); #endif buf = cat_str(buf, "\r\n"); *buf = 0; #endif i = 0; IE2 |= UCA0TXIE; }
void can_init() { uint8_t ie; // CS pin - inactive HIGH, active LOW CAN_SPI_CS_PORTOUT |= CAN_SPI_CS_PORTBIT; CAN_SPI_CS_PORTDIR |= CAN_SPI_CS_PORTBIT; // IRQ pin CAN_IRQ_PORTIE &= ~CAN_IRQ_PORTBIT; CAN_IRQ_PORTDIR &= ~CAN_IRQ_PORTBIT; CAN_IRQ_PORTREN |= CAN_IRQ_PORTBIT; CAN_IRQ_PORTOUT |= CAN_IRQ_PORTBIT; CAN_IRQ_PORTIES |= CAN_IRQ_PORTBIT; CAN_IRQ_PORTIFG &= ~CAN_IRQ_PORTBIT; CAN_IRQ_PORTIE |= CAN_IRQ_PORTBIT; spi_init(); can_spi_command(MCP2515_SPI_RESET); __delay_cycles(160000); mcp2515_ctrl = MCP2515_CANCTRL_REQOP_CONFIGURATION; can_w_reg(MCP2515_CANCTRL, &mcp2515_ctrl, 1); ie = MCP2515_CANINTE_RX0IE | MCP2515_CANINTE_RX1IE | MCP2515_CANINTE_ERRIE | MCP2515_CANINTE_MERRE; can_w_reg(MCP2515_CANINTE, &ie, 1); mcp2515_irq = 0x00; mcp2515_txb = 0x00; mcp2515_exmask = 0x00; _EINT(); }
void main(void) { unsigned int i; WDTCTL = WDTPW + WDTHOLD; // Stop WDT BCSCTL1 |= XTS; // ACLK = LFXT1 = HF XTAL do { IFG1 &= ~OFIFG; // Clear OSCFault flag for (i = 0xFF; i > 0; i--); // Time for flag to set } while ((IFG1 & OFIFG) != 0); // OSCFault flag still set? BCSCTL2 |= SELM1+SELM0; // MCLK = LFXT1 (safe) UCTL0 = CHAR; // 8-bit character UTCTL0 = SSEL0; // UCLK = ACLK UBR00 = 0x74; // 3.58Mhz/9600 - 372 UBR10 = 0x01; // UMCTL0 = 0x00; // no modulation ME1 |= UTXE0 + URXE0; // Enable USART0 TXD/RXD IE1 |= URXIE0; // Enable USART0 RX interrupt P3SEL |= 0x30; // P3.4,5 = USART0 TXD/RXD P3DIR |= 0x10; // P3.4 output direction _EINT(); // Enable interrupts for (;;) { _BIS_SR(CPUOFF); // Enter LPM0 _NOP(); // Required only for C-spy } }
void main(void) { WDTCTL = WDTPW +WDTHOLD; // Stop WDT initializeUART(); // Setup UART for RS-232 P6DIR &= ~0x05; // Configure P6.3 and P6.7 as input pins P6SEL |= 0x05; // Configure P6.3 and P6.7 as analog pins //Set up timer to send ADC info to PC overy 100 ms TACCR0 = 3277; //3277 / 32768 Hz = 0.1s TACTL = TASSEL_1 + MC_1; //ACLK, up mode TACCTL0 = CCIE; //enabled interupt //Set up ADC 12 ADC12CTL0 = ADC12ON + SHT0_6 + MSC; // configure ADC converter ADC12CTL1 = SHP + CONSEQ_1; // Use sample timer, single sequence ADC12MCTL0 = INCH_0; // ADC chan 0 is A3 pin - Stick X-axis ADC12MCTL1 = INCH_5 + EOS; // ADC chan 1 is A7 pin - Stick Y-axis //EOS - End of Sequence for Conversions ADC12IE |= 0x02; // Enable ADC12IFG.8 for (int i = 0; i < 0x3600; i++); // Delay for reference start-up ADC12CTL0 |= ENC; // Enable conversions _EINT(); while (1) { ADC12CTL0 |= ADC12SC; // Start conversions __bis_SR_register(LPM0_bits + GIE); // enter LPM0 } }
int main(void) { InitBigEZDriver(); _EINT(); while (1) { // UART interface event handler if (IsUARTEnabled()) { if (packetReceived) { packetReceived = 0; ParseUARTMsg(); } if (sendAck) { sendAck = 0; SendUARTMsg(&msgType, TXMSGPACKETACK, 1); } } // Motor controller event handler if (motorParamsUpdateFlag) { motorParamsUpdateFlag = 0; SelectStepSize(motorStepSize); ChangeMotorDirection(motorDir); ChangeMotorSpeed(motorSpeed); EnableMotor(motorEnabled); } } }
void main(void) { WDTCTL = WDTPW + WDTHOLD; // Stop watchdog if (CALBC1_1MHZ ==0xFF || CALDCO_1MHZ == 0xFF) { while(1); // If calibration constants erased // do not load, trap CPU!! } BCSCTL1 = CALBC1_1MHZ; // Set DCO DCOCTL = CALDCO_1MHZ; P1OUT = 0xC0; // P1.6 & P1.7 Pullups P1REN |= 0xC0; // P1.6 & P1.7 Pullups P1DIR = 0xFF; // Unused pins as outputs P2OUT = 0; P2DIR = 0xFF; USICTL0 = USIPE6+USIPE7+USISWRST; // Port & USI mode setup USICTL1 = USII2C+USIIE+USISTTIE; // Enable I2C mode & USI interrupts USICKCTL = USICKPL; // Setup clock polarity USICNT |= USIIFGCC; // Disable automatic clear control USICTL0 &= ~USISWRST; // Enable USI USICTL1 &= ~USIIFG; // Clear pending flag _EINT(); while(1) { LPM0; // CPU off, await USI interrupt _NOP(); // Used for IAR } }
int main( void ) { WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer BCSCTL1 = CALBC1_1MHZ; // Set range (1 Mhz) DCOCTL = CALDCO_1MHZ; // Set DCO step + modulation */ SPI_Master_Init(); P1OUT &= ~(BIT0 + BIT1); // Set P1.0 and P1.1 to 0 (when output) P1DIR |= (BIT0 + BIT1); // Set P1.0 and P1.1 to output direction timerInterruptFlag=CLEAR; ConfigTimer0(); //Configure Timer0 Module //for 10 ms interrupt _EINT(); // enable (general) interrupts //eint <-----> bis #8,sr //example of a timed loop: for(;;) { // loop forever while(timerInterruptFlag != SET); // loop forever while Flag not SET timerInterruptFlag=CLEAR; // Clear timer flag Counter(); } return 0; }
int main() { WDTCTL = WDTPW + WDTHOLD; // Stop WDT Clock_Init(0,0,0,1); // 1M DCO Drive_Init(0, 100); LCD5110_Init(); LCD5110_Write_String(0,0,LCD_BUFFER1); _EINT(); while(1) { if(SPEED_DISPLAY_FLAG == 1) { SPEED_DISPLAY_FLAG = 0; SPEED_L = Drive_Speed_L(); SPEED_R = Drive_Speed_R(); LCD5110_Long2char(SPEED_L / 5); LCD5110_Write_String(0,1,LCD5110_BUFFER); LCD5110_Long2char(SPEED_R / 5); LCD5110_Write_String(0,2,LCD5110_BUFFER); } } }
void main(void) { #if defined(MAX_UART_RX_BUF_CNT) || defined(MAX_UART_TX_BUF_CNT) #error "Comment out MAX_UART_RX_BUF_CNT and MAX_UART_TX_BUF_CNT in config.h for this example" #endif WD_STOP(); ClockConfig(16); HardwareInit(); // init uart at 115k UartInit(115200); _EINT(); printf("\n\nEnter your name: "); static uint8_t buf[20]; uint8_t* cur_char = &buf[0]; while(1) { // The code will stop here and wait for a character to be received while((*cur_char++ = getchar()) == '\r') { printf("\nHello %s",buf); } } }
void main(void) { initClocks(); initUARTSdCard(); initUARTBot(); initLEDs(); //initLEDWait(); // Sleep for 5 sec: 5*8MHz. initUartBuffer(); _EINT(); /*initCorrect = checkSDCardStatus(); // Enables/Disables the main while loop if (initCorrect) { StartUpSequence(); } else { blinkLED8(1); }*/ initCorrect = 1; OperationMode = Listening; P1OUT &= ~BIT4; // P1IES &= ~BIT4; // P1.4 Lo/Hi edge P1IE |= BIT4; // P1.4 interrupt enabled P1IFG &= ~BIT4; // P1.4 IFG cleared while(initCorrect){ switch (OperationMode) { case Broadcasting: broadCast(); OperationMode = Listening; break; case Counting: break; case Listening: __bis_SR_register(LPM3_bits + GIE); // Enter LPM4 w/interrupt PJOUT ^= BIT3; // P1.0 = toggle //P1IE |= BIT4; // P1.4 interrupt enabled timeKeeper(); PJOUT ^= BIT3; break; case Saving: savingToSdCard(); break; default: OperationMode = Listening; break; } } }
//*************************************************************************************** // * // void MenuMessage(): 菜单消息管理 * // * //*************************************************************************************** void MenuMessage(unsigned char Message) { _DINT() ; switch(Message) { case Update: Redraw_Menu(First_Index,Active_Index) ; break ; case Up: if(Active_Index==0) break ; else Active_Index-- ; if(Active_Index<First_Index) if(First_Index>0) First_Index -- ; UpDate_Menu(First_Index,Active_Index) ; break ; case Down: if(Active_Index==Menu.MenuConfig[0]-1) break ; else { Active_Index++ ; if(Active_Index>First_Index+6) First_Index++ ; UpDate_Menu(First_Index,Active_Index) ; } break ; case Left: if(First_Index-7>0) { First_Index -= 7 ; Active_Index = First_Index + 6 ; Redraw_Menu(First_Index,Active_Index) ; } else if(First_Index!=0) { First_Index = 0 ; Active_Index = First_Index ; Redraw_Menu(First_Index,Active_Index) ; } break ; case Right: if(First_Index+Dis_Menu_Num<Menu.MenuConfig[0]) { First_Index += Dis_Menu_Num ; Active_Index = First_Index ; if(First_Index+7>Menu.MenuConfig[0]) { Active_Index = Menu.MenuConfig[0]-1 ; First_Index = Active_Index-6 ; } Redraw_Menu(First_Index,Active_Index) ; } break ; } MenuUpdated = 0x00 ; _EINT() ; }
void init_timera(void) { TACTL=TASSEL_1+TACLR; CCTL0=CCIE; CCR0=32768; TACTL|=MC1; _EINT(); }
static void fifo_wr(fifo_t * fp, char c) { fp->b[fp->i] = c; _DINT(); // only need to disable tx irq for this stream fifo_advance(&fp->i); fp->count++; _EINT(); }
void timer_set_alarm(char hours, int secs ) { _DINT(); timer.stat = TIMER_RUN; timer.hours = hours; timer.secs = secs; _EINT(); }
/*---------------------------------------------------------------------------*/ void flash_done(void) { /* Enable interrupts. */ IE1 = ie1; IE2 = ie2; _EINT(); }