贴片电感
贴片电感
・  当前位置::扁平线圈电感 > 行业新闻
在MAX-IDE中自动初始化数据段
作者:    来源:    时间:2014-12-28 12:04:35浏览量:

应用程序在闪存中写一个标志,表明已经存储变量。
对于第二步,在后续的程序运行中,应用程序必须将变量从闪存重新装载到预先规定的数据RAM地址。

应用程序检测闪存的标志位置,以验证已经存储变量。
应用程序利用UROM_copyBuffer子程序将变量从闪存复制到数据RAM的正确位置。
以下程序清单展示了利用MAXQ2000评估板的保存-恢复方案,该程序中,变量值存储在闪存的7000h–71FFh地址内。

$include(maxQ2000.inc)

;; Code memory (flash) : 0000h-7FFFh (word addr)
;; Data memory (RAM) : 0000h-03FFh (word addr)

org 0000h

ljump start ; Skip over password area

org 0020h

start:
move DPC, 工字电感器#1Ch ; Set all pointers to word mode
move DP[0], #0F000h ; Check first variable value (flag)
lcall UROM_moveDP0 ; 'move GR, @DP[0]' executed by Utility ROM
move Acc, GR
cmp #1234h
jump NE, copyToFlash

;; This is the "free-running" code, executed on subsequent power-ups, that copies
;; values from the flash back into their proper data segment locations.

move DP[0], #0F000h ; Source: Flash location 7000h
move BP, #0 ; Dest: Start o电感厂家f RAM
move Offs, #0
move LC[0], #100h ; Copy 256 words
lcall UROM_copyBuffer

jump main

;; This is the first-pass code. A bit of a trick here; because MAX-IDE enters
;; and exits the loader separately when loading the code and data segment files,
;; the application is allowed to execute briefly before the data segment file
;; has been loaded. The first four lines under copyFlash ensure that the
;; application waits for MAX-IDE to load the data segment file before continuing.

copyToFlash:
move DP[0], #0h ; Wait for flag variable to be loaded by MAX-IDE.
move Acc, @DP[0] ; Note that this will reset the application; the
cmp #1234h ; data segment is not loaded while the application
jump NE, copyToFlash ; is still running.

move DP[0], #0 ; Start of RAM variable area
move A[4], #7000h ; Location in flash to write to
move LC[0], #100h 电感器生产; Store 256 words in flash 7000h-70FFh

copyToFlash_loop:
move DP[0], DP[0] ; Refresh the data pointer to read values correctly,
; because calling UROM_flashWrite changes memory
; contexts and affects the cached @DP[0] value
move A[0], A[4] ; Location to write
move A[1], @DP[0]++ ; Value to write (taken from RAM)
lcall UROM_flashWrite
move Acc, A[4]
add #1
move A[4], Acc
djnz LC[0], cop薄膜片式电感器yToFlash_loop

main:
move PD0, #0FFh ; Set all port 0 pins to output
move PO0, #000h ; Drive all port 0 pins low (LEDs off)

move DPC, #1Ch ; Set pointers to word mode
move DP[0], #varA
move Acc, @DP[0]
cmp #1234h ; Verify that the variable is set correctly
jump NE, fail

pass:
move PO0, #55h
sjump $

fail:
sjump $

segment data

org 0000h

varA:
dw 1234h

org 00FFh

varB:
dw 5678h

end

结论
MAX-IDE提供的程序段和数据段工具能够在数据存储器中自动声明变量地址,以起始值初始化这些变量。可以利用应用程序在闪存中缓存这些变量,必要时恢复它们。这种方法允许基于汇编的应用程序使用MAX-IDE提供的数据段自动装载功能,无论微控制器是否连接JTAG调试器,都能保持工作。

扁平线圈电感制造厂
  • 基于Arm的电子束焊机灯丝电源的设计方案 4月08日 第三届·无线通信技术研讨会 立即报名 12月04日 2015•第二届中国IoT大会 精彩回顾 10月30日ETF•智能硬件开发技术培训会 精彩回顾 10月23日ETF•第三届 消费

  • [电源技术资料]高性价比大功率单段线性 PM2014DPM2014D产品介绍-大功率单段线性驱动芯片产品特点 ☆TO-252封装 ☆单颗最大功率可做50W ☆最简配置可过4KV浪涌 ☆PF>0.9 ☆内置过温补偿50W最简方案! 可过4KV浪涌PM2014D方案介绍—40W原理图  浪涌要求    对应方案    500V    5.1Ω/1W*1   无压敏    1000V    5.1Ω/1W*1+7D471 *1    2500V    7.5Ω/1W*1+10D471 *1    4000V    15Ω/2W*1+10D471 *1  PM201

  • 想用358/324/393/339/做一个24V欠压保护想用358/324/393/339/做一个24V欠压保护,但是网上只有12V的,麻烦大家帮忙画个24V欠压保护电路,低于21就保护,谢谢大家

  • 上一篇:CCD信号采集系统的USB接口设计