C– – Efficiency
5-41
Code Development Tools
Seven of the files are important to the functionality of this project. The Timer2
ISR (tim2_isr.asm) forms the basis for the RTC so it will be discussed first.
timer2_isr
mov *save_tim2_stat,STAT
;save status
mov *save_tim2_a0,a0
;save
a0
; timer fired so 1 second passed
; update the variable storing the seconds passed so far
mov a0, *seconds_passed
add a0, a0, 1
mov *seconds_passed, a0
mov a0,*save_tim2_a0
;restore
a0
mov STAT,*save_tim2_stat
;restore status
inte
;turn interrupts back on
iret
The Timer2 ISR is configured to fire at 1 second intervals. Each time the ISR
executes, it saves any registers that it will modify, increments the RAM location
seconds_passed, and restores the registers it modified.
The second important file is main_ram.irx. It is used to allocate RAM for
seconds_passed and for saving and restoring registers in the Timer2 ISR.
;****************************************************************
; MAIN_RAM.IRX
;
; Start of memory for MAIN module is defined in
;
include
”..\ram\ram.irx”
;****************************************************************
; Timer 2 interrupt variables
save_tim2_stat
equ RAMSTART_CU 2 * 1
save_tim2_a0
equ save_tim 2 * 1
seconds_passed
equ save_t 2 * 1
RAMSTART_CMM1
equ seconds_passed
include ”cmm1_ram.irx”
; End of RAM
RAMEND_CUSTOMER equ RAMEND_CMM1
RAMLENGTH_CUSTOMER
equ RAMEND_CUSTOMER – RAMSTART_CUSTOMER
Any additional ram that is used in an ISR or in mainasm.asm should be
allocated here. RAM is allocated by making a new label and setting it equal to
the previous label plus an offset. A variable called some_variable could be
allocated by changing
seconds_passed
equ save_t 2 * 1
RAMSTART_CMM1
equ seconds_passed
to
seconds_passed
equ save_t 2 * 1
some_variable
equ seconds_ 2 * 1
RAMSTART_CMM1
equ some_variable
The next important file is vroncof2.asm. Most of this file is used to support
standard C functionality and will not need to be changed. The part that will
Содержание MSP50C6xx
Страница 1: ...MSP50C6xx Mixed Signal Processor User s Guide Mixed Signal Products SPSU014A Printed on Recycled Paper...
Страница 6: ...vi...
Страница 14: ...xiv...
Страница 24: ...1 10...
Страница 296: ...Instruction Set Summay 4 210 Assembly Language Instructions...
Страница 332: ...Implementation Details 5 36 R7 Return Addr Return Addr Param 2 Param 2 Param 1 Param 1 R5 Stack data Function call...
Страница 366: ...6 12...