main_old.c

来自「这是用于proteus仿真软件的程序源码」· C语言 代码 · 共 48 行

C
48
字号
/************************************************************/
/* Function:                                                */
/*                                                          */
/* Example Analogue convertor program for LPC2100 			*/
/*															*/
/* Demonstrates A/Dconversion in hardware mode with 		*/
/*															*/	
/* Oscillator frequency 12.000 Mhz							*/
/* Target board Keil MCB2100								*/
/************************************************************/

#include <lpc210x.h>
#include "LCD1602.h"

float AD_r=0.66;
unsigned char Dis_Value[5];

int main(void)
{
	PINSEL0=0x00000000;
	PINSEL1=0x00000000;
	IODIR= 0x7ff;
	
	
	LCD_Initial();
	GotoXY(0,0);
	
	Dis_Value[1]=46;
	Dis_Value[4]=0;
	
	Dis_Value[0]= (unsigned char)(AD_r)%10+0x30;
	Dis_Value[2]=(unsigned char)(AD_r*10)%10;
	Dis_Value[3]=(unsigned char)(AD_r*100)%10;
	
	Dis_Value[2]=(unsigned char)(AD_r*10)%10+0x30;
	Dis_Value[3]=(unsigned char)(AD_r*100)%10+0x30;
	
	Print("Volt:     (V)");

	while(1)
	{
		GotoXY(6,0);
		Print(Dis_Value);
	}
	
}
 

⌨️ 快捷键说明

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