10 likes | 141 Views
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
E N D
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