Simulators and Emulators
Emulators are the interface circuits to test the functionality of some system such as microcontrollers and DSP processors using some software/program at computer to generate inputs and test some of the outputs generated by the actual system. Emulators are useful when some program is to be tested before burning it onto the hardware such as EPROM or EEPROM. They may be used as training kits for beginners also.
As an example, consider the problem that someone programs the microcontroller to perform some task, but when microcontroller executes the program there are some undesirable results due to some error in the program or low performance of the hardware attached (which can’t be tested in some type of simulation). As a result the user has to change the program and burn it once again. In some complex system problem may occur a number of times and it require to burn the program a number of times, as a result there is not only the wastage of time but resources also.
HEX files are generated on PC using some assembler or higher level language compiler such as C-51 then opcode is loaded in the RAM through parallel port. Microcontroller may use this RAM as code memory (EPROM). As the microcontroller executes the program, results could be analyzed using some software and interface circuitry between microcontroller and PC.
Generic design of Emulator for Microcontroller
The generic design of emulator for microcontroller is based on communication with computer using parallel port. The Hardware section consists of implementation of blocks shown in figure below. (PC to RAM interface). To design and implement this interface study of Parallel port and RAM is necessary.
Generic design of Emulator for Microcontroller
PC
|
Normal Problems While Using Parallel Port
Although there may be as many problems as users but here I am discussing few problems faced by me while using the parallel port for interfacing.
(i) Operating System
Although it is very easy to access the parallel using built in functions (outport(…. ) and inport(….))of C and C++ yet all the operating system do not allow the access to parallel port directly. There are methods to access parallel port but parallel and serial port is not accessible using C or C++ functions while working in the windows NT based operating systems such as windows2000, windows XP etc.
(ii) Enabling in RD/WR mode
Parallel port is enabled in write mode by default and there is no problem in the use of parallel port while sending data out. Results are unexpected when a data byte is read from parallel port without enabling it in read mode. Bit-5 of control register is used to enable read or write mode of parallel port. To understand this see figure below.
Read or Write Mode of PC Parallel Port, Bi-Directional Interface |
From the above diagram it is clear that the
Bit-5 of control register should be cleared while writing data to parallel port
and should be set while reading from parallel port.
SOFTWARE
Software part
of the project can be divided into two parts:
(i)
Reading the useful information
from HEX file
(ii) Writing the data on RAM using parallel port
OBJECTIVES
Main objectives of this project are the following:
- Understanding of HEX file format
- The parallel port interface with external devices.
- Develop a
software to shift the opcode from HEX file to external RAM.
- Design and
implementation of interface circuit between RAM and PC.
- Interfacing of
microcontroller with RAM.
No comments:
Post a Comment
Please ask if you have any question regarding the programming of MCU, or have any problem in development of your electronics project. microcontroller51.blogspot.com