CURRENT ISSUE Contests
Feature Article
|
|
Issue #212 March 2008
Robotics with Ada95
by Daniel Ramirez
Start | Why Use Ada95 For Robotics? | GNAT Ada95 Tools | Debugging Ada95 Applications | Ada95 Coding Style |Wireless Sensor Controller | Wireless Messages | The Glove In Action | XYZ Accelerometers | XBee-PRO Wireless UART | Controller Range | USB 2.0 Interface | Ethernet | The Kernel | Ada95 vs. Other Languages | Future Applications | Sources & PDF
Ada95 CODING STYLE
If you look at C/C++ code and the corresponding Ada95 code, you may notice that Ada95 is more readable. This is due to the extra effort the language designers took to make Ada95 easy to maintain. It is self-documenting and bears some resemblance to Pascal. If you remember the Pascal language, you will see some similarities in the keywords.
Listing 1 shows an example of how to communicate between an Ada95 application and a remote robot at 115,200 bps, 8 data bits, and 1 stop bit. The SCI interface on the robot’s microcontroller is usually labeled UART0, UART1, SCI0, or SCI1. The exception handler in Listing 1 provides error handling for any runtime exceptions that occur in the routine while using the serial port.