You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

738 lines
25 KiB

  1. ;***** THIS IS A MACHINE GENERATED FILE - DO NOT EDIT ********************
  2. ;***** Created: 2009-11-03 14:40 ******* Source: ATmega8.xml *************
  3. ;*************************************************************************
  4. ;* A P P L I C A T I O N N O T E F O R T H E A V R F A M I L Y
  5. ;*
  6. ;* Number : AVR000
  7. ;* File Name : "m8def.inc"
  8. ;* Title : Register/Bit Definitions for the ATmega8
  9. ;* Date : 2009-11-03
  10. ;* Version : 2.35
  11. ;* Support E-mail : avr@atmel.com
  12. ;* Target MCU : ATmega8
  13. ;*
  14. ;* DESCRIPTION
  15. ;* When including this file in the assembly program file, all I/O register
  16. ;* names and I/O register bit names appearing in the data book can be used.
  17. ;* In addition, the six registers forming the three data pointers X, Y and
  18. ;* Z have been assigned names XL - ZH. Highest RAM address for Internal
  19. ;* SRAM is also defined
  20. ;*
  21. ;* The Register names are represented by their hexadecimal address.
  22. ;*
  23. ;* The Register Bit names are represented by their bit number (0-7).
  24. ;*
  25. ;* Please observe the difference in using the bit names with instructions
  26. ;* such as "sbr"/"cbr" (set/clear bit in register) and "sbrs"/"sbrc"
  27. ;* (skip if bit in register set/cleared). The following example illustrates
  28. ;* this:
  29. ;*
  30. ;* in r16,PORTB ;read PORTB latch
  31. ;* sbr r16,(1<<PB6)+(1<<PB5) ;set PB6 and PB5 (use masks, not bit#)
  32. ;* out PORTB,r16 ;output to PORTB
  33. ;*
  34. ;* in r16,TIFR ;read the Timer Interrupt Flag Register
  35. ;* sbrc r16,TOV0 ;test the overflow flag (use bit#)
  36. ;* rjmp TOV0_is_set ;jump if set
  37. ;* ... ;otherwise do something else
  38. ;*************************************************************************
  39. #ifndef _M8DEF_INC_
  40. #define _M8DEF_INC_
  41. #pragma partinc 0
  42. ; ***** SPECIFY DEVICE ***************************************************
  43. .device ATmega8
  44. #pragma AVRPART ADMIN PART_NAME ATmega8
  45. .equ SIGNATURE_000 = 0x1e
  46. .equ SIGNATURE_001 = 0x93
  47. .equ SIGNATURE_002 = 0x07
  48. #pragma AVRPART CORE CORE_VERSION V2E
  49. ; ***** I/O REGISTER DEFINITIONS *****************************************
  50. ; NOTE:
  51. ; Definitions marked "MEMORY MAPPED"are extended I/O ports
  52. ; and cannot be used with IN/OUT instructions
  53. .equ SREG = 0x3f
  54. .equ SPL = 0x3d
  55. .equ SPH = 0x3e
  56. .equ GICR = 0x3b
  57. .equ GIFR = 0x3a
  58. .equ TIMSK = 0x39
  59. .equ TIFR = 0x38
  60. .equ SPMCR = 0x37
  61. .equ TWCR = 0x36
  62. .equ MCUCR = 0x35
  63. .equ MCUCSR = 0x34
  64. .equ TCCR0 = 0x33
  65. .equ TCNT0 = 0x32
  66. .equ OSCCAL = 0x31
  67. .equ SFIOR = 0x30
  68. .equ TCCR1A = 0x2f
  69. .equ TCCR1B = 0x2e
  70. .equ TCNT1L = 0x2c
  71. .equ TCNT1H = 0x2d
  72. .equ OCR1AL = 0x2a
  73. .equ OCR1AH = 0x2b
  74. .equ OCR1BL = 0x28
  75. .equ OCR1BH = 0x29
  76. .equ ICR1L = 0x26
  77. .equ ICR1H = 0x27
  78. .equ TCCR2 = 0x25
  79. .equ TCNT2 = 0x24
  80. .equ OCR2 = 0x23
  81. .equ ASSR = 0x22
  82. .equ WDTCR = 0x21
  83. .equ UBRRH = 0x20
  84. .equ UCSRC = 0x20
  85. .equ EEARL = 0x1e
  86. .equ EEARH = 0x1f
  87. .equ EEDR = 0x1d
  88. .equ EECR = 0x1c
  89. .equ PORTB = 0x18
  90. .equ DDRB = 0x17
  91. .equ PINB = 0x16
  92. .equ PORTC = 0x15
  93. .equ DDRC = 0x14
  94. .equ PINC = 0x13
  95. .equ PORTD = 0x12
  96. .equ DDRD = 0x11
  97. .equ PIND = 0x10
  98. .equ SPDR = 0x0f
  99. .equ SPSR = 0x0e
  100. .equ SPCR = 0x0d
  101. .equ UDR = 0x0c
  102. .equ UCSRA = 0x0b
  103. .equ UCSRB = 0x0a
  104. .equ UBRRL = 0x09
  105. .equ ACSR = 0x08
  106. .equ ADMUX = 0x07
  107. .equ ADCSRA = 0x06
  108. .equ ADCL = 0x04
  109. .equ ADCH = 0x05
  110. .equ TWDR = 0x03
  111. .equ TWAR = 0x02
  112. .equ TWSR = 0x01
  113. .equ TWBR = 0x00
  114. ; ***** BIT DEFINITIONS **************************************************
  115. ; ***** ANALOG_COMPARATOR ************
  116. ; SFIOR - Special Function IO Register
  117. .equ ACME = 3 ; Analog Comparator Multiplexer Enable
  118. ; ACSR - Analog Comparator Control And Status Register
  119. .equ ACIS0 = 0 ; Analog Comparator Interrupt Mode Select bit 0
  120. .equ ACIS1 = 1 ; Analog Comparator Interrupt Mode Select bit 1
  121. .equ ACIC = 2 ; Analog Comparator Input Capture Enable
  122. .equ ACIE = 3 ; Analog Comparator Interrupt Enable
  123. .equ ACI = 4 ; Analog Comparator Interrupt Flag
  124. .equ ACO = 5 ; Analog Compare Output
  125. .equ ACBG = 6 ; Analog Comparator Bandgap Select
  126. .equ ACD = 7 ; Analog Comparator Disable
  127. ; ***** SPI **************************
  128. ; SPDR - SPI Data Register
  129. .equ SPDR0 = 0 ; SPI Data Register bit 0
  130. .equ SPDR1 = 1 ; SPI Data Register bit 1
  131. .equ SPDR2 = 2 ; SPI Data Register bit 2
  132. .equ SPDR3 = 3 ; SPI Data Register bit 3
  133. .equ SPDR4 = 4 ; SPI Data Register bit 4
  134. .equ SPDR5 = 5 ; SPI Data Register bit 5
  135. .equ SPDR6 = 6 ; SPI Data Register bit 6
  136. .equ SPDR7 = 7 ; SPI Data Register bit 7
  137. ; SPSR - SPI Status Register
  138. .equ SPI2X = 0 ; Double SPI Speed Bit
  139. .equ WCOL = 6 ; Write Collision Flag
  140. .equ SPIF = 7 ; SPI Interrupt Flag
  141. ; SPCR - SPI Control Register
  142. .equ SPR0 = 0 ; SPI Clock Rate Select 0
  143. .equ SPR1 = 1 ; SPI Clock Rate Select 1
  144. .equ CPHA = 2 ; Clock Phase
  145. .equ CPOL = 3 ; Clock polarity
  146. .equ MSTR = 4 ; Master/Slave Select
  147. .equ DORD = 5 ; Data Order
  148. .equ SPE = 6 ; SPI Enable
  149. .equ SPIE = 7 ; SPI Interrupt Enable
  150. ; ***** EXTERNAL_INTERRUPT ***********
  151. ; GICR - General Interrupt Control Register
  152. .equ GIMSK = GICR ; For compatibility
  153. .equ IVCE = 0 ; Interrupt Vector Change Enable
  154. .equ IVSEL = 1 ; Interrupt Vector Select
  155. .equ INT0 = 6 ; External Interrupt Request 0 Enable
  156. .equ INT1 = 7 ; External Interrupt Request 1 Enable
  157. ; GIFR - General Interrupt Flag Register
  158. .equ INTF0 = 6 ; External Interrupt Flag 0
  159. .equ INTF1 = 7 ; External Interrupt Flag 1
  160. ; MCUCR - MCU Control Register
  161. .equ ISC00 = 0 ; Interrupt Sense Control 0 Bit 0
  162. .equ ISC01 = 1 ; Interrupt Sense Control 0 Bit 1
  163. .equ ISC10 = 2 ; Interrupt Sense Control 1 Bit 0
  164. .equ ISC11 = 3 ; Interrupt Sense Control 1 Bit 1
  165. ; ***** TIMER_COUNTER_0 **************
  166. ; TIMSK - Timer/Counter Interrupt Mask Register
  167. .equ TOIE0 = 0 ; Timer/Counter0 Overflow Interrupt Enable
  168. ; TIFR - Timer/Counter Interrupt Flag register
  169. .equ TOV0 = 0 ; Timer/Counter0 Overflow Flag
  170. ; TCCR0 - Timer/Counter0 Control Register
  171. .equ CS00 = 0 ; Clock Select0 bit 0
  172. .equ CS01 = 1 ; Clock Select0 bit 1
  173. .equ CS02 = 2 ; Clock Select0 bit 2
  174. ; TCNT0 - Timer Counter 0
  175. .equ TCNT00 = 0 ; Timer Counter 0 bit 0
  176. .equ TCNT01 = 1 ; Timer Counter 0 bit 1
  177. .equ TCNT02 = 2 ; Timer Counter 0 bit 2
  178. .equ TCNT03 = 3 ; Timer Counter 0 bit 3
  179. .equ TCNT04 = 4 ; Timer Counter 0 bit 4
  180. .equ TCNT05 = 5 ; Timer Counter 0 bit 5
  181. .equ TCNT06 = 6 ; Timer Counter 0 bit 6
  182. .equ TCNT07 = 7 ; Timer Counter 0 bit 7
  183. ; ***** TIMER_COUNTER_1 **************
  184. ; TIMSK - Timer/Counter Interrupt Mask Register
  185. .equ TOIE1 = 2 ; Timer/Counter1 Overflow Interrupt Enable
  186. .equ OCIE1B = 3 ; Timer/Counter1 Output CompareB Match Interrupt Enable
  187. .equ OCIE1A = 4 ; Timer/Counter1 Output CompareA Match Interrupt Enable
  188. .equ TICIE1 = 5 ; Timer/Counter1 Input Capture Interrupt Enable
  189. ; TIFR - Timer/Counter Interrupt Flag register
  190. .equ TOV1 = 2 ; Timer/Counter1 Overflow Flag
  191. .equ OCF1B = 3 ; Output Compare Flag 1B
  192. .equ OCF1A = 4 ; Output Compare Flag 1A
  193. .equ ICF1 = 5 ; Input Capture Flag 1
  194. ; TCCR1A - Timer/Counter1 Control Register A
  195. .equ WGM10 = 0 ; Waveform Generation Mode
  196. .equ PWM10 = WGM10 ; For compatibility
  197. .equ WGM11 = 1 ; Waveform Generation Mode
  198. .equ PWM11 = WGM11 ; For compatibility
  199. .equ FOC1B = 2 ; Force Output Compare 1B
  200. .equ FOC1A = 3 ; Force Output Compare 1A
  201. .equ COM1B0 = 4 ; Compare Output Mode 1B, bit 0
  202. .equ COM1B1 = 5 ; Compare Output Mode 1B, bit 1
  203. .equ COM1A0 = 6 ; Compare Ouput Mode 1A, bit 0
  204. .equ COM1A1 = 7 ; Compare Output Mode 1A, bit 1
  205. ; TCCR1B - Timer/Counter1 Control Register B
  206. .equ CS10 = 0 ; Prescaler source of Timer/Counter 1
  207. .equ CS11 = 1 ; Prescaler source of Timer/Counter 1
  208. .equ CS12 = 2 ; Prescaler source of Timer/Counter 1
  209. .equ WGM12 = 3 ; Waveform Generation Mode
  210. .equ CTC10 = WGM12 ; For compatibility
  211. .equ CTC1 = WGM12 ; For compatibility
  212. .equ WGM13 = 4 ; Waveform Generation Mode
  213. .equ CTC11 = WGM13 ; For compatibility
  214. .equ ICES1 = 6 ; Input Capture 1 Edge Select
  215. .equ ICNC1 = 7 ; Input Capture 1 Noise Canceler
  216. ; ***** TIMER_COUNTER_2 **************
  217. ; TIMSK - Timer/Counter Interrupt Mask register
  218. .equ TOIE2 = 6 ; Timer/Counter2 Overflow Interrupt Enable
  219. .equ OCIE2 = 7 ; Timer/Counter2 Output Compare Match Interrupt Enable
  220. ; TIFR - Timer/Counter Interrupt Flag Register
  221. .equ TOV2 = 6 ; Timer/Counter2 Overflow Flag
  222. .equ OCF2 = 7 ; Output Compare Flag 2
  223. ; TCCR2 - Timer/Counter2 Control Register
  224. .equ CS20 = 0 ; Clock Select bit 0
  225. .equ CS21 = 1 ; Clock Select bit 1
  226. .equ CS22 = 2 ; Clock Select bit 2
  227. .equ WGM21 = 3 ; Waveform Generation Mode
  228. .equ CTC2 = WGM21 ; For compatibility
  229. .equ COM20 = 4 ; Compare Output Mode bit 0
  230. .equ COM21 = 5 ; Compare Output Mode bit 1
  231. .equ WGM20 = 6 ; Waveform Genration Mode
  232. .equ PWM2 = WGM20 ; For compatibility
  233. .equ FOC2 = 7 ; Force Output Compare
  234. ; TCNT2 - Timer/Counter2
  235. .equ TCNT2_0 = 0 ; Timer/Counter 2 bit 0
  236. .equ TCNT2_1 = 1 ; Timer/Counter 2 bit 1
  237. .equ TCNT2_2 = 2 ; Timer/Counter 2 bit 2
  238. .equ TCNT2_3 = 3 ; Timer/Counter 2 bit 3
  239. .equ TCNT2_4 = 4 ; Timer/Counter 2 bit 4
  240. .equ TCNT2_5 = 5 ; Timer/Counter 2 bit 5
  241. .equ TCNT2_6 = 6 ; Timer/Counter 2 bit 6
  242. .equ TCNT2_7 = 7 ; Timer/Counter 2 bit 7
  243. ; OCR2 - Timer/Counter2 Output Compare Register
  244. .equ OCR2_0 = 0 ; Timer/Counter2 Output Compare Register Bit 0
  245. .equ OCR2_1 = 1 ; Timer/Counter2 Output Compare Register Bit 1
  246. .equ OCR2_2 = 2 ; Timer/Counter2 Output Compare Register Bit 2
  247. .equ OCR2_3 = 3 ; Timer/Counter2 Output Compare Register Bit 3
  248. .equ OCR2_4 = 4 ; Timer/Counter2 Output Compare Register Bit 4
  249. .equ OCR2_5 = 5 ; Timer/Counter2 Output Compare Register Bit 5
  250. .equ OCR2_6 = 6 ; Timer/Counter2 Output Compare Register Bit 6
  251. .equ OCR2_7 = 7 ; Timer/Counter2 Output Compare Register Bit 7
  252. ; ASSR - Asynchronous Status Register
  253. .equ TCR2UB = 0 ; Timer/counter Control Register2 Update Busy
  254. .equ OCR2UB = 1 ; Output Compare Register2 Update Busy
  255. .equ TCN2UB = 2 ; Timer/Counter2 Update Busy
  256. .equ AS2 = 3 ; Asynchronous Timer/counter2
  257. ; SFIOR - Special Function IO Register
  258. .equ PSR2 = 1 ; Prescaler Reset Timer/Counter2
  259. ; ***** USART ************************
  260. ; UDR - USART I/O Data Register
  261. .equ UDR0 = 0 ; USART I/O Data Register bit 0
  262. .equ UDR1 = 1 ; USART I/O Data Register bit 1
  263. .equ UDR2 = 2 ; USART I/O Data Register bit 2
  264. .equ UDR3 = 3 ; USART I/O Data Register bit 3
  265. .equ UDR4 = 4 ; USART I/O Data Register bit 4
  266. .equ UDR5 = 5 ; USART I/O Data Register bit 5
  267. .equ UDR6 = 6 ; USART I/O Data Register bit 6
  268. .equ UDR7 = 7 ; USART I/O Data Register bit 7
  269. ; UCSRA - USART Control and Status Register A
  270. .equ USR = UCSRA ; For compatibility
  271. .equ MPCM = 0 ; Multi-processor Communication Mode
  272. .equ U2X = 1 ; Double the USART transmission speed
  273. .equ UPE = 2 ; Parity Error
  274. .equ PE = UPE ; For compatibility
  275. .equ DOR = 3 ; Data overRun
  276. .equ FE = 4 ; Framing Error
  277. .equ UDRE = 5 ; USART Data Register Empty
  278. .equ TXC = 6 ; USART Transmitt Complete
  279. .equ RXC = 7 ; USART Receive Complete
  280. ; UCSRB - USART Control and Status Register B
  281. .equ UCR = UCSRB ; For compatibility
  282. .equ TXB8 = 0 ; Transmit Data Bit 8
  283. .equ RXB8 = 1 ; Receive Data Bit 8
  284. .equ UCSZ2 = 2 ; Character Size
  285. .equ CHR9 = UCSZ2 ; For compatibility
  286. .equ TXEN = 3 ; Transmitter Enable
  287. .equ RXEN = 4 ; Receiver Enable
  288. .equ UDRIE = 5 ; USART Data register Empty Interrupt Enable
  289. .equ TXCIE = 6 ; TX Complete Interrupt Enable
  290. .equ RXCIE = 7 ; RX Complete Interrupt Enable
  291. ; UCSRC - USART Control and Status Register C
  292. .equ UCPOL = 0 ; Clock Polarity
  293. .equ UCSZ0 = 1 ; Character Size
  294. .equ UCSZ1 = 2 ; Character Size
  295. .equ USBS = 3 ; Stop Bit Select
  296. .equ UPM0 = 4 ; Parity Mode Bit 0
  297. .equ UPM1 = 5 ; Parity Mode Bit 1
  298. .equ UMSEL = 6 ; USART Mode Select
  299. .equ URSEL = 7 ; Register Select
  300. .equ UBRRHI = UBRRH ; For compatibility
  301. ; ***** TWI **************************
  302. ; TWBR - TWI Bit Rate register
  303. .equ I2BR = TWBR ; For compatibility
  304. .equ TWBR0 = 0 ;
  305. .equ TWBR1 = 1 ;
  306. .equ TWBR2 = 2 ;
  307. .equ TWBR3 = 3 ;
  308. .equ TWBR4 = 4 ;
  309. .equ TWBR5 = 5 ;
  310. .equ TWBR6 = 6 ;
  311. .equ TWBR7 = 7 ;
  312. ; TWCR - TWI Control Register
  313. .equ I2CR = TWCR ; For compatibility
  314. .equ TWIE = 0 ; TWI Interrupt Enable
  315. .equ I2IE = TWIE ; For compatibility
  316. .equ TWEN = 2 ; TWI Enable Bit
  317. .equ I2EN = TWEN ; For compatibility
  318. .equ ENI2C = TWEN ; For compatibility
  319. .equ TWWC = 3 ; TWI Write Collition Flag
  320. .equ I2WC = TWWC ; For compatibility
  321. .equ TWSTO = 4 ; TWI Stop Condition Bit
  322. .equ I2STO = TWSTO ; For compatibility
  323. .equ TWSTA = 5 ; TWI Start Condition Bit
  324. .equ I2STA = TWSTA ; For compatibility
  325. .equ TWEA = 6 ; TWI Enable Acknowledge Bit
  326. .equ I2EA = TWEA ; For compatibility
  327. .equ TWINT = 7 ; TWI Interrupt Flag
  328. .equ I2INT = TWINT ; For compatibility
  329. ; TWSR - TWI Status Register
  330. .equ I2SR = TWSR ; For compatibility
  331. .equ TWPS0 = 0 ; TWI Prescaler
  332. .equ TWS0 = TWPS0 ; For compatibility
  333. .equ I2GCE = TWPS0 ; For compatibility
  334. .equ TWPS1 = 1 ; TWI Prescaler
  335. .equ TWS1 = TWPS1 ; For compatibility
  336. .equ TWS3 = 3 ; TWI Status
  337. .equ I2S3 = TWS3 ; For compatibility
  338. .equ TWS4 = 4 ; TWI Status
  339. .equ I2S4 = TWS4 ; For compatibility
  340. .equ TWS5 = 5 ; TWI Status
  341. .equ I2S5 = TWS5 ; For compatibility
  342. .equ TWS6 = 6 ; TWI Status
  343. .equ I2S6 = TWS6 ; For compatibility
  344. .equ TWS7 = 7 ; TWI Status
  345. .equ I2S7 = TWS7 ; For compatibility
  346. ; TWDR - TWI Data register
  347. .equ I2DR = TWDR ; For compatibility
  348. .equ TWD0 = 0 ; TWI Data Register Bit 0
  349. .equ TWD1 = 1 ; TWI Data Register Bit 1
  350. .equ TWD2 = 2 ; TWI Data Register Bit 2
  351. .equ TWD3 = 3 ; TWI Data Register Bit 3
  352. .equ TWD4 = 4 ; TWI Data Register Bit 4
  353. .equ TWD5 = 5 ; TWI Data Register Bit 5
  354. .equ TWD6 = 6 ; TWI Data Register Bit 6
  355. .equ TWD7 = 7 ; TWI Data Register Bit 7
  356. ; TWAR - TWI (Slave) Address register
  357. .equ I2AR = TWAR ; For compatibility
  358. .equ TWGCE = 0 ; TWI General Call Recognition Enable Bit
  359. .equ TWA0 = 1 ; TWI (Slave) Address register Bit 0
  360. .equ TWA1 = 2 ; TWI (Slave) Address register Bit 1
  361. .equ TWA2 = 3 ; TWI (Slave) Address register Bit 2
  362. .equ TWA3 = 4 ; TWI (Slave) Address register Bit 3
  363. .equ TWA4 = 5 ; TWI (Slave) Address register Bit 4
  364. .equ TWA5 = 6 ; TWI (Slave) Address register Bit 5
  365. .equ TWA6 = 7 ; TWI (Slave) Address register Bit 6
  366. ; ***** WATCHDOG *********************
  367. ; WDTCR - Watchdog Timer Control Register
  368. .equ WDTCSR = WDTCR ; For compatibility
  369. .equ WDP0 = 0 ; Watch Dog Timer Prescaler bit 0
  370. .equ WDP1 = 1 ; Watch Dog Timer Prescaler bit 1
  371. .equ WDP2 = 2 ; Watch Dog Timer Prescaler bit 2
  372. .equ WDE = 3 ; Watch Dog Enable
  373. .equ WDCE = 4 ; Watchdog Change Enable
  374. .equ WDTOE = WDCE ; For compatibility
  375. ; ***** PORTB ************************
  376. ; PORTB - Port B Data Register
  377. .equ PORTB0 = 0 ; Port B Data Register bit 0
  378. .equ PB0 = 0 ; For compatibility
  379. .equ PORTB1 = 1 ; Port B Data Register bit 1
  380. .equ PB1 = 1 ; For compatibility
  381. .equ PORTB2 = 2 ; Port B Data Register bit 2
  382. .equ PB2 = 2 ; For compatibility
  383. .equ PORTB3 = 3 ; Port B Data Register bit 3
  384. .equ PB3 = 3 ; For compatibility
  385. .equ PORTB4 = 4 ; Port B Data Register bit 4
  386. .equ PB4 = 4 ; For compatibility
  387. .equ PORTB5 = 5 ; Port B Data Register bit 5
  388. .equ PB5 = 5 ; For compatibility
  389. .equ PORTB6 = 6 ; Port B Data Register bit 6
  390. .equ PB6 = 6 ; For compatibility
  391. .equ PORTB7 = 7 ; Port B Data Register bit 7
  392. .equ PB7 = 7 ; For compatibility
  393. ; DDRB - Port B Data Direction Register
  394. .equ DDB0 = 0 ; Port B Data Direction Register bit 0
  395. .equ DDB1 = 1 ; Port B Data Direction Register bit 1
  396. .equ DDB2 = 2 ; Port B Data Direction Register bit 2
  397. .equ DDB3 = 3 ; Port B Data Direction Register bit 3
  398. .equ DDB4 = 4 ; Port B Data Direction Register bit 4
  399. .equ DDB5 = 5 ; Port B Data Direction Register bit 5
  400. .equ DDB6 = 6 ; Port B Data Direction Register bit 6
  401. .equ DDB7 = 7 ; Port B Data Direction Register bit 7
  402. ; PINB - Port B Input Pins
  403. .equ PINB0 = 0 ; Port B Input Pins bit 0
  404. .equ PINB1 = 1 ; Port B Input Pins bit 1
  405. .equ PINB2 = 2 ; Port B Input Pins bit 2
  406. .equ PINB3 = 3 ; Port B Input Pins bit 3
  407. .equ PINB4 = 4 ; Port B Input Pins bit 4
  408. .equ PINB5 = 5 ; Port B Input Pins bit 5
  409. .equ PINB6 = 6 ; Port B Input Pins bit 6
  410. .equ PINB7 = 7 ; Port B Input Pins bit 7
  411. ; ***** PORTC ************************
  412. ; PORTC - Port C Data Register
  413. .equ PORTC0 = 0 ; Port C Data Register bit 0
  414. .equ PC0 = 0 ; For compatibility
  415. .equ PORTC1 = 1 ; Port C Data Register bit 1
  416. .equ PC1 = 1 ; For compatibility
  417. .equ PORTC2 = 2 ; Port C Data Register bit 2
  418. .equ PC2 = 2 ; For compatibility
  419. .equ PORTC3 = 3 ; Port C Data Register bit 3
  420. .equ PC3 = 3 ; For compatibility
  421. .equ PORTC4 = 4 ; Port C Data Register bit 4
  422. .equ PC4 = 4 ; For compatibility
  423. .equ PORTC5 = 5 ; Port C Data Register bit 5
  424. .equ PC5 = 5 ; For compatibility
  425. .equ PORTC6 = 6 ; Port C Data Register bit 6
  426. .equ PC6 = 6 ; For compatibility
  427. ; DDRC - Port C Data Direction Register
  428. .equ DDC0 = 0 ; Port C Data Direction Register bit 0
  429. .equ DDC1 = 1 ; Port C Data Direction Register bit 1
  430. .equ DDC2 = 2 ; Port C Data Direction Register bit 2
  431. .equ DDC3 = 3 ; Port C Data Direction Register bit 3
  432. .equ DDC4 = 4 ; Port C Data Direction Register bit 4
  433. .equ DDC5 = 5 ; Port C Data Direction Register bit 5
  434. .equ DDC6 = 6 ; Port C Data Direction Register bit 6
  435. ; PINC - Port C Input Pins
  436. .equ PINC0 = 0 ; Port C Input Pins bit 0
  437. .equ PINC1 = 1 ; Port C Input Pins bit 1
  438. .equ PINC2 = 2 ; Port C Input Pins bit 2
  439. .equ PINC3 = 3 ; Port C Input Pins bit 3
  440. .equ PINC4 = 4 ; Port C Input Pins bit 4
  441. .equ PINC5 = 5 ; Port C Input Pins bit 5
  442. .equ PINC6 = 6 ; Port C Input Pins bit 6
  443. ; ***** PORTD ************************
  444. ; PORTD - Port D Data Register
  445. .equ PORTD0 = 0 ; Port D Data Register bit 0
  446. .equ PD0 = 0 ; For compatibility
  447. .equ PORTD1 = 1 ; Port D Data Register bit 1
  448. .equ PD1 = 1 ; For compatibility
  449. .equ PORTD2 = 2 ; Port D Data Register bit 2
  450. .equ PD2 = 2 ; For compatibility
  451. .equ PORTD3 = 3 ; Port D Data Register bit 3
  452. .equ PD3 = 3 ; For compatibility
  453. .equ PORTD4 = 4 ; Port D Data Register bit 4
  454. .equ PD4 = 4 ; For compatibility
  455. .equ PORTD5 = 5 ; Port D Data Register bit 5
  456. .equ PD5 = 5 ; For compatibility
  457. .equ PORTD6 = 6 ; Port D Data Register bit 6
  458. .equ PD6 = 6 ; For compatibility
  459. .equ PORTD7 = 7 ; Port D Data Register bit 7
  460. .equ PD7 = 7 ; For compatibility
  461. ; DDRD - Port D Data Direction Register
  462. .equ DDD0 = 0 ; Port D Data Direction Register bit 0
  463. .equ DDD1 = 1 ; Port D Data Direction Register bit 1
  464. .equ DDD2 = 2 ; Port D Data Direction Register bit 2
  465. .equ DDD3 = 3 ; Port D Data Direction Register bit 3
  466. .equ DDD4 = 4 ; Port D Data Direction Register bit 4
  467. .equ DDD5 = 5 ; Port D Data Direction Register bit 5
  468. .equ DDD6 = 6 ; Port D Data Direction Register bit 6
  469. .equ DDD7 = 7 ; Port D Data Direction Register bit 7
  470. ; PIND - Port D Input Pins
  471. .equ PIND0 = 0 ; Port D Input Pins bit 0
  472. .equ PIND1 = 1 ; Port D Input Pins bit 1
  473. .equ PIND2 = 2 ; Port D Input Pins bit 2
  474. .equ PIND3 = 3 ; Port D Input Pins bit 3
  475. .equ PIND4 = 4 ; Port D Input Pins bit 4
  476. .equ PIND5 = 5 ; Port D Input Pins bit 5
  477. .equ PIND6 = 6 ; Port D Input Pins bit 6
  478. .equ PIND7 = 7 ; Port D Input Pins bit 7
  479. ; ***** EEPROM ***********************
  480. ; EEDR - EEPROM Data Register
  481. .equ EEDR0 = 0 ; EEPROM Data Register bit 0
  482. .equ EEDR1 = 1 ; EEPROM Data Register bit 1
  483. .equ EEDR2 = 2 ; EEPROM Data Register bit 2
  484. .equ EEDR3 = 3 ; EEPROM Data Register bit 3
  485. .equ EEDR4 = 4 ; EEPROM Data Register bit 4
  486. .equ EEDR5 = 5 ; EEPROM Data Register bit 5
  487. .equ EEDR6 = 6 ; EEPROM Data Register bit 6
  488. .equ EEDR7 = 7 ; EEPROM Data Register bit 7
  489. ; EECR - EEPROM Control Register
  490. .equ EERE = 0 ; EEPROM Read Enable
  491. .equ EEWE = 1 ; EEPROM Write Enable
  492. .equ EEMWE = 2 ; EEPROM Master Write Enable
  493. .equ EEWEE = EEMWE ; For compatibility
  494. .equ EERIE = 3 ; EEPROM Ready Interrupt Enable
  495. ; ***** CPU **************************
  496. ; SREG - Status Register
  497. .equ SREG_C = 0 ; Carry Flag
  498. .equ SREG_Z = 1 ; Zero Flag
  499. .equ SREG_N = 2 ; Negative Flag
  500. .equ SREG_V = 3 ; Two's Complement Overflow Flag
  501. .equ SREG_S = 4 ; Sign Bit
  502. .equ SREG_H = 5 ; Half Carry Flag
  503. .equ SREG_T = 6 ; Bit Copy Storage
  504. .equ SREG_I = 7 ; Global Interrupt Enable
  505. ; MCUCR - MCU Control Register
  506. ;.equ ISC00 = 0 ; Interrupt Sense Control 0 Bit 0
  507. ;.equ ISC01 = 1 ; Interrupt Sense Control 0 Bit 1
  508. ;.equ ISC10 = 2 ; Interrupt Sense Control 1 Bit 0
  509. ;.equ ISC11 = 3 ; Interrupt Sense Control 1 Bit 1
  510. .equ SM0 = 4 ; Sleep Mode Select
  511. .equ SM1 = 5 ; Sleep Mode Select
  512. .equ SM2 = 6 ; Sleep Mode Select
  513. .equ SE = 7 ; Sleep Enable
  514. ; MCUCSR - MCU Control And Status Register
  515. .equ MCUSR = MCUCSR ; For compatibility
  516. .equ PORF = 0 ; Power-on reset flag
  517. .equ EXTRF = 1 ; External Reset Flag
  518. .equ BORF = 2 ; Brown-out Reset Flag
  519. .equ WDRF = 3 ; Watchdog Reset Flag
  520. ; OSCCAL - Oscillator Calibration Value
  521. .equ CAL0 = 0 ; Oscillator Calibration Value Bit0
  522. .equ CAL1 = 1 ; Oscillator Calibration Value Bit1
  523. .equ CAL2 = 2 ; Oscillator Calibration Value Bit2
  524. .equ CAL3 = 3 ; Oscillator Calibration Value Bit3
  525. .equ CAL4 = 4 ; Oscillator Calibration Value Bit4
  526. .equ CAL5 = 5 ; Oscillator Calibration Value Bit5
  527. .equ CAL6 = 6 ; Oscillator Calibration Value Bit6
  528. .equ CAL7 = 7 ; Oscillator Calibration Value Bit7
  529. ; SPMCR - Store Program Memory Control Register
  530. .equ SPMEN = 0 ; Store Program Memory Enable
  531. .equ PGERS = 1 ; Page Erase
  532. .equ PGWRT = 2 ; Page Write
  533. .equ BLBSET = 3 ; Boot Lock Bit Set
  534. .equ RWWSRE = 4 ; Read-While-Write Section Read Enable
  535. .equ RWWSB = 6 ; Read-While-Write Section Busy
  536. .equ SPMIE = 7 ; SPM Interrupt Enable
  537. ; SFIOR - Special Function IO Register
  538. .equ PSR10 = 0 ; Prescaler Reset Timer/Counter1 and Timer/Counter0
  539. .equ PUD = 2 ; Pull-up Disable
  540. .equ ADHSM = 4 ; ADC High Speed Mode
  541. ; ***** AD_CONVERTER *****************
  542. ; ADMUX - The ADC multiplexer Selection Register
  543. .equ MUX0 = 0 ; Analog Channel and Gain Selection Bits
  544. .equ MUX1 = 1 ; Analog Channel and Gain Selection Bits
  545. .equ MUX2 = 2 ; Analog Channel and Gain Selection Bits
  546. .equ MUX3 = 3 ; Analog Channel and Gain Selection Bits
  547. .equ ADLAR = 5 ; Left Adjust Result
  548. .equ REFS0 = 6 ; Reference Selection Bit 0
  549. .equ REFS1 = 7 ; Reference Selection Bit 1
  550. ; ADCSRA - The ADC Control and Status register
  551. .equ ADCSR = ADCSRA ; For compatibility
  552. .equ ADPS0 = 0 ; ADC Prescaler Select Bits
  553. .equ ADPS1 = 1 ; ADC Prescaler Select Bits
  554. .equ ADPS2 = 2 ; ADC Prescaler Select Bits
  555. .equ ADIE = 3 ; ADC Interrupt Enable
  556. .equ ADIF = 4 ; ADC Interrupt Flag
  557. .equ ADFR = 5 ; ADC Free Running Select
  558. .equ ADSC = 6 ; ADC Start Conversion
  559. .equ ADEN = 7 ; ADC Enable
  560. ; ***** LOCKSBITS ********************************************************
  561. .equ LB1 = 0 ; Lock bit
  562. .equ LB2 = 1 ; Lock bit
  563. .equ BLB01 = 2 ; Boot Lock bit
  564. .equ BLB02 = 3 ; Boot Lock bit
  565. .equ BLB11 = 4 ; Boot lock bit
  566. .equ BLB12 = 5 ; Boot lock bit
  567. ; ***** FUSES ************************************************************
  568. ; LOW fuse bits
  569. .equ CKSEL0 = 0 ; Select Clock Source
  570. .equ CKSEL1 = 1 ; Select Clock Source
  571. .equ CKSEL2 = 2 ; Select Clock Source
  572. .equ CKSEL3 = 3 ; Select Clock Source
  573. .equ SUT0 = 4 ; Select start-up time
  574. .equ SUT1 = 5 ; Select start-up time
  575. .equ BODEN = 6 ; Brown out detector enable
  576. .equ BODLEVEL = 7 ; Brown out detector trigger level
  577. ; HIGH fuse bits
  578. .equ BOOTRST = 0 ; Select Reset Vector
  579. .equ BOOTSZ0 = 1 ; Select Boot Size
  580. .equ BOOTSZ1 = 2 ; Select Boot Size
  581. .equ EESAVE = 3 ; EEPROM memory is preserved through chip erase
  582. .equ CKOPT = 4 ; Oscillator Options
  583. .equ SPIEN = 5 ; Enable Serial programming and Data Downloading
  584. .equ WTDON = 6 ; Enable watchdog
  585. .equ RSTDISBL = 7 ; Disable reset
  586. ; ***** CPU REGISTER DEFINITIONS *****************************************
  587. .def XH = r27
  588. .def XL = r26
  589. .def YH = r29
  590. .def YL = r28
  591. .def ZH = r31
  592. .def ZL = r30
  593. ; ***** DATA MEMORY DECLARATIONS *****************************************
  594. .equ FLASHEND = 0x0fff ; Note: Word address
  595. .equ IOEND = 0x003f
  596. .equ SRAM_START = 0x0060
  597. .equ SRAM_SIZE = 1024
  598. .equ RAMEND = 0x045f
  599. .equ XRAMEND = 0x0000
  600. .equ E2END = 0x01ff
  601. .equ EEPROMEND = 0x01ff
  602. .equ EEADRBITS = 9
  603. #pragma AVRPART MEMORY PROG_FLASH 8192
  604. #pragma AVRPART MEMORY EEPROM 512
  605. #pragma AVRPART MEMORY INT_SRAM SIZE 1024
  606. #pragma AVRPART MEMORY INT_SRAM START_ADDR 0x60
  607. ; ***** BOOTLOADER DECLARATIONS ******************************************
  608. .equ NRWW_START_ADDR = 0xc00
  609. .equ NRWW_STOP_ADDR = 0xfff
  610. .equ RWW_START_ADDR = 0x0
  611. .equ RWW_STOP_ADDR = 0xbff
  612. .equ PAGESIZE = 32
  613. .equ FIRSTBOOTSTART = 0xf80
  614. .equ SECONDBOOTSTART = 0xf00
  615. .equ THIRDBOOTSTART = 0xe00
  616. .equ FOURTHBOOTSTART = 0xc00
  617. .equ SMALLBOOTSTART = FIRSTBOOTSTART
  618. .equ LARGEBOOTSTART = FOURTHBOOTSTART
  619. ; ***** INTERRUPT VECTORS ************************************************
  620. .equ INT0addr = 0x0001 ; External Interrupt Request 0
  621. .equ INT1addr = 0x0002 ; External Interrupt Request 1
  622. .equ OC2addr = 0x0003 ; Timer/Counter2 Compare Match
  623. .equ OVF2addr = 0x0004 ; Timer/Counter2 Overflow
  624. .equ ICP1addr = 0x0005 ; Timer/Counter1 Capture Event
  625. .equ OC1Aaddr = 0x0006 ; Timer/Counter1 Compare Match A
  626. .equ OC1Baddr = 0x0007 ; Timer/Counter1 Compare Match B
  627. .equ OVF1addr = 0x0008 ; Timer/Counter1 Overflow
  628. .equ OVF0addr = 0x0009 ; Timer/Counter0 Overflow
  629. .equ SPIaddr = 0x000a ; Serial Transfer Complete
  630. .equ URXCaddr = 0x000b ; USART, Rx Complete
  631. .equ UDREaddr = 0x000c ; USART Data Register Empty
  632. .equ UTXCaddr = 0x000d ; USART, Tx Complete
  633. .equ ADCCaddr = 0x000e ; ADC Conversion Complete
  634. .equ ERDYaddr = 0x000f ; EEPROM Ready
  635. .equ ACIaddr = 0x0010 ; Analog Comparator
  636. .equ TWIaddr = 0x0011 ; 2-wire Serial Interface
  637. .equ SPMRaddr = 0x0012 ; Store Program Memory Ready
  638. .equ INT_VECTORS_SIZE = 19 ; size in words
  639. #pragma AVRPART CORE INSTRUCTIONS_NOT_SUPPORTED break
  640. #endif /* _M8DEF_INC_ */
  641. ; ***** END OF FILE ******************************************************