⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 disp.c

📁 利用aRM编程实现点阵的显示功能
💻 C
字号:


#include "config.h"
#include "disp.h"

void delay()
{
	uint8 i;
	for(i=100;i>0;i--);
}
void init_7289()
{
	PINSEL0=0;
	PINSEL1=0;
	IO0DIR=IO0DIR|key_cs;// cs,dat,clk设置为输出
	IO0DIR=IO0DIR|key_clk;
	IO0DIR=IO0DIR|key_dat;
	
	IO0SET=key_cs;
}
void send_key(uint8 cmd)
{
	uint8 i,k;
	k=cmd;
	for(i=8;i>0;i--)
	{	
		
		IO0CLR=key_clk;
		delay();
		if(k&0x80)IO0SET=key_dat;
		else IO0CLR=key_dat;
		IO0SET=key_clk;
		delay();
		IO0CLR=key_clk;
		delay();
		k<<=1;
	}
}

void sendcmd_key(uint8 cmd)
{
	IO0CLR=key_cs;
	send_key(cmd);
	IO0SET=key_cs;
}
void senddat_key(uint8 cmd,uint8 dat)
{
	IO0CLR=key_cs;
	send_key(cmd);
	delay();
	send_key(dat);
	IO0SET=key_cs;
}



void disp_uint32(uint32 dat)
{
	uint8 i;
	uint32 k;
	k=dat;
	i=(uint8)k;
	sendcmd_key(reset_7289);
	senddat_key(disp1_7289|7,i&0x0f);
	k>>=4;
	i=(uint8)k;
	senddat_key(disp1_7289|6,i&0x0f);
	k>>=4;
	i=(uint8)k;
	senddat_key(disp1_7289|5,i&0x0f);
	k>>=4;
	i=(uint8)k;
	senddat_key(disp1_7289|4,i&0x0f);
	k>>=4;
	i=(uint8)k;
	senddat_key(disp1_7289|3,i&0x0f);
	k>>=4;
	i=(uint8)k;
	senddat_key(disp1_7289|2,i&0x0f);
	k>>=4;
	i=(uint8)k;
	senddat_key(disp1_7289|1,i&0x0f);
	k>>=4;
	i=(uint8)k;
	senddat_key(disp1_7289|0,i&0x0f);

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -