08.EMBEDDED PROGRAMMING

Mar 16, 2016

This week's assignment are reading a microcontroller data sheet, and programming my board to do something, with as many different programming languages.

08-1.Setting up

First, set up the board that I made in week 6.

[Tool]
Software: CotEditor / Arduino
Components: FabISP (that I made in week4.) / Mini USB Cable / FTDI Cable / 6 Wire Ribbon Cable with Sockets ...And my original board!
[Data]
- hello.ftdi.44.echo.c
- hello.ftdi.44.echo.c.make
[Proccess]
1.Coloring the board
I don't have enough experience of programming, so this assignment is too hard for me...
And It is difficult to understand which components are connected.
Therefore I colored the board! It's so cute and easy to understand for me:)

2.Create the folder
Put hello.ftdi.44.echo.c and hello.ftdi.44.echo.c.makeinto the folder of "hello echo".

3.Writing the program
I followed this png file to program my board.
---
- $ make -f hello.ftdi.44.echo.c.make
- $ sudo make -f hello.ftdi.44.echo.c.make program-usbtiny-fuses
- $ sudo make -f hello.ftdi.44.echo.c.make program-usbtiny
---

But, the following commands failed. It seem to be uncongenial to MacOX Yosemite.
---
$ python term.py /dev/tty.usbserial-FTHBRG3N 115200
---
So, I used Arduino.

4.Check the board with Arduino
"Serial port" > "/dev/tty.usbserial-FTHBRG3N"
I did it!

08-2.Programming the board to do 'something'

1.Learning about the ATTINY44A
First, Learned about the ATTINY44A.
ATTINY44A is a low-power CMOS 8-bit microcontroller based on the AVR enhanced RISC architecture. And there are 14 pins on this chip.
Because I have not been able to understand, I'm going to learn about that from now on.
2.Programming
I edited Neil's program so that the board’s led will flash when it receives one character. And I used Yumi Nishihara's archive below as reference.
The following is what I changed and added in Neil’s program. ( Full data > hello.44.led.c )
---
- How long the led will blink

#define led_delay()_delay_ms(100)

---
- Setting the ports

#define led_port PORTA
#define led_direction DDRA
#define led_pin (1 << PA2)

---
- Blinking function of the LED

void blink() {
static int i;
i = 0;
 while(i < 10) { 
   set(led_port, led_pin);
   led_delay();
   clear(led_port, led_pin);
   led_delay();
   i++;
	}
 }
 
 
---
- Blinking function of LED and Reading of characters

   index = 0;
   while (1) {
      get_char(&serial_pins, serial_pin_in, &chr);
buffer[index++] = chr;
if (chr =='t')
{
     put_string(&serial_port, serial_pin_out, "Traffic cone!");
         index = 0;
         blink();
      put_char(&serial_port, serial_pin_out, 10); // new line
      }
else
{
put_string(&serial_port, serial_pin_out, "hmm...");
index = 0;
put_string(&serial_port, serial_pin_out, buffer);
put_string(&serial_port, serial_pin_out, "? (  )raffic cone?");
 put_char(&serial_port, serial_pin_out, 10); // new line
}
}
}

3.Running

@fablabsendai -


I attached the cover of the form of "the traffic cone" to LED!
Traffic cone's data > trafficcone.stl
(I was lost a traffic cone's Rhinoceros data...;( )