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

📄 4094.c

📁 14094串并转换静态显示LED 14094串并转换静态显示LED
💻 C
字号:
#include <iom32v.h>
#include "common.h"
#include "display.h"
#include "wh_4008a.h"


//无小数点
const uchar table1[17]={0x81,0xed,0x43,0x49,0x2d,0x19,0x11,0xcd,0x01,0x09,0x71,0x31,0x93,0x61,0x13,0x17,0xff};


//有小数点
const uchar table2[17]={0x80,0xec,0x42,0x48,0x2c,0x18,0x10,0xcc,0x00,0x08,0x70,0x30,0x92,0x60,0x12,0x16,0xff};


//显示缓冲区,初始值为1,2,3,4,5,6
uchar led_buffer[15]={0,0};

/*
struct display_buffer
{
uchar code_head;
uchar area_num[11];
uchar function_code;
uchar user_num[4];
uchar data[2];
uchar code_tail;
uchar zero;
};
*/


void update_display_dp(void)
{

uchar bit_count=0;
uchar table_counter=0;
uchar byte_counter=0;
uchar temp_i=0;

led_str_out ;
led_d_out;
led_clk_out;


led_str_off;//先清零
led_clk_off;
for(byte_counter=0;byte_counter<14;byte_counter++)
	{
	bit_count=8;
	temp_i=table2[led_buffer[byte_counter]];
	nop;
	while(bit_count>0)
		{
		if((temp_i&0x80)==0)
			{
			led_d_off;
			}
		else
			{
			led_d_on;
			}
		temp_i=(temp_i<<1);
		
		nop;
		led_clk_on;
		nop;
		led_clk_off;
		nop;
		
		bit_count--;			
		
		}
	
	}

	led_str_on;
}





void update_display(void)
{

uchar bit_count=0;
uchar table_counter=0;
uchar byte_counter=0;
uchar temp_i=0;

//led_str_out ;
//led_d_out;
//led_clk_out;

//tiaoshi


putchar_test(led_buffer[13]+0x30);
putchar_test(led_buffer[12]+0x30);
putchar_test(led_buffer[11]+0x30);
putchar_test(led_buffer[10]+0x30);
putchar_test(led_buffer[9]+0x30);
putchar_test(' ');
putchar_test(' ');
putchar_test(' ');
putchar_test(' ');
putchar_test(led_buffer[8]+0x30);
putchar_test(led_buffer[7]+0x30);
putchar_test(led_buffer[6]+0x30);
putchar_test(led_buffer[5]+0x30);
putchar_test(' ');
putchar_test(' ');
putchar_test(' ');
putchar_test(' ');
putchar_test(led_buffer[4]+0x30);
putchar_test(led_buffer[3]+0x30);
putchar_test(led_buffer[2]+0x30);
putchar_test(' ');
putchar_test(' ');
putchar_test(' ');
putchar_test(' ');
putchar_test(led_buffer[1]+0x30);
putchar_test(led_buffer[0]+0x30);
//putchar_test(led_buffer[14]);
putchar_test(0x0a);

//tiaoshi end



led_str_off;//先清零


/*
nop;
nop;
nop;
nop;
led_clk_off;
nop;
nop;
nop;
for(byte_counter=14;byte_counter>0;byte_counter--)
	{
	bit_count=8;
	temp_i=table1[led_buffer[byte_counter-1]];
	
	//第6和10字节有小数点	
	if((byte_counter==7)||(byte_counter==11))
		{
		temp_i&=0xfe;
		}
	nop;
	while(bit_count>0)
		{
		if((temp_i&0x80)==0)
			{
			led_d_off;
			}
		else
			{
			led_d_on;
			}
		temp_i=(temp_i<<1);
		
		nop;
		nop;
		led_clk_on;
		nop;
		nop;
		nop;
		nop;
		led_clk_off;
		nop;
		nop;
		
		bit_count--;			
		
		}
	
	}
//led_clk_on;
nop;
led_str_on;

*/
}



⌨️ 快捷键说明

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