Sei sulla pagina 1di 12

Basic ProView Software Tutorial

Written by Sepehr Jafari Naimi (BIHE)

Introduction
This tutorial will teach you how to write, compile, and trace a simple program in ProView. For more information, you can see ProViews help.

Opening ProView
1. Open the ProView from the start menu.

Creating a new File


2. Select New from the File menu.

3. If you want to write your code in Assembly you should select Assembler files, and if you want to write you code in C, you should choose C Files. As we want to write the first program in assembly, choose Assembler files.

Writing the source code


4. Write the following code. (It is copied from The 8051 Microcontroller and Embedded Systems written by Mazidis.)
ORG MOV MOV MOV 0H R5,#25H A, #0 A, R5 ;start (origin) at location 0 ;load 25H into R5 ;load 34H into R7 ;load 0 into A ;now A = A + R5 ;add contents of R7 to A ;now A = A + R7 ;add to A value 12H ;now A = A + 12H ;stay in this loop ;end of asm source file

ADD A, R7 ADD A, #12H HERE: SJMP HERE END

Saving
5. Press Ctrl + S or choose Save from the File menu.

6. Name your file. Then press Save.

Compiling
7. Press F9 or select Make from the Project menu.

Tracing and Debugging


8. Press Ctrl + D or select Start from Debug.

9. As it is the first time you debug the file, the following dialog appears. Press Ok.

10. Some new windows will be opened:

Main Registers: This window shows the contents of all of the registers, at the current time.

Code: This window shows the contents of the flash memory. In the window: 1) The blue line shows the instruction which will be executed in the next cycle. 2) The violet texts represent your source code. 3) The Mnemonic column represents the assembly equivalent instruction of your code. When your code is in assembly the mnemonic is the same as your code. But, when your code is in C language, it is not. 4) The code column shows the machine equivalent of the instruction. 5) The address column shows where the instruction is located.

11. Press F7 or select step into from Debug menu. It executes the blue instruction and updates the values of registers in Main Registers window. Press F7 a few times and see the changes of registers.

12. Press Ctrl + D or select Terminate from the Debug menu to terminate debugging.

Creating a new Project


When you write a big program, you would better, split your code into some files and put the relevant functions in the same files. To do so, you should make a new project and add your files to the project. 13. Select New from the Project menu.

14. If you want to change the name of the project, type another name in front of Name. If you want to change the path, where the project file will be stored, press the Browse button.

15. Press Ok.

16. Select Add file from the Project menu.

17. Select the ASM file which you have created in the previous steps. Then press Open.

18. The file has been added to the project. Now open your source file by double clicking on the name of it.

19. Debug and trace the project by pressing Ctrl + D and F7 if you like to.

Making Hex File


ProView does not normally make hex files. But you sometimes need it; For example, when we want to feed the Proteus software. To make the ProView software, provide the hex file, go through the following steps: 20. Select Project from the Options menu. The following window appears. 21. Click on L51. 22. Click on Linker. 23. Activate Intel Hex. 24. Press OK.

Potrebbero piacerti anche