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

📄 v3k_framlcd_demo_sdcc.c

📁 这是ramtron公司的铁电单片机的开发程序
💻 C
字号:
////////////////////////////////////////////////////////////////////////////////////////////
// V3K_FRAMLCD_Demo_SDCC.c  //
////////////////////////////////
//
// DESCRIPTION:     Demo program of interface between VRS51L2xxx device and a 5V  character LCD module
//                  The LCD 5V supply is generated using a voltage multiplier circuit
//				referenced to the 3.3V supply and driven by the PWM0 output
//
//				The program also demonstrates the use of the FRAM memory to store Data,
//				here an LCD character string
//
//
// Program operation:
// 				1)The program initialises the PWM0 output wait for the LCD supply to stabilize and then
//				2)it proceeds with LCD initialization.
//				3)Then an String is copied into the FRAM memory
//				4)The program  setup the Block Protect for the entire FRAM
//				5)Then the program tried to  overwrite the FRAM content
//				6)Finally the program read back a portion of the FRAM and displays its content on the LCD mdule
//
//Notes:
//
//                  The interface to the LCD done through the VRS51L2xxx Port 0
//                  The LCD is initialized to operate in 4 bit data Bus Mode
//
//                  LCD interface structure:
//                  ========================
//                  P0.0      =    LCD RS
//                  P0.1      =    LCD RW
//                  P0.2      =    LCD E
//                  P0.3      =    (not used)
//                  P0[7:4]   =    LCD Data (4 bit mode)
// all LCD definition and operation files are defined into the
//  "V2K_CHAR_LCD_P0_SDCC.h"   file
//
//                  Notes about standard Character LCD display interface to the VRS2xxx / 3xxx
//                       -Most LCD displays operates on a 4.5V to 5.5V Supply and won't work
//					 with the 3.3V supply the VRS51L2xxx / 3xxx operate from
//                       -On the digital side make sure the LCD module logic High level lower limit
//                        is below 3V.
//
//
//
/////////////////////////////////////////////////////////////////////////////////////////////
// TARGET:          VRS51L3xxx
////////////////////////////////////////////////////////////////////////////////////////////
//
//   Rev   1.0
//   Date: April 2006
////////////////////////////////////////////////////////////////////////////////////////////
#include <VRS51L3074_SDCC.h>
#include <V2K_CHAR_LCD_P0_SDCC.h>

// Functions declaration
void FramProtect(void);


// Global variables definitions
idata   char cptr = 0x00;


// LCD Strings and constants definitions
code char msg1[]=   "VRS51L3xxx FRAM \0";

//--Init pointer to FRAM base address
xdata at 0x8000 unsigned char frambase;				//Init  a char variable pointing to FRAM
xdata unsigned char * data framptr = &frambase ;		//Init a pointer in IRAM pointing to the frambase var.



char lcdval = 0x00;



/////////////////////////////////////////////////////////////////////////////////
////////////////////////        MAIN FUNCTION   /////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////
 
void main (void) {


	DEVMEMCFG  |= 0xC0;						//Activate the FRAM

	PERIPHEN1 = 0x01;						//Enable Timer 0
	LCDPORTDIR = 0x00;						//Config LCD port as output
	PWM0_Activate();						//Activate PWM0 to generate 5V supply for LCD module


   //--Initialize the LCD
	initlcd();							//Initialise the LCD Module

	sendlcdcmd(LCD_L1C1);					//Place LCD cursor on Line 1, Column 1

	V2KDelay1ms(1);						// Put a 1ms delay

//--copy message from Flash to FRAM
	cptr = 0x00;
	while( msg1[cptr] != '\0')
		{
		*(framptr+cptr) = msg1[cptr++];
		}
	*(framptr+cptr) =  '\0';

	//--copy message from FRAM to LCD
	sendlcdcmd(LCD_L1C1);					//Place LCD cursor on Line 1, Column 1
	cptr = 0x00;
	while((*(framptr + cptr) != '\0') & (cptr < 16))			//Display "VRS51L2xxx/3xxx \0" on first line of LCD display
		{
		sendlcdchar(*(framptr+cptr++));
		while(!(FRAMCFG1&0x80));					//Wait FREADIDLE == 1  (FRAM IDLE)
   		}


	while(1);


}// End of main


⌨️ 快捷键说明

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