📄 freescale
字号:
/** ###################################################################
** THIS COMPONENT MODULE IS GENERATED BY THE TOOL. DO NOT MODIFY IT.
** Filename : Device_Addr.C
** Project : RS_485
** Processor : MC9S08JM60CLHE
** Component : BitsIO
** Version : Component 02.102, Driver 03.22, CPU db: 3.00.046
** Compiler : CodeWarrior HCS08 C Compiler
** Date/Time : 2010-1-14, 21:35
** Abstract :
** This bean "BitsIO" implements a multi-bit input/output.
** It uses selected pins of one 1-bit to 8-bit port.
** Note: This bean is set to work in Input direction only.
** Settings :
** Port name : PTB
**
** Bit mask of the port : $003F
** Number of bits/pins : 6
** Single bit numbers : 0 to 5
** Values range : 0 to 63
**
** Initial direction : Input (direction cannot be changed)
** Initial output value : 0 = 000H
** Initial pull option : off
**
** Port data register : PTBD [$0002]
** Port control register : PTBDD [$0003]
**
** ----------------------------------------------------
** Bit | Pin | Name
** ----------------------------------------------------
** 0 | 34 | PTB0_MISO2_ADP0
** 1 | 35 | PTB1_MOSI2_ADP1
** 2 | 36 | PTB2_SPSCK2_ADP2
** 3 | 37 | PTB3_SS2_ADP3
** 4 | 38 | PTB4_KBIP4_ADP4
** 5 | 39 | PTB5_KBIP5_ADP5
** ----------------------------------------------------
**
** Optimization for : speed
** Contents :
** GetDir - bool Device_Addr_GetDir(void);
** GetVal - byte Device_Addr_GetVal(void);
** GetBit - bool Device_Addr_GetBit(byte Bit);
**
** Copyright : 1997 - 2009 Freescale Semiconductor, Inc. All Rights Reserved.
**
** http : www.freescale.com
** mail : support@freescale.com
** ###################################################################*/
/* MODULE Device_Addr. */
#include "Device_Addr.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"
/*
** ===================================================================
** Method : Device_Addr_GetMsk (component BitsIO)
**
** 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 Device_Addr_Table[6] = { /* Table of mask constants */
0x01, 0x02, 0x04, 0x08, 0x10, 0x20
};
static byte Device_Addr_GetMsk (byte PinIndex)
{
return (byte)(PinIndex<6 ? Device_Addr_Table[PinIndex] : 0); /* Check range and return appropriate bit mask */
}
/*
** ===================================================================
** Method : Device_Addr_GetVal (component BitsIO)
**
** 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 63)
** ===================================================================
*/
byte Device_Addr_GetVal(void)
{
return (byte)(getReg8(PTBD) & 0x3F); /* Return port data */
}
/*
** ===================================================================
** Method : Device_Addr_GetBit (component BitsIO)
**
** 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 5)
** Returns :
** --- - Value of the specified bit (FALSE or TRUE)
** FALSE = "0" or "Low", TRUE = "1" or "High"
** ===================================================================
*/
bool Device_Addr_GetBit(byte Bit)
{
byte const Mask = Device_Addr_GetMsk(Bit); /* Temporary variable - bit mask to test */
return (bool)((getReg8(PTBD) & Mask) == Mask); /* Test if specified bit of port register is set */
}
/*
** ===================================================================
** Method : Device_Addr_GetDir (component BitsIO)
**
** Description :
** This method returns direction of the bean.
** Parameters : None
** Returns :
** --- - Direction of the bean (always FALSE, Input only)
** FALSE = Input, TRUE = Output
** ===================================================================
*/
/*
bool Device_Addr_GetDir(void)
** This method is implemented as a macro. See Device_Addr.h file. **
*/
/* END Device_Addr. */
/*
** ###################################################################
**
** This file was created by Processor Expert 3.07 [04.34]
** for the Freescale HCS08 series of microcontrollers.
**
** ###################################################################
*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -