lab3.c

来自「使用PIC24 16位单片机 读写SD卡 支持FAT32」· C语言 代码 · 共 75 行

C
75
字号
// Lab3.c

#include "fileio.h"
#include "lcd.h"

#define linelength	16

void LCDwait (void);

int main (void)
{
	FILE * myFile;
	
	size_t lengthOfString;	

	char	length = 0;

	char buffer[50];
	char * pBuffer = (char *)&buffer;


/*********************************************************************************/
/* Your code goes here                                                           */
/* Hints:                                                                        */
/* - The file you are reading is called data.txt                                 */
/* - The test you are reading is smaller than the size of the buffer             */
/* - The number of bytes that should be put on the LCD should be stored in the   */
/*       variable lengthOfString                                                 */
/*********************************************************************************/



/**********************************************************************************/


	// Setup the LCD
	mLCDInit();
	LCDProcessEvents();
	LCDwait();
	mLCDHome();
	LCDProcessEvents();
	LCDwait();
	while (lengthOfString)
	{
		if (!mLCDIsBusy() )
		{
			if (length == linelength)
			{
				mLCDPutCmd(0xC0);
				length = 0;
				LCDProcessEvents();
				LCDwait();
			}
			else
			{
				mLCDPutChar(*pBuffer);
				pBuffer++;
				length++;
				lengthOfString--;
			}
		}
		LCDProcessEvents();
	}
	LCDwait();
	while(1);
}



void LCDwait (void)
{
	while (mLCDIsBusy())
		LCDProcessEvents();
}

⌨️ 快捷键说明

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