完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
本人新手,想用430的下降沿触发中断,执行定时器,总是编译通不过,显示 #include #include "msp430.h" #include "HAL_Board.h" #include "HAL_Buttons.h" #include "HAL_Dogs102x6.h" #define trig BIT4 //P2.4-->DQ #define trig1 P2OUT |= BIT4 //DS18B20接口为P2.4口 #define trig0 P2OUT &= ~BIT4 void start(); unsigned int a=0; unsigned int d=0; unsigned char table1[10] = {'0','1','2','3','4','5','6','7','8','9'}; unsigned int s; void main(void) { WDTCTL = WDTPW + WDTHOLD; // Stop WDT P2DIR &= ~BIT3; P6DIR |=BIT7; P6OUT |=BIT7; P2REN |=BIT3; P2OUT &=~BIT3; _EINT(); Board_init(); uint8_t contrast = *((unsigned char *)contrastSetpointAddress); //读取FLASH中对比度值 uint8_t brightness = *((unsigned char *)brightnessSetpointAddress); //读取FLASH中背光值 Dogs102x6_init(); Dogs102x6_backlightinit(); // __enable_interrupt(); Dogs102x6_setBacklight(brightness); //设置初始背光值 Dogs102x6_setContrast(contrast); //设置初始对比度值 Dogs102x6_clearScreen(); TA0CCR0 =32768; TA0CTL = TASSEL_1 + MC_1+TACLR ; // SMCLK, upmode, clear TAR while(1) { // tri; start(); //tri0; // s=a*1.87/100; Dogs102x6_charDraw(2,12,table1[a/100],0); // Dogs102x6_charDraw(2,12,table1[temp%1000/100],0); Dogs102x6_charDraw(2,18,table1[a%100/10],0); Dogs102x6_charDraw(2,36,table1[a%10],0); __delay_cycles(50); } } void start() { trig1; __delay_cycles(6); trig0; } #pragma vector=PORT1_VECTOR __interrupt void port1_int(void) { if((P1IN&BIT1)==BIT1) { TA0CTL|=MC_1+TACLR; P1IES|=BIT1; } else { TA0CTL&=~MC_3; P1IES&=~BIT1; d=a/100*17/10; // P2OUT=TA0R; } P1IFG&=~BIT1; } #pragma vector=TIMER0_A0_VECTOR __interrupt void TIMER0_A0_ISR(void) { a++; // Toggle P1.0 } #include #include "msp430.h" #include "HAL_Board.h" #include "HAL_Buttons.h" #include "HAL_Dogs102x6.h" #define trig BIT4 //P2.4-->DQ #define trig1 P2OUT |= BIT4 //DS18B20接口为P2.4口 #define trig0 P2OUT &= ~BIT4 void start(); unsigned int a=0; unsigned int d=0; unsigned char table1[10] = {'0','1','2','3','4','5','6','7','8','9'}; unsigned int s; void main(void) { WDTCTL = WDTPW + WDTHOLD; // Stop WDT P2DIR &= ~BIT3; P6DIR |=BIT7; P6OUT |=BIT7; P2REN |=BIT3; P2OUT &=~BIT3; _EINT(); Board_init(); uint8_t contrast = *((unsigned char *)contrastSetpointAddress); //读取FLASH中对比度值 uint8_t brightness = *((unsigned char *)brightnessSetpointAddress); //读取FLASH中背光值 Dogs102x6_init(); Dogs102x6_backlightInit(); // __enable_interrupt(); Dogs102x6_setBacklight(brightness); //设置初始背光值 Dogs102x6_setContrast(contrast); //设置初始对比度值 Dogs102x6_clearScreen(); TA0CCR0 =32768; TA0CTL = TASSEL_1 + MC_1+TACLR ; // SMCLK, upmode, clear TAR while(1) { // tri; start(); //tri0; // s=a*1.87/100; Dogs102x6_charDraw(2,12,table1[a/100],0); // Dogs102x6_charDraw(2,12,table1[temp%1000/100],0); Dogs102x6_charDraw(2,18,table1[a%100/10],0); Dogs102x6_charDraw(2,36,table1[a%10],0); __delay_cycles(50); } } void start() { trig1; __delay_cycles(6); trig0; } #pragma vector=PORT1_VECTOR __interrupt void port1_int(void) { if((P1IN&BIT1)==BIT1) { TA0CTL|=MC_1+TACLR; P1IES|=BIT1; } else { TA0CTL&=~MC_3; P1IES&=~BIT1; d=a/100*17/10; // P2OUT=TA0R; } P1IFG&=~BIT1; } #pragma vector=TIMER0_A0_VECTOR __interrupt void TIMER0_A0_ISR(void) { a++; // Toggle P1.0 } |
|
相关推荐 |
|
你正在撰写答案
如果你是对答案或其他答案精选点评或询问,请使用“评论”功能。
《DNESP32S3使用指南-IDF版_V1.6》第三十五章 摄像头实验
492 浏览 0 评论
《DNESP32S3使用指南-IDF版_V1.6》第三十章 DHT11数字温湿度传感器
638 浏览 0 评论
742 浏览 0 评论
【敏矽微ME32G070开发板免费体验】之原厂2812测试例程解析
1263 浏览 0 评论
1133 浏览 2 评论
【youyeetoo X1 windows 开发板体验】少儿AI智能STEAM积木平台
12055 浏览 31 评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-28 08:39 , Processed in 0.670707 second(s), Total 70, Slave 53 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号