abstract: this application note provides useful references and describes how to use the max-ide toolset to build applications for maxq® microcontrollers. it specifically explains how to use the max-ide simulator.
introductionthe max-ide is an easy-to-use windows®-based development environment and tool set that gives designers software simulators, emulators and debugging capabilities. using max-ide, developers can create embedded applications for the maxq microcontroller.
overviewthe max-ide toolset provides the following features:
maxq assembler. for the maxq microcontroller instruction set, see section 18.0 of the maxq family user's guide available for download.
project manager
text editor
viewer for processor memory (utility rom/code/data) and registers
debugger with the ability to single-step and set breakpoints
simulators for different maxq devices
statistical reporting for machine cycles, execution time, and other parameters the following files are installed as part of the installation:
genericide.exe: this is a max-ide executable that provides the windows-based integrated development environment including the text editor, project manager, and debugger.
max-ide.hlp: this file contains the max-ide help information. users can access the contents of this file through the max-ide's help menu.
maxqgs.dll: this is the dll file for a maxq device simulator.
macro.exe: this is the executable file for the macro preprocessor. the macro preprocessor takes the assembly source file as an input and converts equates to numeric values and macros to inline code.
maxqasm.exe: this is the maxq assembler. the assembler supports the complete instruction set of maxq. it takes the assembly source file (.asm) as an input and produces an intel hex file (.hex) and a list file (.lst).
dallasassembler.dll: this is the dll file for the maxq assembler.
rom files
romq10.hex: this is the utility rom file for maxq10.
romq20.hex: this is the utility rom file for maxq20.
romq30.hex: this is the utility rom file for maxq30.
sfr (special function register) configuration files:
maxq2000.xml: this is the sfr file for maxq2000
maxq3210.xml: this is the sfr file for maxq3210
maxq765x.xml: this is the sfr file for a maxq765x device
getting started with max-idethis section will help you build a simple assembly-language program using the max-ide (zip). follow these instructions to complete your first application for the maxq and simulate it using the max-ide simulator. for future reference, see the appendix for a helpful list of max-ide commands.
project managerstep 1: choose project→new project from the menu. a new tab will open in the left side of the max-ide's main window. this tab will be empty as there are no files in the project at present. figure 1 shows the max-ide main menu with project menu open.
figure 1. max-ide's initial screens used to create a project.
step 2: before proceeding with the project menu, you need to add files to this project. from the main menu create a new source file by choosing file→new file from the menu. this will open a new editor window with the title untitled 1. enter the assembly code shown in table 1 below. alternatively, you can download the assembly code and add this file to the project, as explained in step 4 below. figure 2 shows the max-ide with the project manager and editor windows open.
figure 2. use the project manager and editor windows to create a new file.
step 3: before adding this new file to the project, you need to save this file. choose file→save untitled1 which opens the save as dialog box. create a new folder, maxide, and save the file to the maxide folder as hex_to_asc.asm.
step 4: to add the source file that we just created to the project, choose project→add files. this will open up the open dialog box. browse to the folder that you created in the previous step, and select hex_to_asc.asm file. you can also perform this operation by right clicking in the project window, and choosing add files from the pop-up window.
note: even if you created the source file in the ide, it will not be part of the project until you add it to the project file
step 5: to save the progress so far, choose project→save from the menu, which opens the save as dialog box. browse to the folder that you created earlier, and save the project as hextoasc.prj.
step 6: activate the simulator by choosing device→maxq simulator, as shown in figure 3.
figure 3. the maxq simulator is accessed from the device menu.
the maxq simulator supports maxq10, maxq20, and maxq30 devices.
to select the device, click on device→options, as illustrated in figure 4.
figure 4. the options window asks you to choose a maxq device.
the drop-down menu in figure 4 shows the available devices, which consist of specific maxq devices (e.g., maxq2000) and generic devices (e.g., maxq10—generic for a maxq10 architecture). note that when you choose a specific device like the maxq2000, the processor is selected automatically. if, for example, the maxq2000 is selected, the maxq20 would be selected automatically as its processor. the user can also change the value for crystal frequency, ring frequency, and timer2 clock. the other fields in this window are non editable.
for this article, we choose the maxq30-generic for the device.
step 7: there are two ways to compile the project: make and build all. using the project menu (see figure 3), make will compile only those files that changed since the last successful compile. build all will always compile all the files.
for this application, press f7 or select project→make.
step 8: if you entered the text exactly as in table 1, you should get an error when you compile at the line lcall hex2asc2
to point to the source of error, double click on the error line in the message window. retype the line t lcall hex2asc and recompile.
table 1. hex_to_asc.asm: converts hex data to its equivalent ascii
;example to explain the usage of max-ide
segment data ; data segment starts here
; default location = 00
; initialize data memory
ch: db 0 ;holds ascii value of upper hex nibble
ch1: db 0 ;holds ascii value of lower hex nibble
ch2: db 0 ;holds hex byte
ch3: db 0
segment code ; code segment starts here
org 0 ; set absolute address of code = 0
maxq30 equ 3
maxq20 equ 2
maxq10 equ 1
;choose maxq to be maxq10, maxq20 or maxq 30 depending
;on the architecture you want to use.
maxq equ maxq30
; this example is with maxq30
if(maxq=maxq30)
#define data_pointer dp[0].b
; for maxq30 , the data pointer is specified to be in byte mode or word mode by using the
; notation dp[0].b or dp[0].w
endif
if(maxq=maxq20)
#define data_pointer dp[0]
move dpc,#18h
; for maxq 20, the data pointer is specified to be in byte mode or word mode through the
; dpc register
endif
if(maxq=maxq10)
#define data_pointer dp[0]
move dpc,#18h
; for maxq 10, the data pointer is specified to be in byte mode or word mode through the
; dpc register
endif
jump main
org 20h ; set absolute address of code = 32 hex
hex2asc:
move a[1], a[0] ; store the hex value for future use
move dp[0], #ch2
move @data_pointer, a[0] ; store the hex value @ #ch2 location
move a[0], a[1] ; process upper nibble
move ap,#0
sra4
add #030h ; value = value + '0'
move a[2],a[0]
sub #03ah
move a[0],a[2]
sjump c, hex2asc_0
; if value > '9', value=value + ('a' - '9') + 1
add #07h
and #0ffh
hex2asc_0:
move dp[0],#ch ; store ascii value of upper hex nibble
move @data_pointer,a[0]
move a[0], a[1] ; process lower hex nibble
and #0fh
add #030h
move a[2],a[0]
sub #03ah
move a[0],a[2]
sjump c,hex2asc_1
; if value > '9', value=value + ('a' - '9') + 1
add #07h
and #0ffh
hex2asc_1:
move dp[0], #ch1 ;store ascii value of lower hex nibble
move @data_pointer, a[0]
ret
main:
move a[0], #041h ; hex value to be converted to ascii
lcall hex2asc ; process the hex value
sjump $ ; run forever
end
the above source code is available at: http://files.dalsemi.com/microcontroller/maxq/app_note_software/max-idesimusersguide.zip (zip)
step 9: recompile the code by pressing f7 or selecting project?make. if compilation is successful, output files named hextoasc.hex and hextoasc_d.hex will be generated along with a list file. you are now ready to run the application.
step 10: before executing the application, set some break points to investigate the application's behavior. click on the line number at the left edge of the editor window to set a breakpoint. the breakpoint will be indicated by a • to the side of the number. set a break point on the line below main, and another at the subroutine, hex2asc. press f5 to start the simulator. this will save the files (if not already saved) and compile the project. if the compilation is successful, the simulator will load the file and start running. when the simulator hits a break point, the program execution will pause at the current line, as indicated by highlighting of the current line and a → mark to the left of the margin.
figure 5 shows the breakpoint and an instance of the application running.
figure 5. the debug windows with the breakpoint indicated by the green arrow and line.
step 11:open up the registers window by clicking on window→show→registers from the window menu. select system from the registers drop-down box to display the maxq core registers' contents. observe that relevant registers are updated as you step through the execution. try the commands step into, step over, step out, and run to cursor to become familiar with the max-ide. similarly, if your program is writing to the data memory and you want like to watch the data values, go to window→show→memory, tab to data memory, and scroll down to the memory location to observe the values.
the above program converts the hex value supplied in the a [0] register to its equivalent ascii value, and stores the ascii values in the data memory addresses 0x00 and 0x02.
execute the application for different values in the a [0], and observe their equivalent ascii values in data memory addresses 0x00 and 0x02.
refer back to figure 4. a [0] is set to 0x41 hex in the registers window; data memory location 0x00 and 0x02 are updated with 0x34 and 0x31 respectively, which are the ascii equivalent of 0x41 hex.
step 12: open the statistics window (window→show→statistics). this action shows you the machine cycles and execution time (figure 5).
figure 6. the statistics window lets you monitor machine cycles and execution time.
conclusionmax-ide, the maxq device simulator, can be used to develop and debug the maxq-based applications for the maxq10, maxq20, and maxq30 devices. the application developed with max-ide is ready to run on the hardware.
appendix: table of max-ide useful commands
command
description
file menu
new file...
open a new text/source file.
open file...
open an existing source file.
save
save the edited file.
save as...
save the newly edited file and give it a name.
close
close the source file.
print...
print the source file.
exit
exit from the ide.
project menu
new project
create a new project.
open project
open an existing project.
save
save the already opened project.
save project as...
save the newly created project and give it a name.
close
close the project.
add files...
add source files to the project.
remove file
remove the source file from the project.
make
compile the modified source file.
build all
compile all the source files in a project.
edit
undo
undo the latest changes.
cut
delete the selected text and keep it in clipboard.
copy
copy the selected text into a clipboard.
paste
paste the text from clipboard to the position pointed to by buffer.
delete
delete the selected text.
select all
select all the text in the editor.
find
find the text in the source file.
find next
find the next occurrence of the text in a source file/project.
replace
replace the text.
find in files
find the text in the project directory.
goto line
go to the specified line in the source file.
tab options
option to select the tab options.
convert tabs to spaces
option to convert the tabs to spaces.
set editor font
option to set the text font.
debug menu
toggle break point
toggle a break point.
run
execute the application.
pause
pause the execution of application.
stop
stop the application.
step into
single step execution. step into the function and execute the current source line.
step over
execute the current source line.
step out
execute all the instructions of the present module and step out of the module.
run to cursor
execute until the line pointed to by cursor.
high level debug
not applicable.
low level debug
not applicable.
make
compile the modified source file.
build all
compile all the source files in a project.
device menu
maxq ice
enables connection with emulator.
maxq jtag
enables connection with device through the jtag.
maxq simulator
enables the simulator.
load
load the hex file into the loader.
options
dialog box for choosing the device and other device settings such as cpu frequency, ring frequency, and alternate clock for timer2.
install device
install a specified maxq device dll into the ide.
remove device
remove the device from the list of devices.
window
show→breakpoints
display a list of break points in a project.
show→find in files
display a list of files where a specified text is found.
show→memory
display memory window. memory window contains code, rom and data area.
show→message
display message window.
show→project
display project window.
show→register
display register window.
show→statistics
display statistics window.
help
contents
display the contents of a help file.
help
display the version of the ide and its components.
赛普拉斯助力打造世界领先的汽车系统
华为为5G时代提供智能网优方案
国产耳机哪个牌子品牌音质好?音质最好的国产蓝牙耳机推荐
不同表面处理工艺的电路板与硅凝胶的匹配(上)
iPhone 4S被山寨!拆解4S高仿机与真机差别在哪里?
MAX-IDE Simulator User's G
一份来自光纤跳线的自述-clan
芯和半导体亮相第三届硬核中国芯领袖峰会
2020上半年无人机领域重要融资事件汇总
铭瑄挑战者B360M主板评测:500元以下唯一的双M.2 B360主板
我国城市轨道发展现状及最新轨道交通技术应用解析
今年手机处理器天梯图出炉,看看你的手机排第几
如何正确选购水晶头
RS5VE引脚配置与内部组成框图
台湾面板与半导体两大优势产业即将被大陆超越
销量被这些品牌挤压!iPhone手机在中国只能当老五
用“视觉”确保品质——IC芯片质量检测
物联网到底是实的还是虚的
如何让更多用户使用到许可证(License),节省采购成本
表面瑕疵在线检测仪可帮助企业快速检测出产品瑕疵