Download presentation
Presentation is loading. Please wait.
1
8051 Development Tools http://bit.kuas.edu.tw/~8051 Assembler / Simulator / C Compiler
2
Tools Used in This Course EDITOR PROGRAM myfile.a51 ASSEMBLER PROGRAM myfile.lst myfile.hex Simulator ASEM.EXE WORD TS Controls Emulator 8051 1.00
3
Download Tools Please go to the web site http://bit.kuas.edu.tw/~8051 http://bit.kuas.edu.tw/~8051 and download the files with underlines. Assembler –Download ASEM-51 v1.3 and unzip it into a sub- directory.ASEM-51 v1.3 Simulator –Emulator 8051 V1.0 by TS Controls is a software simulator for 8051.Emulator 8051 V1.0
4
Assembler ASEM-51, by W.W. Heinz, is a free 8051 macro assembler for MS-DOS, Windows and Linux. It is a two-pass macro assembler for the Intel MCS-51 family of microcontrollers. –Issue "ASEM PROG2-1.A51" within DOS box will process the source file "PROG2-1.A51" and generate a output file "PROG2-1.HEX" in Intel-HEX format and a list file "PROG2-1.LST" in plain text. Refer to "ASEM_51.DOC" for detail usage. The example program "DEMO.A51" is very instructive.
5
Demo C:\Documents and Settings\pcs3412>cd.. C:\Documents and Settings>cd.. C:\>cd 8051asm C:\8051asm>ASEM PROG2-1.A51 no errors C:\8051asm>dir 2002/12/31 上午 01:30 81,920 ASEMW.EXE : 2008/09/29 上午 11:40 50 PROG2-1.hex 2008/09/29 上午 11:40 3,460 PROG2-1.lst C:\8051asm>
6
PROG2-1.A51 ORG 0H ;start (origin) at location 0 MOV R5,#25H ;load 25H into R5 MOV R7,#34H ;load 34H into R7 MOV A,#0 ;load 0 into A ADD A,R5 ;add contents of R5 to A ;now A = A + R5 ADD A,R7 ;add contents of R7 to A ;now A = A + R7 ADD A,#12H ;add to A value 12H ;now A = A + 12H HERE:SJMP HERE ;stay in this loop END ;end of asm source file
7
Part of PROG2-1.LST Line I Addr Code Source 1: N 0000 ORG 0H ;start (origin) at location 0 2: 00007D 25 MOV R5,#25H ;load 25H into R5 3: 00027F 34 MOV R7,#34H ;load 34H into R7 4: 000474 00 MOV A,#0 ;load 0 into A 5: 00062D ADD A,R5 ;add contents of R5 to A 6: ;now A = A + R5 7: 00072F ADD A,R7 ;add contents of R7 to A 8: ;now A = A + R7 9: 000824 12 ADD A,#12H ;add to A value 12H 10: ;now A = A + 12H 11: 000A80 FE HERE:SJMP HERE ;stay in this loop 12: END ;end of asm source file
8
PROG2-1.HEX :0C0000007D257F3474002D2F241280FE1B :00000001FF
9
Simulator Emulator 8051 V1.0 by TS Controls is a software simulator for 8051. –Execute Tsce0100.exe –Load PROG2-1.HEX and execute it
10
Load PROG2-1.HEX
11
Registers
12
Program List
13
Step by Step Execution
14
Internal RAM ORG 0H ;start (origin) at location 0 MOV R5,#25H ;load 25H into R5 MOV R7,#34H ;load 34H into R7 MOV A,#0 ;load 0 into A ADD A,R5 ;add contents of R5 to A ;now A = A + R5 ADD A,R7 ;add contents of R7 to A ;now A = A + R7 ADD A,#12H ;add to A value 12H ;now A = A + 12H HERE:SJMP HERE ;stay in this loop END ;end of asm source file
15
Stop The Program
16
C Compiler Small Device C Compiler –SDCC - Small Device C Compiler is a free C compiler for 8051, although library is incomplete. –Download sdcc-2.3.0-i586-mingw32msvc.zip and unzip it to "c:\" with directory structure preserved. –Add "c:\sdcc\bin" to DOS search path. –Issue "sdcc --code-loc 0x4000 --xram-loc 0x8000 Ex7-1.c" within DOS box will generate “Ex7-1.ihx" in Intel-HEX format, "--code-loc 0x4000" is used to specify starting code address. "--xram-loc 0x8000" is used to specify starting address of external data memory. –Refer to "c:\sdcc\share\doc\sdcc\sdccman.pdf" for SDCC Compiler User Guide.
17
Ex7-1.c #include void main(void) { unsigned char z; for (z=0; z<=255; z++) P1=z; }
18
Compiler Ex7-1.c
19
Ex7-1.ihx :0440000002405032F8 :01400B003282 :01401300327A :01401B003272 :01402300326A :01402B003262 :0D40500075810712404CE582600302403389 :03405D00024033EB :0540330012403880FE80 :024038007A000C :0C403A008A037C00C374FF9BE49C4005DB :054046008A900A80EFE2 :01404B002252 :03404C007582007A :01404F00224E :00000001FF
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.