Arduino Teaches Old Coder New Tricks

Because some of the components I was using do not exist in the built-in library, I scoured the Internet for contributed symbols, and in a few cases, I had to design my own symbols. A good source for contributed symbols and footprints is http://gedasymbols.org. For creating your own symbols, see David Weber's Online Symbol Creation Tool at http://EmbeddedToolBox.com. Symbols actually are text files. Figure 3 illustrates a symbol along with a portion of the text file used to draw it. Symbol files are not just an image. They also hold important pin definitions and the name of the footprint file that the gEDA PCB program ultimately will use to represent the component on the circuit board.

Figure 3. Symbol Example 1

A gEDA schematic is a text file interpreted for GUI presentation by gschem, but it also serves as the source for gEDA's PCB program. An intermediary helper program named gsch2pcb is used to prepare the schematic file for use as input to the PCB program. While xgsch2pcb is a GUI version of gsch2pcb for gsch2pcb, I use the gsch2pcb command-line version. For example, given the schematic file vt100lcd84.sch as an input, gsch2pcb creates vt100lcd84.pcb, vt100lcd84.net and vt100lcd84.cmd, all necessary files for PCB creation. gsch2pcb also displays important instructions as part of its command-line text output. To make the process a little easier, I use a file named "project" in the project folder for the current design. Figure 4 shows my project folder for the vt100lcd84 project, the "project" file and the command line with the gsch2pcb command just before execution.

Figure 4. Example of gsch2pcb Project File

It is worth noting that the gEDA suite includes circuit simulation capability (SPICE), enabling virtual design testing. I did not use SPICE with my VT100-LCD project, but see the Resources for this article if you are interested.

Software Design

Now that I had the circuitry designed for the project, it was time for the software. I wrote the software as a simple state machine that parses each character received on a character-by-character basis, meaning that there is no buffer. Characters are handled differently based upon the current state of the machine. If the state is NOTSPECIAL, the character simply is passed to the LCD screen for display. However, if the state is GOTESCAPE, GOTBRACKET or INNUM, the character is processed further. For example, if the state is GOTBRACKET, both an escape and left-bracket character have been received previously, and the current character must be parsed in that context. For illustration, the VT100 sequence for Screen-Clear is \033[2J, and if the current character being parsed was the 2, the state would be GOTBRACKET, and the next state would be INNUM (number collection).

This method of parsing has the advantage of simplicity, which is suitable for the limited-capacity microcontrollers but with the disadvantage of not being able to scroll the screen due to the absence of a buffer holding a copy what is on the screen. See Resources for a copy of the software source. I used Arduino libraries to build the code. Although the source can be compiled using the Arduino IDE, I used Linux make. Using the Arduino libraries makes the project extremely easy to build. Most of the drudgery of low-level code and the bootloader is hidden away within the Arduino libraries, which freed me to focus solely on my project. Even main() is hidden away such that Arduino code contains two required routines: setup() and loop(). Main actually does exist deep in the Arduino directory structure in ~/arduino/arduino-1.0/hardware/arduino/cores/arduino/main.cpp and is automatically linked in at compile time.

______________________

Edward Comer is retired from the telecommunications industry, having worked for the real AT&T, BellSouth and Numerex Corp during a 30-year career.

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

medical assistant

sajukhann0n's picture

Medical Assistant programs and medical assistant classes are now online at St. Augustine School of Medical Assistants.

Now offers a nationally accredited and certified medical assistant program online.

St. Augustine School of Medical Assistants is a provider of online medical assistant programs and medical assistant courses.

Thank you for teaching us

Jasa kontes's picture

Thank you for teaching us this trick. This trick is very useful.
Jasa SEO

You stirred my curiosity

Hosting Dude's picture

You really did. Never been interested in playing with hardware stuff. Been a web developer for years, never looked into hardware programming and Arduino and stuff like this. Now I want to learn it lol

Good writeup on this, keep up the good work mate

Cheers,
Hosting Dude

I want to learn Arduino

tempo's picture

I want to learn Arduino projects. maybe by reading this article can help me. tempo

medical assistant job

Anonymous's picture

Check out: medical assistant

Anonymous's picture

Thanks for share this

terbaru's picture

Thanks for share this article. I think Arduino projects is amazing. berita Indonesia

Nice one

RUSH PCB UK's picture

Thanks for sharing your ideas and thoughts, i like your blog and bookmark this blog for further use thanks again…

It didn't take very long to

Anonymous's picture

It didn't take very long to remove the mental cobwebs and get into the elegant simplicity of the Arduino Project. Years ago, when I built microprocessor projects, the underlying system code always was the problem. Before I actually could write my application, I had to develop or adapt systems-level code to interface the application-level code with the underlying hardware. Cleaners London

hello

samatha0045's picture

I discovered your blog so far ... much information to improve our space! So thank you and have a nice day!
voyance en direct

The link to the source code

Anonymous's picture

The link to the source code and design schematics just refers to the google code homepage :)

Nice!

Karl A.'s picture

What a great article!
Are you familiar with Instructables.com? They have many Arduino projects. I think this would be a great submission.

White Paper
Linux Management with Red Hat Satellite: Measuring Business Impact and ROI

Linux has become a key foundation for supporting today's rapidly growing IT environments. Linux is being used to deploy business applications and databases, trading on its reputation as a low-cost operating environment. For many IT organizations, Linux is a mainstay for deploying Web servers and has evolved from handling basic file, print, and utility workloads to running mission-critical applications and databases, physically, virtually, and in the cloud. As Linux grows in importance in terms of value to the business, managing Linux environments to high standards of service quality — availability, security, and performance — becomes an essential requirement for business success.

Learn More

Sponsored by Red Hat

White Paper
Private PaaS for the Agile Enterprise

If you already use virtualized infrastructure, you are well on your way to leveraging the power of the cloud. Virtualization offers the promise of limitless resources, but how do you manage that scalability when your DevOps team doesn’t scale? In today’s hypercompetitive markets, fast results can make a difference between leading the pack vs. obsolescence. Organizations need more benefits from cloud computing than just raw resources. They need agility, flexibility, convenience, ROI, and control.

Stackato private Platform-as-a-Service technology from ActiveState extends your private cloud infrastructure by creating a private PaaS to provide on-demand availability, flexibility, control, and ultimately, faster time-to-market for your enterprise.

Learn More

Sponsored by ActiveState