
Page 56
Access Memory (RAM). As its name implies, ROM cannot be written. It is programmed at the factory and cannot be changed. RAM, on the other hand, can be written and read as many times as
you want, with one catch: it needs power. If you take the batteries out of your RCX, the contents of the RAM are erased. Under normal circumstances, however, the batteries preserve the contents
of the RAM.
When you first get your RCX, it has some stuff in ROM and an empty RAM. The RCX's ROM routines know a little bit about the RCX's hardware. These routines can run the motors or access the
sensors. Most importantly, the ROM routines know how to receive code from the IR port and place it in RAM.
Firmware
One of the first things you have to do with your RCX is download the
firmware.
The firmware is, essentially, an operating system for your RCX. The routines in ROM know how to download a
set of firmware from the IR port and store it in RAM. The firmware is capable of more than just processing the ROM routines. It shows a clock on the display of the RCX. It can recognize an
respond to the
View
button. Most importantly, it can receive robot programs over the IR port and run them.
Although at first it sounds like the firmware and the robot programs are the same kind of animal, this is not the case. The firmware is actual Hitachi H8 machine code. Together with the H8
machine code in ROM, the firmware defines an operating system for the RCX. It provides access to the RCX's inputs and outputs. It also provides a way for programs to be downloaded, stored,
started, and stopped.
The actual robot programs are not H8 machine code. They are defined at a higher level called
bytecode.
Whereas the H8 machine instructions are very rudimentary, such as "move this value to
register 1," bytecode instructions are more powerful, such as "turn output 2 on with full power." The firmware interprets the bytecode and performs the appropriate action.
About Spirit.ocx
On the PC side, a piece of software called
Spirit.ocx
handles interaction with the RCX via the IR link.
Spirit.ocx
can execute bytecode commands on the RCX, download new programs to the
RCX, download firmware to the RCX, and receive data from the RCX.
The RCX Code programming environment sits on top of
Spirit.ocx.
It provides the click-and-drag programming environment that you're already familiar with. RCX Code converts these graphic
programs into bytecode and uses
Spirit.ocx
to download the programs to the RCX.
Spirit.ocx
is a regular ActiveX control, which means its functions are accessible from programming languages like Visual Basic and Visual C++.
Page 57
Spruce Up That Resume
Writing programs for the RCX is an example of
cross-compiling
for an
embedded system,
a
phrase that is bound to sound good on your resume. Cross-compiling means that you are
writing programs on one computer (your PC) that will run on another computer (the RCX).
An embedded system is a computer that is part of some other device. For example,
microwave ovens and mobile phones both contain embedded systems. Modern cars contain
dozens of embedded systems, as well.
The usual way to develop software for a chip like the Hitachi H8 would be to use a cross
compiler running on a PC. You would write source code (probably in C or assembly
language) on your PC and use the cross-compiler to create H8 machine code from the
source. Then you would probably use a special PC peripheral, called a
burner,
to place the
machine code on some sort of programmable memory chip.
The final step would be to physically place the memory chip in the embedded system.
When the embedded system boots up, the software you just wrote will run.
Содержание MINDSTORMS Robots
Страница 22: ...Page 18 The back tread wheels are anchored to the shafts with the 16t gears ...
Страница 23: ...Page 19 Page 20 Next start building support for the drive motors ...
Страница 25: ...Page 22 Attach the motor wires to output A and output C Next build the platform for the front bumpers ...
Страница 26: ...Page 23 The touch sensors are attached only by the shaft that runs through them ...
Страница 41: ...Page 41 ...
Страница 43: ...Next build the support for the light sensor ...
Страница 80: ...Page 85 Make sure the bump on the long pin is up against the 4u beam ...
Страница 82: ......
Страница 84: ...Page 89 ...
Страница 85: ...Step 14 is similar to Step 11 take a deep breath and go slowly ...
Страница 86: ...Page 90 Grabber Arm In Step 17 the half bushings go between the center block and the cams pear shaped pieces ...
Страница 87: ...Page 91 ...
Страница 88: ...Page 92 Make sure that the two sides are at the same angle They should mirror each other ...
Страница 89: ...Page 93 Page 94 ...
Страница 90: ...Structural Support Page 95 ...
Страница 91: ...Idler Wheel Page 96 ...
Страница 92: ...Page 97 Drive Motor ...
Страница 93: ...While you re putting the motor in hold on to the worm gear so it doesn t slip off Page 98 ...
Страница 94: ...Grabber Arm Motor ...
Страница 95: ...Page 99 ...
Страница 96: ...Page 100 RCX Attach the RCX on both sides as shown Page 101 ...
Страница 158: ......
Страница 159: ...Page 175 The 16t gears are nestled inside the tread wheels ...
Страница 160: ...Page 176 ...
Страница 161: ...Page 177 Attach the motors to output A and output C as shown Page 178 ...
Страница 162: ...The light sensor which is mounted on the bumper is attached to input 2 The touch sensor goes on input 1 Page 179 ...