Demo entry 6751482

f

   

Submitted by 11 on Jun 23, 2018 at 14:36
Language: C. Code size: 2.3 kB.

#include "reg52.h"
#include "hd7279.h"
#include "intrins.h"

/***************************************************************************
#define HD7279_RESET   0xa4
#define HD7279_TEST    0xbf
#define HD7279_RLC     0xa3
#define HD7279_RRC     0xa2
#define HD7279_RL    	0xa1
#define HD7279_RR      0xa0

#define HD7279_DECODE0  0x80				//0x80?????????1 10????
#define HD7279_DECODE1  0xc8				//0xC8?????????1 16????
#define HD7279_UNDECODE  0x90				//0x90?????????1 ??????
#define HD7279_HIDE      0x98
#define HD7279_FLASH     0x88
#define HD7279_SEGON     0xe0
#define HD7279_SEGOFF    0xc0

#define HD7279_READ      0x15
1????????????????0????	?????? 1 0 0 0 0 a2 a1 a0     dp x x x d3 d2 d1 d0
2????????????????1????	?????? 1 1 0 0 1 a2 a1 a0     dp x x x d3 d2 d1 d0
3?????????????????			?????? 1 0 0 1 0 a2 a1 a0     dp a b c d e f g
4?????????					?????? 1 0 0 0 1 0 0 0   		d7 d6 d5 d4 d3 d2 d1 d0
5??????????					?????? 1 0 0 1 1 0 0 0     d7 d6 d5 d4 d3 d2 d1 d0
6???ε???????				?????? 1 1 1 0 0 0 0 0     X  X d5 d4 d3 d2 d1 d0
7???ι?????				?????? 1 1 0 0 0 0 0 0     X  X d5 d4 d3 d2 d1 d0

?????????				?????? 0 0 0 1 0 1 0 1     d7 d6 d5 d4 d3 d2 d1 d0

********************************************************************************/


/********************???????, ?????λ1ms
*********************/
unsigned char rev=0xaa;
unsigned char flag=0x00;

void Delay_ms(unsigned int Ms)
{
	int us,usn;
	while(Ms!=0)
	{ 
		usn = 4;
		while(usn!=0)
		{
			us=0xfa;
			while (us!=0){us--;};
			usn--;
		}
		Ms--;
	}
}

void send_int(void)
{     
	TMOD = 0x20;			// ?????1??????8λ?????????, ?????????????
							// ?????0??????16λ???
	TH1 = 0xFD;				// ??????9600
	TL1 = 0xFD;
	SCON = 0x50;			// ?趨???п???????
	PCON= 0x00;			// ?????????		
	TR1 = 1;
}

void send_char(unsigned char txd)
// ??????????
{
	SBUF = txd;
	while(!TI);				// ???????????
	TI = 0;					// ????????????
}


void main()
{
	
	send_byte(HD7279_RESET);//???:HD7279??λ??,?????????25MS,???????????!
	Delay_ms(50);	
	send_int();				//????????

	while(1)
	{		
	   	send_char(0x55);
		if(RI==1)
		{
			rev=SBUF;
			RI=0;	
		}
		write_hd7279(HD7279_DECODE1,rev%16);
		write_hd7279(HD7279_DECODE1+1,rev/16);
	}
}

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).