Professional Documents
Culture Documents
Department of Electrical Engineering, Yuan Ze University, Chung-Li 32003, Taoyuan, Taiwan, ROC
E-MAIL: eeyschen@saturn.yzu.edu.tw
LNMS 3 Node 9
Internet,
.. User WAN
LAN 3
LAN 1
8051
NET-ISP , Node 8
Router 1 Node 4 "
\ Router 3
\ "
\
LNMS 1
LNMS2
Figure 1. Depicting the networking of our proposed 8051 NET -ISP system. A LNMS is added in each LAN and serves as an intermediate connection
bridge between nodes and remote users.
provides user remotely reading, writing, and erasing program see the thick red solid path in Figure 1. While the remote user
memory of the A-MCU (applicable MCU) AT89S51 through is connecting node 9, he/she is actually connecting to LNMS
the Internet. While the node's program needs to be modified, 3. The server will retransmit internet packages from the user
the user can download the program of the A-MCU for to node 9. Contrarily, node 9 will send internet packages to
disassembling. After the program of the A-MCU has been LNMS 3 first instead of directly sending to the remote user
updated, the system will automatically restart to execute the while responding the remote user's request.
new one. It also allows user to remotely control the
applicable circuit if related control functions are written. 3. Hardware Architecture
The remainder sections are organized as follows. It first
introduces the networking of multiple nodes that are The hardware of 8051 NET-ISP is separated into two
distributed in section 2. Then hardware architecture of the parts: embedded TCP/IP Ethernet module and applicable
proposed 8051 NET-ISP is described in section 3. In section 4 controller module, see Figure 2.
general ISP manipulation of AT89S51 including both
Embedded TCP/IP Applicable
hardware and software aspects are introduced. Section 5 Ethernet Module Controller Module
proposes the software architecture inside the 8051 NET-ISP
and remote user interface. Experiments are described in P3.2 E1.J ..
section 6. Finally, conclusions and future extension are given Realtek :1 3 _ - _ Pj ..
in section 7. Ethernet _ P]! E 1.;..5 .. ISP
Ethernet
1639
Proceedings of the 2012 International Conference on Machine Learning and Cybernetics, Xian, 15-17 J uly, 2012
communication ability, respectively. The Ethernet controller 4. In-System Programming Using AT89S51
takes charge of receiving and transmitting Ethernet packages,
and the E-MCV with its program is used to implement 4.1. Serial Mode ISP Circuit of AT89S51
embedded TCP/IP stack. As the module is set for first-time
use or need to modify network attributes such as the IP MCV AT89S51 has a 4K bytes in-system programmable
address, MAC address, or connection port, we have to write flash memory and is standard 8051-compatible. It provides
them into the EEPROM and reset the module. After the two ISP programming interfaces: parallel mode and serial
module restarted, the E-MCV will access those network mode [11]. Serial mode is applied in this paper for saving I/O
attributes and write to the Ethernet controller. Then make the of both MCVs. For using its ISP function, basically the
Ethernet controller enter package receiving/transmitting hardware shall be connected as the circuit depicted in Figure
mode [10]. 3. The pin Pl.5IMOSI is used for writing ISP instructions and
After the E-MCV received a TCP package, it then stores data into AT89S51, Pl.6IMISO is used for reading the
the payload in a receiving data buffer. The application layer program memory, and Pl.7/SCK is the clock input during
of the E-MCV will handle with different tasks depends on the each serial ISP input or output bits. And during ISP functions
specific command attached at the beginning of the package's operation (no matter reading, writing, or erasing), RST must
payload. If the command is to operate ISP functions to read, be sustained with high-level voltage input till the operation is
write, or erase program memory of the A-MCV, the E-MCV fmished then RST is pulled down back to low-level voltage
uses its pins from P3.2 to P3.5 to produce ISP control and to let AT89S51 execute program in normal state.
data signal. And if the package is for controlling the + 5V
application circuit, the E-MCV will redirect the remote 89551
control command and send through serial communication Clock in P1 .7/SCK Vee
port (TXD) to the A-MCV so that the A-MCV can handle Data output P1.6/MISO
these control contents. Instruction input P1.5/MOSI
V1H RST
3.2. Applicable Controller Module
.-....-----1
.. XTAL1
33pF
This paper applies an in-system programmable MCV
AT89S51 as the A-MCV so that it is able to remotely update
33pF
the control functions of the application circuit. The pins of '--....---+
.. ---1 XTAL2
the A-MCV from Pl.5 to Pl .7 and RST are used for driving
GND
ISP control signal sent from the E-MCU. The E-MCV will
automatically restart the A-MCV while ISP process is
finished. Furthermore, if the remote user programed the
Figure 3. The serial mode programming interface of ISP circuit of
A-MCV with serial communication functions, then the user is AT89S51. This paper uses the E-MCU to drive ISP control signals, thus
able to tell the A-MCV to control the application circuit in pins Pl.5 to Pl.7 and RST of AT89S51 are connected to the E-MCU as
1640
Proceedings of the 2012 International Conference on Machine Learning and Cybernetics, Xian, 15-17 J uly, 2012
TABLE 1. THE USED ISP INSTRUCTIONS (IN HEXADECIMAL program memory through MISO byte by byte.
REPRESENTATION). BYTE 3 AND 4 OF RM AND WM ARE PROGRAM DATA
For writing program memory, the first byte of WM and
INSTEAD OF THE PART OF THE INSTRUCTION.
the page number are written to MOSI after PE. Then 256
Instruction (Abbr.) Byte I Byte 2 Byte 3 Byte 4 bytes of data can be sequentially given to MOS!. Whenever
the writing data is less than 256 bytes, the rest empty data
Programming Enable (PE) OxAC Ox53 OxOO OxOO
must be padded with OxFF to finish writing totally 256 bytes.
Chip Erase (CE) OxAC Ox80 OxOO OxOO Otherwise malfunction may occur.
Read Program Memory Page
(RM) Ox30
in Page Mode Number 4.5. Always Chip Erase Before Re-Programming
I I I I
clock signal to SCK. At the end of the clock signal, the After writing in B BO A1
N/A N/A N/A
without CE first 256 bytes 256 bytes
A-MCU will prepare for outputting the next bit. . . .
Program Memory Pages of the A-MCU
Serial
Data Input Figure 5. The program fragment Al that left in the program memory
P1.5/MOSI after writing in program B may cause execution error. N/A represents
Serial all data are OxFF, which are not available.
Clock Input
P1. 7/SCK
5. Software Architecture
Serial
Data Output
P1.6/MISO 5.1. 8051 NET-ISP Software
Serial Order o 2 3 4 5 6 7
1641
Proceedings of the 2012 International Conference on Machine Learning and Cybernetics, Xian, 15-17 J uly, 2012
given to application control handler to distinguish the user 5.2. Remote Interface for Remote User
command. The application handler will execute
corresponding task according to the command-task definition This study implements the windows-based remote user
given in TABLE 2. program with Microsoft Visual Basic with .NET framework.
There are two registers stated in Figure 6. The status The internet communication is driven by a Sockets class
register is for saving the operation status after executing WM defined in namespace System.NET.Sockets and uses TCP/IP
and CE instructions. And the data register is for saving the protocol. The LNMS handles remote user's connection
read program or the circuit responses from the A-MCU. The request. Therefore the user can remote programming or
contents of both registers will be sent back to the Embedded control the nodes that are in the same LAN as the LNMS.
TCPIIP handler to compose a TCP package. Thus the remote The hex-code program or control commands are attached to
user can reach the ISP operation status or remote control the payload of TCP package. While downloading program
responses. from a node, the user interface will reconstruct the sent back
Internet data and stores in normal hex-code program format. The
downloaded program can be disassembled with specific
disassembler software so that modification of the program is
possible.
Embedded
TCPIIP
6. Experiments
Handler
1642
Proceedings of the 2012 International Conference on Machine Learning and Cybernetics, Xian, 15-17 J uly, 2012
current Ethernet module, lots of twisted pairs can be removed, [7] W. Goralski, "Chapter 27 - network address translation,"
and therefore the distribution of our node can be wider and Morgan Kaufmann, Boston, pp. 681-696, 2009.
more convenient. [8] Y. Su, J. Yue, and J. Hao, "Application of RTL8019AS
to Ethernet communications node based on single chip
Acknowledgments microcomputer," Proceedings of the IEEE 6th Circuits
and Systems Symposium on Emerging Technologies:
This work was supported in part by the National Science Frontiers of Mobile and Wireless Communication, pp.
Council, Taiwan, Republic of China, under Grant No. 225-227 YoU, 31 May-2 June 2004.
NSC99-2221-E-155-080. [9] T. Wang, C. Gong, et aI., "A design of network remote
control system," Proceedings of the International
References Conference on Consumer Electronics, Communications
and Networks, pp. 3819-3822, 16-18 April 2011.
[1] I. Ahmed, H. Wong, and V. Kapila, "Internet-based [10] "RTL8019AS realtek full-duplex Ethernet controller
remote control using a microcontroller and an embedded with plug and play function (ReaIPNP)," Realtek
Ethernet,". Proceedings of the American Control Semiconductor Corporation, May 10, 2001,
Conference, pp. 1329-1334 vol.2, June 30 2004-July 2 http://www.realtek.com.tw/.
2004. [11] "AT89S51 8-bit microcontroller with 4k bytes in-system
[2] Y. Liu, "Design of the smart home based on embedded programmable flash," ATMEL Corporation, Jun. 2008,
system," Proceedings of the 7th International Conference http://www.atmel.comldevices/at89s51.aspx.
on Computer-Aided Industrial Design and Conceptual [12] "Internetworking with tcp/ip. Principles, protocols, and
Design,.pp. 1-3, 17-19 Nov. 2006. architecture / vol. I," D.E. Comer and D.L. Stevens,
[3] Y. Zhai and X. Cheng, "Design of smart home remote Prentice-Hall, New Jersey, 2000.
monitoring system based on embedded system,"
1643