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

📄 byte1.c

📁 FreeRTOS-3.2.4-HCS08 Files
💻 C
字号:
/** ###################################################################
**     THIS BEAN MODULE IS GENERATED BY THE TOOL. DO NOT MODIFY IT.
**     Filename  : Byte1.C
**     Project   : RTOSDemo
**     Processor : MC9S08GT60CFB
**     Beantype  : ByteIO
**     Version   : Bean 02.053, Driver 03.08, CPU db: 2.87.086
**     Compiler  : Metrowerks HCS08 C Compiler
**     Date/Time : 3/7/2006, 6:48 AM
**     Abstract  :
**         This bean "ByteIO" implements an one-byte input/output.
**         It uses one 8-bit port.
**         Note: This bean is set to work in Output direction only.
**         Methods of this bean are mostly implemented as a macros 
**         (if supported by target langauage and compiler).
**     Settings  :
**         Port name                   : PTB
**
**         Initial direction           : Output (direction cannot be changed)
**         Initial output value        : 0 = 000H
**         Initial pull option         : off
**
**         8-bit data register         : PTBD      [0004]
**         8-bit control register      : PTBDD     [0007]
**
**             ----------------------------------------------------
**                   Bit     |   Pin   |   Name
**             ----------------------------------------------------
**                    0      |    22   |   PTB0_AD1P0
**                    1      |    23   |   PTB1_AD1P1
**                    2      |    24   |   PTB2_AD1P2
**                    3      |    25   |   PTB3_AD1P3
**                    4      |    26   |   PTB4_AD1P4
**                    5      |    27   |   PTB5_AD1P5
**                    6      |    28   |   PTB6_AD1P6
**                    7      |    29   |   PTB7_AD1P7
**             ----------------------------------------------------
**     Contents  :
**         PutBit - void Byte1_PutBit(byte Bit,bool Val);
**         NegBit - void Byte1_NegBit(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"


/*
** ===================================================================
**     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] = {
  0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80
};                                     /* 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_PutBit (bean ByteIO)
**
**     Description :
**         This method writes the new value to the specified bit
**         of the output value.
**     Parameters  :
**         NAME       - DESCRIPTION
**         Bit        - Number of the bit (0 to 7)
**         Val        - New value of the bit (FALSE or TRUE)
**                      FALSE = "0" or "Low", TRUE = "1" or "High"
**     Returns     : Nothing
** ===================================================================
*/
void Byte1_PutBit(byte Bit, bool Val)
{
  byte const Mask = Byte1_GetMsk(Bit); /* Temporary variable - put bit mask */
  if (Val) {
    setReg8Bits(PTBD, Mask);           /* [bit Bit]=0x01 */
  } else { /* !Val */
    clrReg8Bits(PTBD, Mask);           /* [bit Bit]=0x00 */
  } /* !Val */
}

/*
** ===================================================================
**     Method      :  Byte1_NegBit (bean ByteIO)
**
**     Description :
**         This method negates (inverts) the specified bit of the
**         output value.
**     Parameters  :
**         NAME       - DESCRIPTION
**         Bit        - Number of the bit to invert (0 to 7)
**     Returns     : Nothing
** ===================================================================
*/
void Byte1_NegBit(byte Bit)
{
  byte const Mask = Byte1_GetMsk(Bit); /* Temporary variable - set bit mask */
  invertReg8Bits(PTBD, Mask);          /* [bit Bit]=invert */
}


/* END Byte1. */
/*
** ###################################################################
**
**     This file was created by UNIS Processor Expert 2.97 [03.74]
**     for the Freescale HCS08 series of microcontrollers.
**
** ###################################################################
*/

⌨️ 快捷键说明

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