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

📄 ex5_root.c

📁 基于摩托罗拉S12标准源程序 包括:SCIO,Timer
💻 C
字号:
/******************************************************************************
*                                                  
*  (c) copyright Freescale Semiconductor Hong Kong Ltd. 2004
*  ALL RIGHTS RESERVED
*                                                                       
*******************************************************************************  
** THIS  CODE IS ONLY INTENDED AS AN EXAMPLE FOR DEMONSTRATING THE FREESCALE **
** MICROCONTROLLERS.  IT  HAS ONLY BEEN GIVEN A MIMIMUM LEVEL OF TEST. IT IS **
** PROVIDED  'AS  SEEN'  WITH  NO  GUARANTEES  AND  NO  PROMISE  OF SUPPORT. **
*******************************************************************************  
*                                                                           
* FILE:         ex5_root.c	          REVISION 0.2
*  
* DESCRIPTION:  Application code is placed here.
*               This module handles as tester menu to call up 
*               other page for test
*            
*
* TARGET DEVICE: 		Hardware EVB912DP256 or equivalent                                                                                                                                                      
*
* COMPILER: Metrowerks            VERSION: ADS v1.2 (initial version)           
*                                 VERSION: ADS v2.0 (Demo beta version)
*                                 VERSION: ADS v3.1 (Demo version)
*																												 
* NOTES
* -----
* All modules remain at their reset addresses.                                                      
*
*
* UPDATED HISTORY:
*
* REV   YYYY.MM.DD  AUTHOR        DESCRIPTION OF CHANGE
* ---   ----------  ------        --------------------- 
* 0.0   2002.05.27  Kenny Lam     Initial version
* 0.1   2002.09.12  Kenny Lam     Demo beta version
* 0.2   2004.04.12  Kenny Lam     Demo version
*
******************************************************************************/                                                                        
/* Freescale  is  not  obligated  to  provide  any  support, upgrades or new */
/* releases  of  the Software. Freescale may make changes to the Software at */
/* any time, without any obligation to notify or provide updated versions of */
/* the  Software  to you. Freescale expressly disclaims any warranty for the */
/* Software.  The  Software is provided as is, without warranty of any kind, */
/* either  express  or  implied,  including, without limitation, the implied */
/* warranties  of  merchantability,  fitness  for  a  particular purpose, or */
/* non-infringement.  You  assume  the entire risk arising out of the use or */
/* performance of the Software, or any systems you design using the software */
/* (if  any).  Nothing  may  be construed as a warranty or representation by */
/* Freescale  that  the  Software  or  any derivative work developed with or */
/* incorporating  the  Software  will  be  free  from  infringement  of  the */
/* intellectual property rights of third parties. In no event will Freescale */
/* be  liable,  whether in contract, tort, or otherwise, for any incidental, */
/* special,  indirect, consequential or punitive damages, including, but not */
/* limited  to,  damages  for  any loss of use, loss of time, inconvenience, */
/* commercial loss, or lost profits, savings, or revenues to the full extent */
/* such  may be disclaimed by law. The Software is not fault tolerant and is */
/* not  designed,  manufactured  or  intended by Freescale for incorporation */
/* into  products intended for use or resale in on-line control equipment in */
/* hazardous, dangerous to life or potentially life-threatening environments */
/* requiring  fail-safe  performance,  such  as  in the operation of nuclear */
/* facilities,  aircraft  navigation  or  communication systems, air traffic */
/* control,  direct  life  support machines or weapons systems, in which the */
/* failure  of  products  could  lead  directly to death, personal injury or */
/* severe  physical  or  environmental  damage  (High  Risk Activities). You */
/* specifically  represent and warrant that you will not use the Software or */
/* any  derivative  work of the Software for High Risk Activities.           */
/* Freescale  and the Freescale logos are registered trademarks of Freescale */
/* Semiconductor Inc.                                                        */ 
/*****************************************************************************/

#include <hidef.h>
#include "GlobalVar.h"
#include "const.h"
#include "ut_extern.h"
#include "ex4_extern.h"
#include "ex5_extern.h"


/*******************************************************************
* tester subroutine
* Description : Get root menu
*			  :
* Example     : N/A  
* Input 	  : get root_menu
* Output	  : N/A
* Modify      : N/A
* Return      : N/A
********************************************************************/ 
void tester(void)
{	
		root_menu();
}

/*******************************************************************
* disp info subroutine
* Description : Display corresponding page info via RS232
*			  :
* Example     : N/A  
* Input 	  : menu_page
* Output	  : point to corresponding page for data info display
* Modify      : N/A
* Return      : N/A
********************************************************************/ 
void disp_info(char menu_page)
{
	switch (menu_page)
	{
	  case 	ROOT_PAGE		: root_info();
	  					  	  break; 
	  case 	PORTB_PAGE		: portb_info();
	  					  	  break; 
	  case 	PORTB_PAGE_DE	: portb_info_detail();
	  					  	  break; 
	}
}

/*******************************************************************
* root info display subroutine
* Description : Display root info via RS232
*			  :
* Example     : N/A  
* Input 	  : N/A
* Output	  : N/A
* Modify      : N/A
* Return      : N/A
********************************************************************/ 
void root_info()
{	
//	hex_asc((byte)(RAM_Add>>8));
//	hex_asc((byte)(RAM_Add));
//	printf0("\r\n");
}

/*******************************************************************
* root menu subroutine
* Description : Root menu data to be displayed via RS232
*			  :
* Example     : N/A  
* Input 	  : wait for terminal input
* Output	  : point to corresponding page
* Modify      : N/A
* Return      : N/A
********************************************************************/ 
void root_menu(void)
{ 
	byte cdata,loop=ENABLE;	

	while(loop==ENABLE)
	{ 
	  printf0("\n		Root Test Menu\r");
	  printf0("\n	0. Root Test Menu\r");
	  printf0("\n	1. Modify RAM\r");
	  printf0("\n	2. PORTB Test Menu\r");
	  printf0("\n	3. EEPROM Test Menu\r");
	  printf0("\n	9. Display DATA\n\r");

	  do
	  {
	  	cdata=menurx_char0(ROOT_PAGE);
	  	if(cdata==CR || cdata=='9')
	      break;
	  }	  
	  while((cdata>'3') || (cdata<'0'));
	  		//get input from user

 	  switch(cdata)
	  { 
		case  	'0': loop=DISABLE;
					 break;
		case  	'1': init_RAM_start_address(); 
					 break;
		case  	'2': portb_test_menu(); 
					 break;
		case  	'3': eeprom_test_menu(); 
					 break;
		case  	'9': data_display(); 
					 break;
					 
	  }
	}	
}

⌨️ 快捷键说明

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