單片機外文翻譯--8051微控制器的字節(jié)碼解釋器(英文)_第1頁
已閱讀1頁,還剩4頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領

文檔簡介

1、 ? Abstract— This paper proposes a design of byte code interpreter for 8051 microcontroller. We developed a program based on Java language “write once, run everywhere”. It can be employed to operate with another sy

2、stem since the program interfaces directly to the interpreter, instead of the real system. There are two instruction sets provided in the program. The first is condition commands such as IF and ELSE. The second is

3、 the commands for peripheral interfacing such as I2C, RS232 interface, for parallel port, timer and LCD interface. Interpreter is developed with C language, due to its simple structure. It is easy to develop and to

4、modify the code. From the results, condition commands and no condition commands can be execute correctly. Index Terms— Byte code, Interpreter, Byte code. I. INTRODUCTION To use microcontroller, user has to understand

5、 its architecture and language. Microcontroller of each family has its own architecture and instruction sets. For example PIC family is RISC and 8051 family is CISC. When user wants to change microcontroller to th

6、e other, user has to develop the new program to support new microcontroller. It is waste of time because user has to study architecture and instruction sets of new microcontroller as well. Interpreter for microcon

7、troller may be the alternative way to solve the problem. When user wants to change the new microcontroller, user only installs interpreter to new microcontroller but do not write the new program. Example for byte co

8、de is Java language. The Java as introduced by Sun Microsystems [1] in 1994 has spread throughout the computer industry and has reached all domains. As good as Java is for providing “write once, run everywhere” sof

9、tware. In figure 1, programmer writes Java program. Java compiler will compile Java program to Java byte code. To use Java program, user has to install Java virtual Machine [2] to operating system target. In case

10、user wants to change to new operating system, users just installs Java virtual Machine and Java program can be ran as normal. For this case Java virtual Machine is interpreter of Java system. Manuscript received Dec

11、ember 27, 2009. N. Jeenjun is a graduate student in Master Degree in the Faculty of Engineering at King Mongkut’s Institute of Technology, Ladkrabang, Bangkok Thailand. S. Khuntaweetep is now with the Department of

12、Electronics, Faculty of Engineering at King Mongkut’s Institute of Technology, Ladkrabang, Bangkok Thailand (e-mail: kksuchar@kmitl.ac.th). S. Somkuarnpanit is with the Department of Electronics, Faculty of Engineeri

13、ng at King Mongkut’s Institute of Technology, Ladkrabang, Bangkok Thailand (e-mail: kssuripo@kmitl.ac.th). Figure 1. Java operation The favorite toy in the world, Lego mind storm [3]. It has H8 microcontroller with L

14、ego interpreter inside. User interface is based on graphic block. It is easy for beginner even children can develop their own applications. For the other examples of interpreter are MetaCricket [4] developed by MIT

15、, GOGO BOARD [5], BasicStamp by Parallax Inc. [6], picoJava-I [7] picoJava-II [8] by Sun Microsystems, An Embedded Java Virtual Machine [9][10], The Byte code Firmware Design for Microcontroller Device [11]. II. SYS

16、TEM COMPARISON Standard Microcontroller (MCU) language design is depicted in figure 2, user writes assembly program to target MCU and compiles to machine code of each system. In this case, user has to develop 2 progr

17、ams for both 8051 and PIC. Figure 2. Standard MCU In figure 3, user installs byte code interpreter into both 8051 and PIC microcontroller then writes the program with byte code instruction sets. In this case user wri

18、tes the program only 1 time. Figure 3. MCU with byte code interpreter Byte code Interpreter for 8051 Microcontroller N. Jeenjun S. Khuntaweetep and S. Somkuarnpanit Proceedings of the International MultiConference of

19、 Engineers and Computer Scientists 2010 Vol II, IMECS 2010, March 17 - 19, 2010, Hong KongISBN: 978-988-18210-4-1 ISSN: 2078-0958 (Print); ISSN: 2078-0966 (Online) IMECS 2010Figure 10. Example IF/ELSE commands For REP

20、EAT command, interpreter is designed to have 8 levels. Number of repeating can be 0-255. Byte code 21H-28H is reserved for REPEAT command. GOTO command, it must have label to go to. Label or address can be 0000H-F

21、FFFH. Byte code 80H is reserved for GOTO command. All of commands will be explained in testing result section. D. Memory allocation Memory allocation is depicted in figure 11, the first 16KB is reserved for interp

22、reter installation and the second is user code area is 16KB Flash or 32KB EEPROM as configuration setting. In this paper, user code area is in 16KB Flash memory. Figure 11. Memory allocation E. Hardware Hardware for

23、 testing the system is ETT-JR51USB [12] below is specification of hardware. ? AT89C5131 MCU with 6 clocks running ? 32KByte Flash and 1Kbyte Sram ? USB cable for downloading program ? 1xUART with maximum 11520 b

24、ps ? 1x I2C port ? 5VDC power supply on board IV. TESTING RESULTS We chose some of byte code examples for testing the interpreter. It consists of I2C, RS232, LCD and Parallel Port with delay time. The first examp

25、le code is depicted in figure 12, the program will produce I2C start signal, write data to I2C with 5AH then produce I2C stop signal. The testing result is depicted in figure 13. Figure 12. Example program#1 The fi

26、rst line 00,00,02,00,4E ? 00,00 : Line address ? 02 : SUM ? 00 : Condition1 (No condition command) ? 4E : Write start I2C signal The second line 00,01,04,00,01,5A,4A ? 00,01 : Line address ? 04 : SUM ? 00

27、: Condition1 (No condition command) ? 01,5A : Push data 5AH to data stack ? 4A : Send data in data stack to I2C The third line 00,02,02,00,4F ? 00,02 : Line address ? 02 : SUM ? 00 : Condition1 (No condition c

28、ommand) ? 4F : Write stop I2C signal Figure 13. I2C Start, Write data and Stop signals The second example is depicted in figure 14. The program receives data from RS232 channel and sends the same data back to host

29、 (Personal computer). Figure 15 shows RS232 signals. The first line 00,00,06,64,00,00,05,00,01 ? 00,00 : Line address ? 06 : SUM ? 64 : Condition1 (Label command) ? 00 : No Condition2 ? 00,05 : Label stack l

30、ocation ? 00,01 : Line address for go to command The second line 00,01,02,00,14 ? 00,01 : Line address ? 02 : SUM ? 00 : Condition1 (No condition command) ? 14 : Read data from RS232 The third line 00,02,02,0

31、0,04,13 ? 00,02 : Line address ? 02 : SUM ? 00 : Condition1 (No condition command) ? 04 : Push RS232 data to data stack ? 13 : Write data from data stack to RS232 The fourth line 00,03,05,65,00,00,05,00 ? 0

32、0,03 : Line address ? 05 : SUM ? 65 : Condition1 (Go to command) ? 00 : No Condition2 ? 00,05 : Reload Label at stack location 05 ? 00 : Reserved for further used Proceedings of the International MultiConferenc

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
  • 4. 未經權益所有人同意不得將文件中的內容挪作商業(yè)或盈利用途。
  • 5. 眾賞文庫僅提供信息存儲空間,僅對用戶上傳內容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
  • 6. 下載文件中如有侵權或不適當內容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論