📄 byte1.c
字号:
/** ###################################################################
** THIS BEAN MODULE IS GENERATED BY THE TOOL. DO NOT MODIFY IT.
** Filename : Byte1.C
** Project : EEPROM
** Processor : MC9S12DG128BCPV
** Beantype : ByteIO
** Version : Bean 02.053, Driver 03.07, CPU db: 2.87.280
** Compiler : Metrowerks HC12 C Compiler
** Date/Time : 2008-3-3, 下午 09:51
** Abstract :
** This bean "ByteIO" implements an one-byte input/output.
** It uses one 8-bit port.
** Note: This bean is set to work in Input direction only.
** Methods of this bean are mostly implemented as a macros
** (if supported by target langauage and compiler).
** Settings :
** Port name : M
**
** Initial direction : Input (direction cannot be changed)
** Initial output value : 0 = 000H
** Initial pull option : down
**
** 8-bit data register : PTM [592]
** 8-bit control register : DDRM [594]
**
** ----------------------------------------------------
** Bit | Pin | Name
** ----------------------------------------------------
** 0 | 105 | PM0_RxCAN0
** 1 | 104 | PM1_TxCAN0
** 2 | 103 | PM2_RxCAN0_MISO0
** 3 | 102 | PM3_TxCAN0_SS0
** 4 | 101 | PM4_RxCAN0_RxCAN4_MOSI0
** 5 | 100 | PM5_TxCAN0_TxCAN4_SCK0
** 6 | 88 | PM6_RxCAN4
** 7 | 87 | PM7_TxCAN4
** ----------------------------------------------------
** Contents :
** GetDir - bool Byte1_GetDir(void);
** GetVal - byte Byte1_GetVal(void);
** GetBit - bool Byte1_GetBit(byte Bit);
**
** (c) Copyright UNIS, spol. s r.o. 1997-2005
** UNIS, spol. s r.o.
** Jundrovska 33
** 624 00 Brno
** Czech Republic
** http : www.processorexpert.com
** mail : info@processorexpert.com
** ###################################################################*/
/* MODULE Byte1. */
#include "Byte1.h"
/* Including shared modules, which are used in the whole project */
#include "PE_Types.h"
#include "PE_Error.h"
#include "PE_Const.h"
#include "IO_Map.h"
#include "Cpu.h"
#pragma DATA_SEG Byte1_DATA
#pragma CODE_SEG Byte1_CODE
#pragma CONST_SEG Byte1_CONST /* Constant section for this module */
/*
** ===================================================================
** Method : Byte1_GetMsk (bean ByteIO)
**
** Description :
** The method returns a bit mask which corresponds to the
** required bit position.
** This method is internal. It is used by Processor Expert only.
** ===================================================================
*/
static const byte Byte1_Table[8] = {
1, 2, 4, 8, 16, 32, 64, 128
}; /* Table of mask constants */
static byte Byte1_GetMsk (byte PinIndex)
{
return PinIndex<8 ? Byte1_Table[PinIndex] : 0; /* Check range and return appropriate bit mask */
}
/*
** ===================================================================
** Method : Byte1_GetVal (bean ByteIO)
**
** Description :
** This method returns an input value.
** a) direction = Input : reads the input value from the
** pins and returns it
** b) direction = Output : returns the last written value
** Note: This bean is set to work in Input direction only.
** Parameters : None
** Returns :
** --- - Input value (0 to 255)
** ===================================================================
*/
/*
byte Byte1_GetVal(void)
** This method is implemented as a macro. See Byte1.h file. **
*/
/*
** ===================================================================
** Method : Byte1_GetBit (bean ByteIO)
**
** Description :
** This method returns the specified bit of the input value.
** a) direction = Input : reads the input value from pins
** and returns the specified bit
** b) direction = Output : returns the specified bit
** of the last written value
** Note: This bean is set to work in Input direction only.
** Parameters :
** NAME - DESCRIPTION
** Bit - Number of the bit to read (0 to 7)
** Returns :
** --- - Value of the specified bit (FALSE or TRUE)
** FALSE = "0" or "Low", TRUE = "1" or "High"
** ===================================================================
*/
bool Byte1_GetBit(byte Bit)
{
byte const Mask = Byte1_GetMsk(Bit); /* Temporary variable - bit mask to test */
return (getReg8(PTM) & Mask) == Mask; /* Test if specified bit of port data register is set */
}
/*
** ===================================================================
** Method : Byte1_GetDir (bean ByteIO)
**
** Description :
** This method returns direction of the bean.
** Parameters : None
** Returns :
** --- - Direction of the bean (always FALSE, Input only)
** FALSE = Input, TRUE = Output
** ===================================================================
*/
/*
bool Byte1_GetDir(void)
** This method is implemented as a macro. See Byte1.h file. **
*/
/* END Byte1. */
/*
** ###################################################################
**
** This file was created by UNIS Processor Expert 2.96 [03.76]
** for the Freescale HCS12 series of microcontrollers.
**
** ###################################################################
*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -