Memory Access and Input Latching in 68HC11 Microcontroller
This assembly program demonstrates how to latch input from switches using XOR operations and store values in memory for the 68HC11 MicroStamp11. The program illustrates three different methods for accessing memory, including using input from port D and output to port A. It features practical examples, such as disabling timed interrupts and utilizing memory locations effectively. This code serves as a foundation for understanding memory management and input handling in microcontroller programming.
Memory Access and Input Latching in 68HC11 Microcontroller
E N D
Presentation Transcript
Memory Variables *file: memtest.asm *This program illustrates how to latch input from switches, XOR * and how to store a value in memory. Illustrates 3 different * methods to access memory. D port for input, A port for output *For the 68HC11 MicroStamp11, Dr. Hoganson, 12/04/02 ********************** definitions ***************************** rbase equ $0000 ;beginning of register/memory port_a equ rbase+0 ;port A is the first register port_d equ rbase+8 ;port D is the input port * note that port_d 0 is RXD, 1 is TXD, so can't use h_sec equ $ffff ;delay loop value (about 1/2 second) memtest equ rbase+100 ;location to store variable memtest *********************data section******************************* org 0100 mem2 rmb 1 ;note that memtest and mem2 are * ; at the same location in memory. Creates 1 byte. mem3 fcb $00 ;located at 0101, contents 00 *********************code section******************************* org $e000 ;beginning of EEPROM (68HC811E2) begin: ldaa #$04 ;value to disable timed interrupt staa $3f ;disables an timed interrupt lds #$ff ;set stack start ldaa #$00 ;clear staa port_a loop: ldab port_d ;pins 20 and 19 in use stab mem3 ;substitute mem2 or memtest • Three methods: • Equate label to a location • Declare/reserve memory using rmb or fcb