1 /** ###################################################################
2 ** THIS BEAN MODULE IS GENERATED BY THE TOOL. DO NOT MODIFY IT.
5 ** Processor : MC9S12DP256BCPV
7 ** Version : Bean 02.019, Driver 01.03, CPU db: 2.87.283
8 ** Compiler : Metrowerks HC12 C Compiler
9 ** Date/Time : 16/06/2005, 21:10
11 ** This bean "ByteIO" implements an one-byte input/output.
12 ** It uses one 8-bit port.
13 ** Note: This bean is set to work in Output direction only.
14 ** Methods of this bean are mostly implemented as a macros
15 ** (if supported by target langauage and compiler).
19 ** Initial direction : Output (direction cannot be changed)
20 ** Initial output value : 255 = 0FFH
21 ** Initial pull option : off
23 ** 8-bit data register : PORTB [1]
24 ** 8-bit control register : DDRB [3]
26 ** ----------------------------------------------------
28 ** ----------------------------------------------------
29 ** 0 | 24 | PB0_ADDR0_DATA0
30 ** 1 | 25 | PB1_ADDR1_DATA1
31 ** 2 | 26 | PB2_ADDR2_DATA2
32 ** 3 | 27 | PB3_ADDR3_DATA3
33 ** 4 | 28 | PB4_ADDR4_DATA4
34 ** 5 | 29 | PB5_ADDR5_DATA5
35 ** 6 | 30 | PB6_ADDR6_DATA6
36 ** 7 | 31 | PB7_ADDR7_DATA7
37 ** ----------------------------------------------------
39 ** PutBit - void Byte1_PutBit(byte Bit,bool Val);
40 ** NegBit - void Byte1_NegBit(byte Bit);
42 ** (c) Copyright UNIS, spol. s r.o. 1997-2002
47 ** http : www.processorexpert.com
48 ** mail : info@processorexpert.com
49 ** ###################################################################*/
55 /*Including shared modules, which are used for all project*/
64 /* Definition of DATA and CODE segments for this bean. User can specify where
65 these segments will be located on "Build options" tab of the selected CPU bean. */
66 #pragma DATA_SEG Byte1_DATA /* Data section for this module. */
67 #pragma CODE_SEG Byte1_CODE /* Code section for this module. */
70 ** ===================================================================
71 ** Method : Byte1_GetMsk (bean ByteIO)
74 ** This method is internal. It is used by Processor Expert
76 ** ===================================================================
78 byte Byte1_Table[8]={ 1, 2, 4, 8, 16, 32, 64, 128 }; /* Table of mask constants */
80 byte Byte1_GetMsk(byte Value)
82 return((Value<8)?Byte1_Table[Value]:0); /* Return appropriate bit mask */
86 ** ===================================================================
87 ** Method : Byte1_PutBit (bean ByteIO)
90 ** This method writes the new value to the specified bit
91 ** of the output value.
94 ** Bitnum - Number of the bit (0 to 7)
95 ** Val - New value of the bit (FALSE or TRUE)
96 ** FALSE = "0" or "Low", TRUE = "1" or "High"
98 ** ===================================================================
100 void Byte1_PutBit(byte BitNum, byte Value)
102 byte Mask=Byte1_GetMsk(BitNum); /* Temporary variable - bit mask */
104 if (Mask) /* Is bit mask correct? */
105 if (Value) { /* Is it one to be written? */
106 PORTB |= Mask; /* Set appropriate bit on port */
108 else { /* Is it zero to be written? */
109 PORTB &= ~Mask; /* Clear appropriate bit on port */
114 ** ===================================================================
115 ** Method : Byte1_NegBit (bean ByteIO)
118 ** This method negates (invertes) the specified bit of the
121 ** NAME - DESCRIPTION
122 ** Bit - Number of the bit to invert (0 to 7)
124 ** ===================================================================
126 void Byte1_NegBit(byte BitNum)
128 byte Mask=Byte1_GetMsk(BitNum); /* Temporary variable - bit mask */
130 if (Mask) { /* Is bit mask correct? */
131 PORTB ^= Mask; /* Negate appropriate bit on port */
139 ** ###################################################################
141 ** This file was created by UNIS Processor Expert 03.33 for
142 ** the Motorola HCS12 series of microcontrollers.
144 ** ###################################################################