#include<msp430f169.h> unsigned char Tab[10]={0x3F,0x06,0x5B,0x4F,0x66,0x6D,0x7D,0x07,0x7F,0x6F}; unsigned char Pos[4]={0x0E,0x0D,0x0B,0x07}; unsigned char Buf[4]={2,0,0,8}; void main(){ unsigned int n,j; WDTCTL=WDTPW+WOTHOLD; P1DIR|=0xFF; P1OUT|=0XFF; P2DIR|=0X0F; P2OUT|=0X0F; while(1){ for(n=0;n<4;n++){ P2OUT=Pos[n]; P1OUT=Tab[Buf[n]]; for(i=0;i<6000;i++); } } }
Through the effect of visual persistence, as long as the lamp flashes fast enough, dynamic display can be achieved.