iic_test.c

来自「使用embest IDE开发工具开发的基于LPC2294 的触摸屏开发」· C语言 代码 · 共 81 行

C
81
字号
/*
***********************************************************************

       Embest Info&Tech Co., Ltd.  All rights reserved.
                     www.embedinfo.com

***********************************************************************

---------------- file information -------------------------------------

file name: IIC_test.c
version  : v0
author   : z.x.q. Embest
begin    : 2006-04-24
finish   : 2006-04-24
define   : IIC_test source file

notes    :
---------------- modify information -----------------------------------
version  :
modify   :
begin    :
finish   :
define   :
-----------------------------------------------------------------------
*/
/*-------------------------------------------------------------------*/
/*                       include files                               */
/*---------------------------------------------------------------- --*/
#include	"..\..\com\lpc_lib_IIC\lpc_lib_IIC.h"

/*-------------------------------------------------------------------*/
/*                     local  function declare                       */
/*-------------------------------------------------------------------*/
void IIC_test(void);
/*-------------------------------------------------------------------*/
/*                       function code                               */
/*-------------------------------------------------------------------*/

void Main(void)
{

     lpc_init_pll_manual();
//initialize module,it is very necessary for stability of system	
	spi_data_send(0, 0xfb);
	spi_data_send(0, 0x56);
	spi_data_send(0, 0xfb);
	spi_data_send(0, 0x56);
	
//initialize LCD,and set up some parameter	
	LCD_reset();
	LCD_init();
	LCD_BL_con(0);	
	color_set(0x0,0x07ff);						//color setup
	posi_set(0,0);								//set display position,x and y direction
	cls();										//clear screen
		
	LCD_printf("hello,world!\n");
	IIC_test();
	
	while(1);
}

void IIC_test(void)
{
	INT8U data[16];
	INT8U i;
	
	IIC_init();
	LCD_printf("wr 24c02 0 ~ f\n");
	
	for(i=0;i<16;i++)
	Wr24C02(0xa0,i,i);

	for(i=0;i<16;i++)
	{
		Rd24C02(0xa0,i,&data[i]);
		LCD_printf(" %x",data[i]);
	}

}

⌨️ 快捷键说明

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