Reg51.h in RRKboard_0.0.zip


8051 based microcontroller project...Original Link
    Sponsored links

			
			/**
 * \addtogroup REG51
 * @{
 */

/*****************************************************************************/
/**
 * \file REG51.h
 * Generic 80C51 and 80C31 Header file for Keil C51.
 * \author Copyright (c) 2005, Murray R. Van Luyn. <vanluynm@iinet.net.au>
 * \version 0.0
 * \date 27-06-05
 */
/*****************************************************************************/

/*****************************************************************************
 *
 *     THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
 *     OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 *     WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 *     ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
 *     DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 *     DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
 *     GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 *     INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
 *     WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
 *     NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 *     SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 *****************************************************************************/

#ifndef REG51_H
#define REG51_H

/*****************************************************************************
 *
 *                               Defined Constants
 *
 *****************************************************************************/

/*****************************************************************************
 *
 *                          Byte width register defines.
 *
 *****************************************************************************/

sfr P0   = 0x80;     /* Port 0                                               */
sfr P1   = 0x90;     /* Port 1                                               */
sfr P2   = 0xA0;     /* Port 2                                               */
sfr P3   = 0xB0;     /* Port 3                                               */
sfr PSW  = 0xD0;     /* Program Status Word                                  */
sfr ACC  = 0xE0;     /* Accumulator                                          */
sfr B    = 0xF0;     /* B Register                                           */
sfr SP   = 0x81;     /* Stack Pointer                                        */
sfr DPL  = 0x82;     /* Data Pointer Low byte - LSB                          */
sfr DPH  = 0x83;     /* Data Pointer High byte - MSB                         */
sfr PCON = 0x87;     /* Power Control                                        */
sfr TCON = 0x88;     /* Timer/Counter 0 and 1 control                        */
sfr TMOD = 0x89;     /* Timer/Counter 0 and 1 Modes                          */
sfr TL0  = 0x8A;     /* Timer/Counter 0 Low byte                             */
sfr TL1  = 0x8B;     /* Timer/Counter 1 Low byte                             */
sfr TH0  = 0x8C;     /* Timer/Counter 0 High byte                            */
sfr TH1  = 0x8D;     /* Timer/Counter 1 High byte                            */
sfr IE   = 0xA8;     /* Interrupt Enable Control                             */
sfr IP   = 0xB8;     /* Interrupt Priority Control                           */
sfr SCON = 0x98;     /* Serial Control                                       */
sfr SBUF = 0x99;     /* Serial Data Buffer                                   */


/*****************************************************************************
 *
 *                          Bit width register defines.
 *
 *****************************************************************************/

/*  
 * PSW - Program Status Word
 */
sbit CY   = 0xD7;     /* Carry Flag                                          */
sbit AC   = 0xD6;     /* Auxiliary Carry Flag                                */
sbit F0   = 0xD5;     /* Flag 0 for general purpose                          */
sbit RS1  = 0xD4;     /* Register Bank selector bit 1                        */
sbit RS0  = 0xD3;     /* Register Bank selector bit 0                        */
sbit OV   = 0xD2;     /* Overflow Flag                                       */
sbit P    = 0xD0;     /* Parity flag                                         */

/*  
 * TCON - Timer/Counter 0 and 1 control
 */
sbit TF1  = 0x8F;     /* Timer 1 Overflow Flag                               */
sbit TR1  = 0x8E;     /* Timer 1 Run Control Bit                             */
sbit TF0  = 0x8D;     /* Timer 0 Overflow Flag                               */
sbit TR0  = 0x8C;     /* Timer 0 Run Control Bit                             */
sbit IE1  = 0x8B;     /* Interrupt 1 Edge Flag                               */
sbit IT1  = 0x8A;     /* Interrupt 1 Type Control Bit                        */
sbit IE0  = 0x89;     /* Interrupt 0 Edge Flag                               */
sbit IT0  = 0x88;     /* Interrupt 0 Type Control Bit                        */

/*
 * IE - Interrupt Enable Control
 */
sbit EA   = 0xAF;     /* Enable All Interrupt bit                            */
sbit ES   = 0xAC;     /* Serial Port Enable bit                              */
sbit ET1  = 0xAB;     /* Timer 1 Overflow Interrupt Enable bit               */
sbit EX1  = 0xAA;     /* External Interrupt 1 Enable bit                     */
sbit ET0  = 0xA9;     /* Timer 0 Overflow Interrupt Enable bit               */
sbit EX0  = 0xA8;     /* External Interrupt 0 Enable bit                     */

/*
 * IP - Interrupt Priority Control
 */
sbit PS   = 0xBC;     /* Serial Port Priority bit                            */
sbit PT1  = 0xBB;     /* Timer 1 Overflow Interrupt Priority bit             */
sbit PX1  = 0xBA;     /* External Interrupt 1 Priority bit                   */
sbit PT0  = 0xB9;     /* Timer 0 Overflow Interrupt Priority bit             */
sbit PX0  = 0xB8;     /* External Interrupt 0 Priority bit                   */

/*
 * P3 - Port 3
 */
sbit RD   = 0xB7;     /* External Data Memory read strobe                    */
sbit WR   = 0xB6;     /* External Data Memory write strobe                   */
sbit T1   = 0xB5;     /* Timer 1 counter input                               */
sbit T0   = 0xB4;     /* Timer 0 counter input                               */
sbit INT1 = 0xB3;     /* External interrupt 1 input/timer 1 gate cntrl input */
sbit INT0 = 0xB2;     /* External interrupt 0 input/timer 0 gate cntrl input */
sbit TXD  = 0xB1;     /* Transmitter data output                             */
sbit RXD  = 0xB0;     /* Receiver data input                                 */

/*
 * SCON - Serial Control
 */
sbit SM0  = 0x9F;     /* Serial port Mode bit 0                              */
sbit SM1  = 0x9E;     /* Serial port Mode bit 1                              */
sbit SM2  = 0x9D;     /* Serial port Mode 2 bit                              */
sbit REN  = 0x9C;     /* Reception Enable bit                                */
sbit TB8  = 0x9B;     /* Transmitter Bit 8/Ninth bit for modes 2 and 3       */
sbit RB8  = 0x9A;     /* Receiver Bit 8/Ninth bit received in modes 2 and 3  */
sbit TI   = 0x99;     /* Transmit Interrupt flag                             */
sbit RI   = 0x98;     /* Receive Interrupt flag                              */

#endif

/** @} */

			click here to download the whole source code package.

			
			


Project Files

    Sponsored links
NameSizeDate
 RRKboard.h3.86 kB07-13-05 09:19
 RRKboard.chm27.18 kB07-13-05 09:20
 Reg51.h7.29 kB06-29-05 22:39
 RRKboard.c8.98 kB07-13-05 09:17
...

Related Items

    Sponsored links