📄 testboard.bak
字号:
/*
*******************************************************************************
** COPYRIGHT (C) NEC Electronics Corporation 2008
** NEC ELECTRONICS CONFIDENTIAL AND PROPRIETARY
** All rights reserved by NEC Electronics Corporation.
** Use of copyright notice does not evidence publication.
**
** Filename : BOARD.c
** Abstract : This file implements device driver for HCD-Board.
**
** Device : uPD78F8024
**
** Compiler : NEC/CC78K0
**
*******************************************************************************
*/
#pragma interrupt INTP1 shutdown_interrupt
/*
*******************************************************************************
** Include files
*******************************************************************************
*/
#include "macrodriver.h"
#include "BOARD.h"
#include "LED.h"
/*
*******************************************************************************
** Function Prototypes
*******************************************************************************
*/
__interrupt void shutdown_interrupt( void );
/*
*******************************************************************************
** External Variable Difinition
*******************************************************************************
*/
unsigned char g_ucBoardStatus = BOARD_STATUS_SHUTDOWN; /* to store the status of board */
/*
**-----------------------------------------------------------------------------
**
** function name:
** BOARD_init
**
** Parameters:
** void
**
** Returns:
** void
**
**-----------------------------------------------------------------------------
*/
void BOARD_init( void )
{
/* wait at the PWM standby time */
TCL50 = 0b00000101;
CR50 = 63;
TMC50 = 0b10000000;
while(!TMIF50);
TMC50 = 0b00000000;
TCL50 = 0b00000000;
TMIF50 = BIT_CLR;
/* set output to each PWM port mode */
PORT_MODE_PWM1 = OUTPUT;
PORT_MODE_PWM2 = OUTPUT;
PORT_MODE_PWM3 = OUTPUT;
PORT_MODE_PWM4 = OUTPUT;
/* output High Level to each PWM port */
PORT_PWM1 = LEVEL_HIGH;
PORT_PWM2 = LEVEL_HIGH;
PORT_PWM3 = LEVEL_HIGH;
PORT_PWM4 = LEVEL_HIGH;
/* output Low Level to each PWM port */
PORT_PWM1 = LEVEL_LOW;
PORT_PWM2 = LEVEL_LOW;
PORT_PWM3 = LEVEL_LOW;
PORT_PWM4 = LEVEL_LOW;
}
/*
**-----------------------------------------------------------------------------
**
** function name:
** shutdown_interrupt
**
** Parameters:
** void
**
** Returns:
** void
**
**-----------------------------------------------------------------------------
*/
__interrupt void shutdown_interrupt( void ) {
/* set SHUTDOWN to status of board */
g_ucBoardStatus = BOARD_STATUS_SHUTDOWN;
}
/*
**-----------------------------------------------------------------------------
**
** function name:
** changeBoardStatus
**
** Parameters:
** unsigned char status of board after changed
**
** Returns:
** void
**
**-----------------------------------------------------------------------------
*/
void changeBoardStatus(unsigned char ucStatus) {
/* when there is no necessity of the state transition */
if (ucStatus == g_ucBoardStatus) {
/* end without processing */
return;
}
/* when changing to ENABLE */
if (ucStatus == BOARD_STATUS_ENABLE) {
/* set High to operation/standby control input port */
PORT_BOARD_ENABLE = LEVEL_HIGH;
}
/* when changing to SHUTDOWN */
else if (ucStatus == BOARD_STATUS_SHUTDOWN) {
/* set Low to operation/standby control input port */
PORT_BOARD_ENABLE = LEVEL_LOW;
}
else {
/* end without processing */
return;
}
/* reset status of board */
g_ucBoardStatus = ucStatus;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -