-
ucos3 在stm32f401上不能进入硬件定时器中断 sos
[p=24, null, left][color=rgb(34, 34, 38)][backcolor=rgb(255, 255, 255)][font=-apple-system, "][size=16px]ucos3 不能进入硬件中断函数的问题[/size][/font][/backcolor][/color][/p][p=24, null, left][color=rgb(34, 34, 38)][backcolor=rgb(255, 255, 255)][font=-apple-system, "][size=16px]请问一下各位,芯片是stm32f401,我在学习ucos的过程中发现当我把startup文件中的 .word PendSV_Handler .word SysTick_Handler 换成 .word OS_CPU_PendSVHandler .word OS_CPU_SysTickHandler这两个函数以后,程序将不能进入硬件定时器的中断函数,如果不能进入硬件定时器中断函数的话那这个系统就不能干精确的活了,比如说我要输出一个十个周期的pwm,所以请问一下各位,在ucos中如果要进入硬件定时器中断函数应该怎么做啊,谢谢[/size][/font][/backcolor][/color][/p]
1247浏览量 0回复量 关注量 -
HC32L190 定时器中断不进入
使用华大单片机碰到一些问题,不知道有人能帮我解决吗? void time0_Init(void) { uint16_t u16ArrValue; uint16_t u16CntValue; stc_bt_mode0_cfg_t stcBtBaseCfg; DDL_ZERO_STRUCT(stcBtBaseCfg); Sysctrl_SetPeripheralGate(SysctrlPeripheralBaseTim, TRUE); stcBtBaseCfg.enWorkMode = BtWorkMode0; stcBtBaseCfg.enCT = BtTimer; stcBtBaseCfg.enPRS = BtPCLKDiv16; stcBtBaseCfg.enCntMode = Bt16bitArrMode; stcBtBaseCfg.bEnTog = FALSE; stcBtBaseCfg.bEnGate = FALSE; stcBtBaseCfg.enGateP = BtGatePositive; Bt_Mode0_Init(TIM0, &stcBtBaseCfg); u16ArrValue = 0x10000 - 1600; Bt_M0_ARRSet(TIM0, u16ArrValue); u16CntValue = 0x10000 - 1600; Bt_M0_Cnt16Set(TIM0, u16CntValue); Bt_ClearIntFlag(TIM0,BtUevIrq); Bt_Mode0_EnableIrq(TIM0); EnableNvic(TIM0_IRQn, IrqLevel3, TRUE); } 我开启定时中断,为什么不进入中断,而且我发现整个中断函数都不运行,不知道怎么回事,有人知道吗? 还有就是我使用模拟IIC,来读取DS1307,读到的数据全是0 void DS1302_Init(void) { stc_gpio_cfg_t stcGpioCfg; Sysctrl_SetPeripheralGate(SysctrlPeripheralGpio, TRUE); stcGpioCfg.enDir = GpioDirOut; stcGpioCfg.enDrv = GpioDrvH; stcGpioCfg.enPu = GpioPuEnable; stcGpioCfg.enPd = GpioPdDisable; stcGpioCfg.enOD = GpioOdDisable; stcGpioCfg.enCtrlMode = GpioAHB; stcGpioCfg.bOutputVal = TRUE; Gpio_Init(GpioPortB, GpioPin3, &stcGpioCfg); Gpio_Init(GpioPortB, GpioPin4, &stcGpioCfg); if(Read_DS1302(0x08) != 0xF0) { Write_DS1302(write_address[0], 0x30); //Ãë Write_DS1302(write_address[1], 0x09); //·Ö Write_DS1302(write_address[2], 0x15); //ʱ Write_DS1302(write_address[3], 0x29); //ÈÕ Write_DS1302(write_address[4], 0x09); //Ô Write_DS1302(write_address[5], 0x03); //ÖÜ Write_DS1302(write_address[6], 0x21); //Äê Write_DS1302(0x08, 0xF0); } } 这是什么原因
2530浏览量 3回复量 关注量 -
msp430f5529 进不了定时器中断
程序如下,但是进不了中断,有谁知道可以告诉我么? char buffer[255]; int flag = 0,cont = 0; char data[3]= {'0','0','\0'}; uint8_t data1 = 0; uint16_t intialWheelValue = 0; uint16_t wheelValue = 0; FRESULT WriteFile(char* fileName, char* text, WORD size); void TimerB_Init(void); void DataAcq() { char data[3]= {'0','0','\0'}; uint8_t data1 = 0; uint16_t intialWheelValue = 0; uint16_t wheelValue = 0; TimerB_Init(); Dogs102x6_init(); Dogs102x6_clearScreen(); Buttons_interruptEnable(BUTTON_ALL); //按键中断使能 buttonsPressed = 0; intialWheelValue = Wheel_getValue(); // 得到初始齿轮电位计采样值 __enable_interrupt(); //使能全局中断 while(!(buttonsPressed & BUTTON_S2)){ Dogs102x6_stringDraw(3, 45, &data[0], DOGS102x6_DRAW_INVERT); //显示数 wheelValue = Wheel_getValue(); data1 = wheelValue/68; //得到当前齿轮电位计采样值 if (intialWheelValue != wheelValue){ //若当前齿轮电位计采样值与初始齿轮电位计采样值不同,进行小时重置 if (data1 < 10){ data[0] = '0'; data[1] = '0' + data1; } else if (data1 < 20){ data[0] = '1'; data[1] = '0' + (data1 - 10); } else if (data1 < 30){ data[0] = '2'; data[1] = '0' + (data1 - 20); } else if (data1 < 40){ data[0] = '3'; data[1] = '0' + (data1 - 30); } else if (data1 < 50){ data[0] = '4'; data[1] = '0' + (data1 - 40); } else if (data1 < 60){ data[0] = '5'; data[1] = '0' + (data1 - 50); } else { data[0] = '6'; data[1] = '0'; } } } } FRESULT WriteFile(char* fileName, char* text, WORD size) { // Result code FRESULT rc; // File system object FATFS fatfs; // File object FIL fil; UINT bw; // Register volume work area (never fails) f_mount(0, &fatfs); // Open file rc = f_open(&fil, fileName, FA_READ | FA_WRITE | FA_OPEN_ALWAYS); if (rc) { die(rc); } //指针指到文本最后 rc = f_lseek(&fil, f_size(&fil)); if(rc) { die(rc); } // Write to file rc = f_write(&fil, text, size, &bw); if (rc) { die(rc); } // Close the file rc = f_close(&fil); if (rc) { die(rc); } return rc; } /*定时器初始化*/ void TimerB_Init(void) { TB0CCR0 = 32768; TB0CTL = TBSSEL_0+TBCLR+MC_1; // TB0CCTL0 = CCIE; } #pragma vector = TIMERB0_VECTOR __interrupt void Timer_B0(void) { cont = cont+1; if(cont == 1) { cont = 0; flag = 1; buffer[0] = '['; buffer[1] = data[0]; buffer[2] = data[1]; buffer[3] = ']'; WriteFile("1.txt",buffer,4); //写入数据 } }
789浏览量 1回复量 关注量