4015 views|8 replies

15

Posts

0

Resources
The OP
 

MSP430 digital tube display problem [Copy link]

When I was familiar with MSP430F149 recently, I used a learning board to program an eight-digit digital tube to display the numbers 0-7 in a cycle. I found that after downloading the program into 430 using the downloader, the segment code displayed normally, but the bit code was always abnormal, and each time the microcontroller was powered on, the result displayed by the digital tube was different, and the program running results were different each time. I would like to ask all the experts to help me figure out what is going on. Thank you very much! The program code and learning board circuit diagram are as follows: #include "msp430x14x.h" void delay( int i) { while(i>0) { i--; } } int cnt; int n; int duanma[16] = {0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,0x77,0x7c,0x39,0x5e,0x79,0x71}; int weima[8] = {0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f}; void main( void ) { // Stop watchdog timer to prevent time out reset WDTCTL = WDTPW + WDTHOLD; //Clock setting of time base module //When the microcontroller is powered on, the source of the MCLK main clock is selected by default as provided by DCO. The default setting of the F1 series DCO is 800KHZ. //The default setting of the ACLK auxiliary clock is XT1, and XT1 is generally connected to a 32768HZ crystal. //The default setting of the SMCLK sub-clock is DCO, which is also 800KHZ. //XT2 needs to be turned on manually, and it is necessary to detect whether it is turned on successfully. BCSCTL1 &= ~(XT2OFF + XTS); //Start the XT2 high-speed clock module// BCSCTL3 |= XT2S3; //XT2 was just turned on, and it takes a certain amount of time for XT2 to enter a stable state. So it is necessary to wait and detect the stable state. do { IFG1 &=~OFIFG; //Clear OSCFault flag for(n=0xff;n>0;n--); //Delay and wait for it to turn on and stabilize} while((IFG1 & OFIFG) !=0); //Check whether the OSCFault flag is 0. If it is 0, it means that XT2 is turned on and stabilized. //Otherwise keep waiting... BCSCTL2 |= SELM1; //MCLK master clock selects XT2 as the clock source. TX2 input is not divided. BCSCTL2 &= ~SELS; //SMCLK selects DCO as the clock source. //----------------------------------------------- //-----------------Initialize IO ports P1DIR = 0xff; P1OUT = 0xff; P2DIR = 0xff; P2OUT = 0xff; P3DIR = 0xff; P3OUT = 0xff; P4DIR = 0xff; P4OUT = 0xff; P5DIR = 0xff; P5OUT = 0x5f; P6DIR = 0xff; P6OUT = 0xbf; cnt = 0;//------------------ TACCTL0 = CCIE; CCR0 = 8000; TACTL = TASSEL_2 + MC_1; _EINT(); while(1); } #pragma vector=TIMER0_A0_VECTOR __interrupt void Timer_A (void) { _DINT(); while(cnt<8) { P4OUT = duanma[cnt]; P6OUT |= BIT6; delay(10); P6OUT = 0x00; P4OUT = weima[cnt]; P5OUT |= BIT5; delay(10); P5OUT = 0x00; delay(30000); delay(30000); delay(30000); delay(30000); delay(30000); delay(30000); delay(30000); delay(30000); delay(30000); delay(30000); delay(30000); delay(30000); delay(30000); cnt++; } cnt = 0; _EINT(); }


TIM截图20181115103000.jpg (74.81 KB, downloads: 0)

TIM截图20181115103000.jpg
This post is from Microcontroller MCU

Latest reply

Therefore, microcontroller debugging is not just program debugging, but also hardware circuit debugging.  Details Published on 2018-12-7 18:43
 

3

Posts

0

Resources
2
 
The segment select and bit select of the digital tube connected through 74HC573 should not be connected to the same group of IO ports (PD0~PD7) ---> P4
This post is from Microcontroller MCU
 
Personal signature吾乃等闲之辈,从黄昏到黎明
 

15

Posts

0

Resources
3
 
tuago尤 posted on 2018-11-15 11:09 The segment select and bit select of the digital tube connected through 74HC573 should not be connected to the same group of IO ports (PD0~PD7)--->P4
Thank you for your reply! However, this hardware connection diagram has been drawn on the learning board, so we have no way to modify it when we use it. If you draw the board yourself, you can consider trying this way. Based on this hardware, theoretically, the above functions can be achieved through the control of P55 and P66.
This post is from Microcontroller MCU
 
 
 

40

Posts

0

Resources
4
 
Don't understand code
This post is from Microcontroller MCU
 
Personal signature导热材料www.jrftdz.com
 
 

15

Posts

0

Resources
5
 
szjrft posted on 2018-11-15 15:21 I don’t understand code
This post is from Microcontroller MCU
 
 
 

15

Posts

0

Resources
6
 
Solved! The problem lies in the circuit design of the learning board itself! Because the learning board may not have taken into account the load capacity of the microcontroller pin when designing the circuit, the microcontroller pin P55 is directly connected to the above-mentioned 74HC573 shift register. At the same time, P55 is also connected to an 8-way bus transceiver and a 3.3V to 5V SN74LVC4245 chip as shown below, resulting in the high-level voltage output by the microcontroller P55 pin being only about 0.3V. The correct logical judgment cannot be achieved on the 74HC573, which leads to problems with the digital tube shift! Get it! Learned!
This post is from Microcontroller MCU
 
 
 

19

Posts

0

Resources
7
 
I just came to take a look.
This post is from Microcontroller MCU
 
Personal signature北京玻璃隔断www.bjtjblgd.com 法兰厂家www.zsfl888.com 丁基胶带www.djjd8.com 薄膜开关www.hbhksjdz.com
 
 

2618

Posts

0

Resources
8
 
I learned a lot from following this, it’s a good post
This post is from Microcontroller MCU
 
 
 

6366

Posts

4929

Resources
9
 
Therefore, microcontroller debugging is not just program debugging, but also hardware circuit debugging.
This post is from Microcontroller MCU
 
 
 

Guess Your Favourite
Find a datasheet?

EEWorld Datasheet Technical Support

Related articles more>>
Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list