Microcontroller › 8051 › Need – reg51.h – file
- This topic has 1 reply, 2 voices, and was last updated 12 years, 7 months ago by Harsh Pandya.
-
AuthorPosts
-
April 1, 2012 at 7:35 am #1536ShafieParticipant
Hi, I am trying Simple toll plaza system using low frequency RFID interfaced with 8051 microcontroller (AT89C51) project these days, but I have a small problem in the codings. I am using mikroC PRO for 8051 to write the programme, and in reg51.h header file I am using below codings – but it still show some errors which says as some identifiers redifined. I need some help here from you, can I get the same exact reg51.h file that you used for this project as the header file ?
THIS IS MY reg51.h FILE CODING
#ifndef REG51_H
#define REG51_Hsfr 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 */
sfr SPCON = 0xC3; /* SPI Control Register */
sfr SPSTA = 0xC4; /* SPI Status Register */
sfr SPDAT = 0xC5; /* SPI Data Register *//*****************************************************************************
*
* 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
April 2, 2012 at 7:03 am #7381Harsh PandyaParticipantSOME IDENTIFIERS REDEFINED does not mean that the header file is faulty , it means you have some problem in source code , and even after all you have some problem shift to KEIL uVISION its much better than mikroC
-
AuthorPosts
- You must be logged in to reply to this topic.