display.c

来自「环保型IC卡门禁系统的C程序」· C语言 代码 · 共 50 行

C
50
字号
#include <iom8v.h>
#include <macros.h>
#include "lcd1602.h"

void display(unsigned char Num , unsigned char position)
{
  unsigned char line=0 ;
  
  if(position<16)  { line=0; }
  else      { position -= 16 ;  line=1; }
  
  switch (Num) 
  {
	case 0 : LCD_write_string(position,line,"0");
	         break ;
	case 1 : LCD_write_string(position,line,"1");
	         break ;
	case 2 : LCD_write_string(position,line,"2");
	         break ;
	case 3 : LCD_write_string(position,line,"3");
	         break ;
	case 4 : LCD_write_string(position,line,"4");
	         break ;
	case 5 : LCD_write_string(position,line,"5");
	         break ;
	case 6 : LCD_write_string(position,line,"6");
	         break ;
	case 7 : LCD_write_string(position,line,"7");
	         break ;
	case 8 : LCD_write_string(position,line,"8");
	         break ;
	case 9 : LCD_write_string(position,line,"9");
	         break ;
	case 10 : LCD_write_string(position,line,"a");
	         break ;
	case 11 : LCD_write_string(position,line,"b");
	         break ;
	case 12 : LCD_write_string(position,line,"c");
	         break ;
	case 13 : LCD_write_string(position,line,"d");
	         break ;
	case 14 : LCD_write_string(position,line,"e");
	         break ;
	case 15 : LCD_write_string(position,line,"f");
	         break ;
	case 16 : LCD_write_string(position,line,"*");
	         break ;
  }
  delay_nms(2);
}

⌨️ 快捷键说明

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