Technical discussions about Freescale Microcontrollers: M68HC11. (Freescale Semiconductor is a Subsidiary of Motorola).
|
A note to Nimish, and others who may be interested: If you choose to use Tony P.'s ASM11 - which I would personally recommend over Motorola's dated AS11 - you should see a file named SAMPLES.ZIP in the collection of files that come with the ASM11 package. In SAMPLES.ZIP you will find several include files (.INC) with names such as 11F1.INC, 711E9.INC, etc. These files contain register definitions for the most common HC11 variants. You can use the ASM11 #INCLUDE directive (near the top of your own code) to include one of these files - just make sure that the appropriate .INC file is in the same directory as your source code. The .INC files I've mentioned contain equates for most/all of the HC11 control registers, as well as several other useful EQU's, such as the start/end of internal EEPROM, interrupt vector table base address, and the like. If you #INCLUDE the appropriate file in your own code, you won't have to go through the tedium of creating your own register-definition symbols. Furthermore, the code examples that people such as Tony (or myself) post here from time to time will likely work with less modification on your part. The .INC files provided with ASM11 define most of the HC11 register addresses, but do not provide bit-mask definitions for the indiviual control bits in each register. I have created a 'standard' include file that I use in most of my HC11 projects, which I will soon be uploading to the files section of this group. It is somewhat more complex than the ones provided by ASM11, but it contains both offset and absolute addresses for all the HC11 control registers, as well as bit-mask symbol definitions for the individual bits within a given control register. Furthermore, by setting a single symbol (MCUType) to the appropriate value before you include HC11AE.A11, the file will automatically generate the appropriate definitions for the HC11 variant you are using. HC11AE.A11 includes extensive comments, so it should not be too hard for you to figure out how to utilize it properly if you take the time to read the comments. Once you have included HC11AE.A11 in your own program, you can do things like shown in the example below: ; See HC11AE.A11 for valid values to use for MCUType MCUType EQU 4 ;Target: MC68HC(7)11E9 #INCLUDE HC11AE.A11 ... ; Declare zero-page variables ORG RAMStart ;RAMStart declared in HC11AE MyByte DS 1 MyWord DS 2 MoreStuff DS 1 ; EEStart defined in HC11AE.A11 ORG EEStart ;EEStart declared in HC11AE ; IOBase defined in HC11AE.A11 ; May also be defined BEFORE HC11AE is #INCLUDEd if you ; use a non-standard register base address LDX #IOBase ;Point to control registers ; Symbols with a "_" suffix are used for indexed addressing BSET PORTD_,X,#$20 ;PD5 = High BSET PORTD_,X,PD5 ;Another way to do it ; Symbols with a "." suffix are used for absolute addressing LDAA PORTC. ;Get PORTC value ORAA #$08 ;PC3 = High STAA PORTC. ; LDAA PORTC. ;Alternative ORAA #PC3 ; STAA PORTC. ; ; Bitmask symbols have no suffix BSET SCCR1_,X,WAKE ;Enable SCI wake-up mode BSET SCCR2_,X,TIE|RIE ;Enable SCI Tx,Rx interrupts ; Symbols for bits in the PSW are also provided TPA ;A <- Status register ORAA #X.|S. ;Enable XIRQ, disable STOP TAP ; ; Defining pseudo-interrupt vectors ; (e.g. if running in bootstrap mode) ; ; Note: Code for RTI_ISR is not shown in this example, ; it is assumed that RTI_ISR is declared/defined elsewhere. LDAA #JMPExt ;JMPExt defined in HC11AE.A11 STAA pRTIVec ; LDD #RTI_ISR ;Define RTI pseudo vector STD pRTIVec+1 ; ; Defining interrupt vectors - normal/expanded mode ORG vRTI DW RTI_ISR ;Define a single vector ORG vRESET DW Startup ;Set the -RESET vector ORG VecStart ;Or, define all vectors DW SCI_ISR DW SPI_ISR DW PAOV_ISR ... DW Startup ------------------------------------ If you find the format and usage of the HC11AE.A11 file confusing, just let me know and I'll do my best to help you understand it and make use of it in your own application. |