C8051F340_H.#1
上传用户:gxz1972
上传日期:2019-09-13
资源大小:323k
文件大小:17k
源码类别:

传真(Fax)编程

开发平台:

C/C++

  1. //-----------------------------------------------------------------------------
  2. // c8051F340.h
  3. //-----------------------------------------------------------------------------
  4. // Copyright 2005 Silicon Laboratories, Inc.
  5. // http://www.usbmcu.com   http://www.silabs.com
  6. //
  7. // Program Description:
  8. //
  9. // Register/bit definitions for the C8051F34x family.
  10. //
  11. //
  12. // FID:            34X000000
  13. // Target:         C8051F340, 'F341, 'F342, 'F343, 'F344, 'F345, 'F346, 'F347
  14. // Tool chain:     Keil
  15. // Command Line:   None
  16. //
  17. // Release 1.1
  18. //    -All changes by GP
  19. //    -17 NOV 2005
  20. //    -Converted file to new coding guidelines
  21. //    -Added #defines for interrupt priorities
  22. //    -Added #ifndef/#define to allow multiple includes of file
  23. //    -Converted Bit Definitions to absolute addresses for easier porting
  24. //
  25. // Release 1.0
  26. //    -Initial Revision (CM)
  27. //    -08 AUG 2005
  28. //    -Latest release before new firmware coding standard
  29. //
  30. #ifndef C8051F340_H
  31. #define C8051F340_H
  32. //-----------------------------------------------------------------------------
  33. // Byte Registers
  34. //-----------------------------------------------------------------------------
  35. sfr  P0           =  0x80;             // Port 0 Latch
  36. sfr  SP           =  0x81;             // Stack Pointer
  37. sfr  DPL          =  0x82;             // Data Pointer Low
  38. sfr  DPH          =  0x83;             // Data Pointer High
  39. sfr  EMI0TC       =  0x84;             // EMIF Timing
  40. sfr  EMI0CF       =  0x85;             // EMIF Configuration
  41. sfr  OSCLCN       =  0x86;             // Internal Low-Freq Oscillator Control
  42. sfr  PCON         =  0x87;             // Power Control
  43. sfr  TCON         =  0x88;             // Timer/Counter Control
  44. sfr  TMOD         =  0x89;             // Timer/Counter Mode
  45. sfr  TL0          =  0x8A;             // Timer/Counter 0 Low
  46. sfr  TL1          =  0x8B;             // Timer/Counter 1 Low
  47. sfr  TH0          =  0x8C;             // Timer/Counter 0 High
  48. sfr  TH1          =  0x8D;             // Timer/Counter 1 High
  49. sfr  CKCON        =  0x8E;             // Clock Control
  50. sfr  PSCTL        =  0x8F;             // Program Store R/W Control
  51. sfr  P1           =  0x90;             // Port 1 Latch
  52. sfr  TMR3CN       =  0x91;             // Timer/Counter 3Control
  53. sfr  TMR3RLL      =  0x92;             // Timer/Counter 3 Reload Low
  54. sfr  TMR3RLH      =  0x93;             // Timer/Counter 3 Reload High
  55. sfr  TMR3L        =  0x94;             // Timer/Counter 3Low
  56. sfr  TMR3H        =  0x95;             // Timer/Counter 3 High
  57. sfr  USB0ADR      =  0x96;             // USB0 Indirect Address Register
  58. sfr  USB0DAT      =  0x97;             // USB0 Data Register
  59. sfr  SCON0        =  0x98;             // UART0 Control
  60. sfr  SBUF0        =  0x99;             // UART0 Data Buffer
  61. sfr  CPT1CN       =  0x9A;             // Comparator1 Control
  62. sfr  CPT0CN       =  0x9B;             // Comparator0 Control
  63. sfr  CPT1MD       =  0x9C;             // Comparator1 Mode Selection
  64. sfr  CPT0MD       =  0x9D;             // Comparator0 Mode Selection
  65. sfr  CPT1MX       =  0x9E;             // Comparator1 MUX Selection
  66. sfr  CPT0MX       =  0x9F;             // Comparator0 MUX Selection
  67. sfr  P2           =  0xA0;             // Port 2 Latch
  68. sfr  SPI0CFG      =  0xA1;             // SPI Configuration
  69. sfr  SPI0CKR      =  0xA2;             // SPI Clock Rate Control
  70. sfr  SPI0DAT      =  0xA3;             // SPI Data
  71. sfr  P0MDOUT      =  0xA4;             // Port 0 Output Mode Configuration
  72. sfr  P1MDOUT      =  0xA5;             // Port 1 Output Mode Configuration
  73. sfr  P2MDOUT      =  0xA6;             // Port 2 Output Mode Configuration
  74. sfr  P3MDOUT      =  0xA7;             // Port 3 Output Mode Configuration
  75. sfr  IE           =  0xA8;             // Interrupt Enable
  76. sfr  CLKSEL       =  0xA9;             // Clock Select
  77. sfr  EMI0CN       =  0xAA;             // External Memory Interface Control
  78. sfr  SBCON1       =  0xAC;             // UART1 Baud Rate Generator Control
  79. sfr  P4MDOUT      =  0xAE;             // Port 4 Output Mode Configuration
  80. sfr  PFE0CN       =  0xAF;             // Prefetch Engine Control
  81. sfr  P3           =  0xB0;             // Port 3 Latch
  82. sfr  OSCXCN       =  0xB1;             // External Oscillator Control
  83. sfr  OSCICN       =  0xB2;             // Internal Oscillator Control
  84. sfr  OSCICL       =  0xB3;             // Internal Oscillator Calibration
  85. sfr  SBRLL1       =  0xB4;             // UART1 Baud Rate Generator Low
  86. sfr  SBRLH1       =  0xB5;             // UART1 Baud Rate Generator High
  87. sfr  FLSCL        =  0xB6;             // Flash Scale
  88. sfr  FLKEY        =  0xB7;             // Flash Lock and Key
  89. sfr  IP           =  0xB8;             // Interrupt Priority
  90. sfr  CLKMUL       =  0xB9;             // Clock Multiplier
  91. sfr  AMX0N        =  0xBA;             // AMUX0 Negative Channel Select
  92. sfr  AMX0P        =  0xBB;             // AMUX0 Positive Channel Select
  93. sfr  ADC0CF       =  0xBC;             // ADC0 Configuration
  94. sfr  ADC0L        =  0xBD;             // ADC0 Low
  95. sfr  ADC0H        =  0xBE;             // ADC0 High
  96. sfr  SMB0CN       =  0xC0;             // SMBus Control
  97. sfr  SMB0CF       =  0xC1;             // SMBus Configuration
  98. sfr  SMB0DAT      =  0xC2;             // SMBus Data
  99. sfr  ADC0GTL      =  0xC3;             // ADC0 Greater-Than Compare Low
  100. sfr  ADC0GTH      =  0xC4;             // ADC0 Greater-Than Compare High
  101. sfr  ADC0LTL      =  0xC5;             // ADC0 Less-Than Compare Word Low
  102. sfr  ADC0LTH      =  0xC6;             // ADC0 Less-Than Compare Word High
  103. sfr  P4           =  0xC7;             // Port 4 Latch
  104. sfr  TMR2CN       =  0xC8;             // Timer/Counter 2 Control
  105. sfr  REG0CN       =  0xC9;             // Voltage Regulator Control
  106. sfr  TMR2RLL      =  0xCA;             // Timer/Counter 2 Reload Low
  107. sfr  TMR2RLH      =  0xCB;             // Timer/Counter 2 Reload High
  108. sfr  TMR2L        =  0xCC;             // Timer/Counter 2 Low
  109. sfr  TMR2H        =  0xCD;             // Timer/Counter 2 High
  110. sfr  PSW          =  0xD0;             // Program Status Word
  111. sfr  REF0CN       =  0xD1;             // Voltage Reference Control
  112. sfr  SCON1        =  0xD2;             // UART1 Control
  113. sfr  SBUF1        =  0xD3;             // UART1 Data Buffer
  114. sfr  P0SKIP       =  0xD4;             // Port 0 Skip
  115. sfr  P1SKIP       =  0xD5;             // Port 1 Skip
  116. sfr  P2SKIP       =  0xD6;             // Port 2 Skip
  117. sfr  USB0XCN      =  0xD7;             // USB0 Transceiver Control
  118. sfr  PCA0CN       =  0xD8;             // PCA0 Control
  119. sfr  PCA0MD       =  0xD9;             // PCA0 Mode
  120. sfr  PCA0CPM0     =  0xDA;             // PCA0 Module 0 Mode Register
  121. sfr  PCA0CPM1     =  0xDB;             // PCA0 Module 1 Mode Register
  122. sfr  PCA0CPM2     =  0xDC;             // PCA0 Module 2 Mode Register
  123. sfr  PCA0CPM3     =  0xDD;             // PCA0 Module 3 Mode Register
  124. sfr  PCA0CPM4     =  0xDE;             // PCA0 Module 4 Mode Register
  125. sfr  P3SKIP       =  0xDF;             // Port 3 Skip
  126. sfr  ACC          =  0xE0;             // Accumulator
  127. sfr  XBR0         =  0xE1;             // Port I/O Crossbar Control 0
  128. sfr  XBR1         =  0xE2;             // Port I/O Crossbar Control 1
  129. sfr  XBR2         =  0xE3;             // Port I/O Crossbar Control 2
  130. sfr  IT01CF       =  0xE4;             // INT0/INT1 Configuration
  131. sfr  SMOD1        =  0xE5;             // UART1 Mode
  132. sfr  EIE1         =  0xE6;             // Extended Interrupt Enable 1
  133. sfr  EIE2         =  0xE7;             // Extended Interrupt Enable 2
  134. sfr  ADC0CN       =  0xE8;             // ADC0 Control
  135. sfr  PCA0CPL1     =  0xE9;             // PCA0 Capture 1 Low
  136. sfr  PCA0CPH1     =  0xEA;             // PCA0 Capture 1 High
  137. sfr  PCA0CPL2     =  0xEB;             // PCA0 Capture 2 Low
  138. sfr  PCA0CPH2     =  0xEC;             // PCA0 Capture 2 High
  139. sfr  PCA0CPL3     =  0xED;             // PCA0 Capture 3 Low
  140. sfr  PCA0CPH3     =  0xEE;             // PCA0 Capture 3 High
  141. sfr  RSTSRC       =  0xEF;             // Reset Source Configuration/Status
  142. sfr  B            =  0xF0;             // B Register
  143. sfr  P0MDIN       =  0xF1;             // Port 0 Input Mode Configuration
  144. sfr  P1MDIN       =  0xF2;             // Port 1 Input Mode Configuration
  145. sfr  P2MDIN       =  0xF3;             // Port 2 Input Mode Configuration
  146. sfr  P3MDIN       =  0xF4;             // Port 3 Input Mode Configuration
  147. sfr  P4MDIN       =  0xF5;             // Port 4 Input Mode Configuration
  148. sfr  EIP1         =  0xF6;             // Extended Interrupt Priority 1
  149. sfr  EIP2         =  0xF7;             // Extended Interrupt Priority 2
  150. sfr  SPI0CN       =  0xF8;             // SPI0 Control
  151. sfr  PCA0L        =  0xF9;             // PCA0 Counter Low
  152. sfr  PCA0H        =  0xFA;             // PCA0 Counter High
  153. sfr  PCA0CPL0     =  0xFB;             // PCA0 Capture 0 Low
  154. sfr  PCA0CPH0     =  0xFC;             // PCA0 Capture 0 High
  155. sfr  PCA0CPL4     =  0xFD;             // PCA0 Capture 4 Low
  156. sfr  PCA0CPH4     =  0xFE;             // PCA0 Capture 4 High
  157. sfr  VDM0CN       =  0xFF;             // VDD Monitor Control
  158. //-----------------------------------------------------------------------------
  159. // Bit Definitions
  160. //-----------------------------------------------------------------------------
  161. // TCON 0x88
  162. sbit TF1     = 0x8F;                   // Timer1 overflow flag
  163. sbit TR1     = 0x8E;                   // Timer1 on/off control
  164. sbit TF0     = 0x8D;                   // Timer0 overflow flag
  165. sbit TR0     = 0x8C;                   // Timer0 on/off control
  166. sbit IE1     = 0x8B;                   // Ext interrupt 1 edge flag
  167. sbit IT1     = 0x8A;                   // Ext interrupt 1 type
  168. sbit IE0     = 0x89;                   // Ext interrupt 0 edge flag
  169. sbit IT0     = 0x88;                   // Ext interrupt 0 type
  170. // SCON0 0x98
  171. sbit S0MODE  = 0x9F;                   // Serial mode control bit 0
  172.                                        // Bit6 UNUSED
  173. sbit MCE0    = 0x9D;                   // Multiprocessor communication enable
  174. sbit REN0    = 0x9C;                   // Receive enable
  175. sbit TB80    = 0x9B;                   // Transmit bit 8
  176. sbit RB80    = 0x9A;                   // Receive bit 8
  177. sbit TI0     = 0x99;                   // Transmit interrupt flag
  178. sbit RI0     = 0x98;                   // Receive interrupt flag
  179. // IE 0xA8
  180. sbit EA      = 0xAF;                   // Global interrupt enable
  181. sbit ESPI0   = 0xAE;                   // SPI0 interrupt enable
  182. sbit ET2     = 0xAD;                   // Timer2 interrupt enable
  183. sbit ES0     = 0xAC;                   // UART0 interrupt enable
  184. sbit ET1     = 0xAB;                   // Timer1 interrupt enable
  185. sbit EX1     = 0xAA;                   // External interrupt 1 enable
  186. sbit ET0     = 0xA9;                   // Timer0 interrupt enable
  187. sbit EX0     = 0xA8;                   // External interrupt 0 enable
  188. // IP 0xB8
  189.                                        // Bit7 UNUSED
  190. sbit PSPI0   = 0xBE;                   // SPI0 interrupt priority
  191. sbit PT2     = 0xBD;                   // Timer2 priority
  192. sbit PS0     = 0xBC;                   // UART0 priority
  193. sbit PT1     = 0xBB;                   // Timer1 priority
  194. sbit PX1     = 0xBA;                   // External interrupt 1 priority
  195. sbit PT0     = 0xB9;                   // Timer0 priority
  196. sbit PX0     = 0xB8;                   // External interrupt 0 priority
  197. // SMB0CN 0xC0
  198. sbit MASTER  = 0xC7;                   // Master/slave indicator
  199. sbit TXMODE  = 0xC6;                   // Transmit mode indicator
  200. sbit STA     = 0xC5;                   // Start flag
  201. sbit STO     = 0xC4;                   // Stop flag
  202. sbit ACKRQ   = 0xC3;                   // Acknowledge request
  203. sbit ARBLOST = 0xC2;                   // Arbitration lost indicator
  204. sbit ACK     = 0xC1;                   // Acknowledge flag
  205. sbit SI      = 0xC0;                   // SMBus interrupt flag
  206. // TMR2CN 0xC8
  207. sbit TF2H    = 0xCF;                   // Timer2 high byte overflow flag
  208. sbit TF2L    = 0xCE;                   // Timer2 low byte overflow flag
  209. sbit TF2LEN  = 0xCD;                   // Timer2 low byte interrupt enable
  210. sbit T2SOF   = 0xCC;                   // Timer2 start-of-frame capture enable
  211. sbit T2SPLIT = 0xCB;                   // Timer2 split mode enable
  212. sbit TR2     = 0xCA;                   // Timer2 on/off control
  213.                                        // Bit1 UNUSED
  214. sbit T2XCLK  = 0xC8;                   // Timer2 external clock select
  215. // PSW 0xD0
  216. sbit CY      = 0xD7;                   // Carry flag
  217. sbit AC      = 0xD6;                   // Auxiliary carry flag
  218. sbit F0      = 0xD5;                   // User flag 0
  219. sbit RS1     = 0xD4;                   // Register bank select 1
  220. sbit RS0     = 0xD3;                   // Register bank select 0
  221. sbit OV      = 0xD2;                   // Overflow flag
  222. sbit F1      = 0xD1;                   // User flag 1
  223. sbit P       = 0xD0;                   // Accumulator parity flag
  224. // PCA0CN 0xD8
  225. sbit CF      = 0xDF;                   // PCA0 counter overflow flag
  226. sbit CR      = 0xDE;                   // PCA0 counter run control
  227.                                        // Bit5 UNUSED
  228. sbit CCF4    = 0xDC;                   // PCA0 module4 capture/compare flag
  229. sbit CCF3    = 0xDB;                   // PCA0 module3 capture/compare flag
  230. sbit CCF2    = 0xDA;                   // PCA0 module2 capture/compare flag
  231. sbit CCF1    = 0xD9;                   // PCA0 module1 capture/compare flag
  232. sbit CCF0    = 0xD8;                   // PCA0 module0 capture/compare flag
  233. // ADC0CN 0xE8
  234. sbit AD0EN   = 0xEF;                   // ADC0 enable
  235. sbit AD0TM   = 0xEE;                   // ADC0 track mode
  236. sbit AD0INT  = 0xED;                   // ADC0 converision complete interrupt flag
  237. sbit AD0BUSY = 0xEC;                   // ADC0 busy flag
  238. sbit AD0WINT = 0xEB;                   // ADC0 window compare interrupt flag
  239. sbit AD0CM2  = 0xEA;                   // ADC0 conversion mode select 2
  240. sbit AD0CM1  = 0xE9;                   // ADC0 conversion mode select 1
  241. sbit AD0CM0  = 0xE8;                   // ADC0 conversion mode select 0
  242. // SPI0CN 0xF8
  243. sbit SPIF    = 0xFF;                   // SPI0 interrupt flag
  244. sbit WCOL    = 0xFE;                   // SPI0 write collision flag
  245. sbit MODF    = 0xFD;                   // SPI0 mode fault flag
  246. sbit RXOVRN  = 0xFC;                   // SPI0 rx overrun flag
  247. sbit NSSMD1  = 0xFB;                   // SPI0 slave select mode 1
  248. sbit NSSMD0  = 0xFA;                   // SPI0 slave select mode 0
  249. sbit TXBMT   = 0xF9;                   // SPI0 transmit buffer empty
  250. sbit SPIEN   = 0xF8;                   // SPI0 SPI enable
  251. // 16-bit SFR declarations
  252. sfr16 DP       = 0x82;                 // data pointer
  253. sfr16 TMR2RL   = 0xca;                 // Timer2 reload
  254. sfr16 TMR2     = 0xcc;                 // Timer2 counter
  255. sfr16 TMR3     = 0x94;                 // Timer3 counter
  256. sfr16 TMR3RL   = 0x92;                 // Timer3 reload
  257. sfr16 PCA0CP1  = 0xe9;                 // PCA0 Module 1 Capture/Compare
  258. sfr16 PCA0CP2  = 0xeb;                 // PCA0 Module 2 Capture/Compare
  259. sfr16 PCA0CP3  = 0xed;                 // PCA0 Module 3 Capture/Compare
  260. sfr16 PCA0CP4  = 0xfd;                 // PCA0 Module 4 Capture/Compare
  261. sfr16 PCA0CP0  = 0xfb;                 // PCA0 Module 0 Capture/Compare
  262. sfr16 PCA0     = 0xf9;                 // PCA0 counter
  263. //-----------------------------------------------------------------------------
  264. // Interrupt Priorities
  265. //-----------------------------------------------------------------------------
  266. #define INTERRUPT_INT0             0   // External Interrupt 0
  267. #define INTERRUPT_TIMER0           1   // Timer0 Overflow
  268. #define INTERRUPT_INT1             2   // External Interrupt 1
  269. #define INTERRUPT_TIMER1           3   // Timer1 Overflow
  270. #define INTERRUPT_UART0            4   // Serial Port 0
  271. #define INTERRUPT_TIMER2           5   // Timer2 Overflow
  272. #define INTERRUPT_SPI0             6   // Serial Peripheral Interface 0
  273. #define INTERRUPT_SMBUS0           7   // SMBus0 Interface
  274. #define INTERRUPT_USB0             8   // USB Interface
  275. #define INTERRUPT_ADC0_WINDOW      9   // ADC0 Window Comparison
  276. #define INTERRUPT_ADC0_EOC         10  // ADC0 End Of Conversion
  277. #define INTERRUPT_PCA0             11  // PCA0 Peripheral
  278. #define INTERRUPT_COMPARATOR0      12  // Comparator0
  279. #define INTERRUPT_COMPARATOR1      13  // Comparator1
  280. #define INTERRUPT_TIMER3           14  // Timer3 Overflow
  281. #define INTERRUPT_VBUS_LEVEL       15  // VBUS level-triggered interrupt
  282. #define INTERRUPT_UART1            16  // Serial Port 1
  283. //-----------------------------------------------------------------------------
  284. // Header File PreProcessor Directive
  285. //-----------------------------------------------------------------------------
  286. /************************************************************
  287. * STANDARD BITS
  288. ************************************************************/
  289. #define BIT0                (0x01)
  290. #define BIT1                (0x02)
  291. #define BIT2                (0x04)
  292. #define BIT3                (0x08)
  293. #define BIT4                (0x10)
  294. #define BIT5                (0x20)
  295. #define BIT6                (0x40)
  296. #define BIT7                (0x80)
  297. #endif                                 // #define C8051F340_H
  298. //-----------------------------------------------------------------------------
  299. // End Of File
  300. //-----------------------------------------------------------------------------