South Downs Railway

Modern Image, Computer Controlled

Author login

Phoca Gallery Tree Module

I've used Atmel 8 bit microcontrollers a lot for my model railway products. I always used them soldered to a PCB of my design, and used a third party paid-for C compiler. The whole worked well, but did cost some money to get off the ground.

For my own non commercial use, what should I use? I wasn't going to pay for a compiler again. I have always ben aware of the Arduino family of products, but I'd never used one. So faced with a task that either needed a compiler or a different approach, I decided to give Arduino a try. And I haven't looked back.

The software is free and open source, you download a simple Integrated Design Environment with editor, compiler and downloader to the target system all on one package. It is much more streamlined that I was used to. The only element missing is a simulator - the debug approach is to embed "printf" statements in the code, run it on the target hardware and see them in a terminal window. Software libraries for many purposes are widely available.

The hardware is readily available in the high street in UK. Several boards are available with  a microcontroller, USB interface and connectors to I/O pins; then you can get a variety of "shields" that plug onto the top. These can have hardware for specific functions (eg motor control) or can be for prototyping; I've used the latter type. 

I'm on about my fourth project now. The new one uses an Arduino "Due" which is a 32 bit processor, has a lot of memory available and runs around 5 times faster. The performance is there for any likely embedded project I will tackle. 

The software structure is designed to be easy to learn and use. You put all of your setup code into a single setup function, and the remainder into a single function called "loop". You can of course call other functions from both, to split it up. The "loop" code runs to the end, then goes back to the beginning, forever. That's find for some code but not for real-time applications with several "threads" (as my code often is). But you can get back to what I'm used to by having a timer "tick" interrupt, and only allowing loop() to re-start every tick. That way you know exactly how often the code is executed.

 

VCNT - Visitorcounter

Today 1

Yesterday 33

Week 170

Month 786

All 51472

Currently are 15 guests and no members online

Kubik-Rubik Joomla! Extensions

Using this Site

Searching

The web site can be searched: type a search term (e.g. "DAC10") into the search box on the right hand side of the header, and hit enter. the search engine will find words matching the search string in the main body of the site, but it won't search attached documents (e.g. the product manuals).

"Read More"

Many articles are displayed one after the other. some are quite short, and say "read more" at the bottom. Click that to read the remainder of the article.

Gaugemaster News

Feed not found.