📄 main.c
字号:
/******************************************************************************
Copyright (c) Motorola 2001
File Name : $RCSfile: main.c,v $
Engineer : $Author: estyger $
Location : EKB
Date Created : 05/07/2001
Current Revision : $Revision: 1.1.1.1 $
Notes :
*******************************************************************************
Motorola reserves the right to make changes without further notice to any
product herein to improve reliability, function or design. Motorola does
not assume any liability arising out ot the application or use of any
product, circuit, or software described herein; neither does it convey any
license under its patent rights nor the rights of others. Motorola products
are not designed, intended, or authorized for use as components in systems
intended for surgical implant into the body, or other applications intended
to support life, or for any other application in which the failure of the
Motorola product could create a situation where personal injury or death may
occur. Should Buyer purchase or use Motorola products for any such unintended
or unauthorized application, Buyer shall idemnify and hold Motorola and its
officers, employees, subsidiaries, affiliates, and distributors harmless
against all claims costs, damages, and expenses, and reasonable attorney fees
arising out of, directly or indirectly, any claim of personal injury or death
associated with such unintended or unathorized use, even if such claim alleges
that Motorola was negligent regarding the design or manufacture of the part.
Motorola and the Motorola logo* are registered trademarks of Motorola Ltd.
******************************************************************************/
/************************* System Include Files ******************************/
/************************* Project Include Files *****************************/
#include "stdtypes.h"
#include "mcucfg.h"
#include "s12_register.h"
#include "s12_crg.h"
#include "s12_eectl.h"
#include "s12_fectl.h"
/************************* typedefs ******************************************/
/************************* #Defines ******************************************/
#define DIAGSIZE 16 /* 16 words */
/************************* Global Variables **********************************/
UINT16 DiagBuffer[DIAGSIZE];
/************************* Register Variables ********************************/
tREGISTER registers @(REG_BASE);
/************************* EEPROM Variables **********************************/
#pragma DATA_SEG EEPROM
UINT16 EEPROM_DiagSave[DIAGSIZE];
#pragma DATA_SEG DEFAULT
/************************* FLASH Variables **********************************/
#pragma DATA_SEG FLASH_DIAG
UINT16 FLASH_DiagSave[DIAGSIZE];
#pragma DATA_SEG DEFAULT
/************************* External Variables ********************************/
/******************************************************************************
Function Name : main
Engineer : r27624
Date : 28/06/2001
Arguments : none
Return : none
Notes : called from startup
******************************************************************************/
void
main(void)
{
UINT8 i, result;
registers.portb.byte = 0xFF;
registers.ddrb.byte = 0xFF;
PLLStartup();
ConfigECLKDIV();
ConfigFCLKDIV();
for(i = 0; i < DIAGSIZE; i++) /* fill buffer */
{
DiagBuffer[i] = i;
}
registers.portb.byte &= ~(UINT8)PTA0; /* clear bit 0 */
result = ProgEeprom(EEPROM_DiagSave, DiagBuffer, DIAGSIZE);
registers.portb.byte |= PTA0; /* set bit 0 */
registers.portb.byte &= ~(UINT8)PTA1; /* clear bit 1 */
result = ProgFlash(FLASH_DiagSave, DiagBuffer, DIAGSIZE);
registers.portb.byte |= PTA1; /* set bit 1 */
for(;;)
{
registers.portb.byte ^= PTA2; /* toggle bit 2: 9 cycles */
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -