Fab Academy 2014

Module 09 – Embedded Programming

Class

Class Outline

Now that we've stuffed a couple af boards without really knowing what to do with them, now comes the time to load them with grey matter: a program that does something....

The Assignment

  • Read a microcontroller data sheet
  • Program your board to do something,
    • (with as many different programming languages and programming environments as possible.)

Read...

Well hmmm... you read it then we discuss it...

The data sheet

Each sentence, needs its digestion time. By the time I read the first 10 pages, I was wondering wether I'd get a call from GOOGLE asking me to stop harrassing them with all my queries. A lot of learning but still many pages to go...

Program your board to do something


The quickest to get started is to use the Arduino "framework"...

My first program

Couldn't think of anything interesting I could do with just a button and a LED, so I thought I'd exploit the two extra free ports on the ATMEL to do something different; but before that lets do a little bit of programming with the LED and button.

My "blink" code:

[ download BLINK CODE file: "MultiState_LED.ino" ]

I'm fairly satisfied with the result, but I have an issue with the detection of the button release with the later case where the delay is pretty long. In order to make sure the programm has figured out I wanted to move on to the next trick, I need to keep the button pressed for a long delay.

I suppose this could be solved by changing my ccode structure and using interrupts, but I need to learn how to do that first.

Attempting to drive a stepper motor with only two outputs - [The schematic]

The 2 to 4 required four AND gates so I found the chip reference for 7408 and went to buy it thinking it would be readily available, but the electronics store in Barcelona did not have it in stock (at least not in SMD). I had to order it, but by the time they called me to tell me it had arrived I had moved in to the next project. As a result, I haven't tested if my schematic works or not yet... Hopefully will have time to solder the board before the end of term.

Some results

The proper thing would be to show a video of the programm running but it's wouldn't be overly exciting to watch. It works, you have to trust me, I have had some issues with the button realese detection as explained above...

That's all Folks.