1790 views|1 replies

1668

Posts

0

Resources
The OP
 

Dot matrix display design based on msp430 [Copy link]

The microcontroller used is TI's Launchpad msp430, the dot matrix is 8*8, and the driver chip is two 74HC595;

#include<msp430.h>
const unsigned char tab[]={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f};
const unsigned char digittab[10][8]={ //Font model taking method negative code reverse column type
{0x7C,0x55,0x5F,0x45,0x5F,0x55,0x7C,0x00},/*"西",0*/

{0x16,0x12,0xB2,0x5B,0xB6,0x12,0x12,0x16},/*"安",1*/

{0x7C,0x54,0x7F,0x54,0x7C,0xFE,0x2A,0x3E},/*"邮",2*/

{0x00,0x3E,0x2A,0xFF,0xAA,0xBE,0xC0,0x00},/*"Electricity",3*/

{0x44,0x24,0x14,0x0F,0x14,0x24,0x44,0x00},/*"Big",4*/

{0x06,0x23,0xAA,0xAB,0xFA,0x23,0x22,0x06},/*"Learning",5*/

{0x00,0x00,0x3E,0x49,0x49,0x32,0x00,0x00},/*"6",6*/

{0x00,0x00,0x03,0x71,0x09,0x07,0x00,0x00},/*"7",7*/

{0x00,0x00,0x36,0x49,0x49,0x36,0x00,0x00},/*"8",8*/

{0x00,0x00,0x26,0x49,0x49,0x3E,0x00,0x00},/*"9",9*/
};
unsigned int timecount;
unsigned char cnta;
unsigned char cntb;
#define SD_H P1OUT|=BIT4; //Serial data input
#define SD_L P1OUT&=~BIT4;
#define ST_H P1OUT|=BIT5; //Storage register clock input
#define ST_L P1OUT&=~BIT5;
#define SH_H P1OUT|=BIT6; //Shift register clock input
#define SH_L P1OUT&=~BIT6;

void Ser_IN(unsigned char Data)
{
unsigned char i;
for(i=0; i < 8; i++)
{
SH_L; //clock_MAX=100MHz
IF(Data&0x80)
{
SD_H;
}
else
{
SD_L;
}
Data <<= 1;
SH_H;
}
}
void Par_OUT(void)
{
ST_L;
ST_H;
}
void sysclock()
{
TACTL=TASSEL0+TACLR;
CCTL0=CCIE;
CCR0=2000;
TACTL|=MC0;
_EINT();
//LPM0;
}
void main()
{
WDTCTL=WDTPW+WDTHOLD;
P1SEL&=~(BIT4+BIT5+BIT6);
P1DIR|=BIT4+BIT5+BIT6;
sysclock();
while(1)
{
Ser_IN(tab[cnta]);//8X8 dot array scan
Ser_IN(digittab[cntb][cnta]);//8X8 dot matrix line send scan data
Par_OUT();//74HC595 output display
cnta++;
if(cnta==8)
{
cnta=0;
}
}

}
#pragma vector=TIMER0_A0_VECTOR
__interrupt void timeA0(void)
{
// Ser_IN(tab[cnta]); //8X8 point array scan
//Ser_IN(digittab[cntb][cnta]);//8X8 dot matrix line sends scan data
//Par_OUT();//74HC595 output display
//cnta++;

timecount++;
if(timecount==1)
{
timecount=0;
cntb++;
if(cntb==6)
{
cntb=0;
}
}
}

This post is from Microcontroller MCU

Latest reply

Basic routine, good sharing   Details Published on 2020-7-2 07:15
 

2618

Posts

0

Resources
2
 

Basic routine, good sharing

This post is from Microcontroller MCU
 
 

Guess Your Favourite
Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

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