Week 8 - Embedded Programming

Tasks:
To program week 6 Hello board to do something.

 

What function can the board perform?
The board has a LED and a push-button. Thus, the function it can perform is not many, for example push the button to turn on/off LED, the LED is turned on/off as long as the button is press-hold, display responds/communicate with monitor when the LED and push-button are activated, etc.

Recalled the schematic done in week 6, the push-button was wired to a pull-up resistor. Which means input pin (indicated as 'sw') would read high when the button was not pressed, i.e. Vcc. When the button was pressed, ground ('GND') would be connected. The pins coding were 'PA7' and 'PA3' for 'LED' and 'Push-button' respectively.

 

ATTiny44A Datasheet

The micro-controller used in this task is Atmel ATtiny44A. The datasheet can be obtained from the following.

  • ATtiny24A/44A/84A - Atmel

  • The following shows the pin configurations of the micro-controller and important parameter to note.

    Key Parameters to take note.

  • Pin Count: 14
  • Max. Operating Freq. (MHz): 20 MHz
  • Max I/O Pins: 12
  • TWI (I2C): 1
  • Self Program Memory: Yes
  • External Bus Interface: 0
  • Temp. Range (deg C): -40 to 85
  • Operating Voltage (Vcc): 1.8 to 5.5
  • Timers: 2
  • PWM Channels: 4
  • Characteristics of the ATtiny44A:

  • The chip has 14 pins.
  • Vcc for voltage supply and GND for ground.
  • PB3:PB0 is a 4-bit bi-directional I/O port with internal pull-up resistors./li>
  • RESET (PB3); If given low level to this pin for longer than the minimum pulse length, it will generate a reset.
  • PA7:PA0 is a 8-bit bi-directional I/O port with internal pull-up resistors. These pins have alternate functions as analog inputs for the ADC, analog comparator, timer/counter, SPI and pin change interrupt.
  • CPU(Central Processing Unit) will ensure correct program execution by accessing memories, performing calculations, controlling peripherals, and handling interrupts.
  • There are three types of memory.
  • ATtiny44A features successive approximation Analog-to-Digital Converter (ADC). It generates a 10-bit result which is presented in the ADC Data Registers, ADCH and ADCL. ADCL presents only the low byte of the ADC conversion result and ADCH presents only the high byte. ADCL is read first, then ADCH. When ADCH is read, ADC access to the ADCH and ADCL Registers is re-enabled and a new result is provided.
  •  

    This task will use Arduino UNO as ISP. Arduino IDE was used due to the easy-to-use UI feature for beginner (like me) who is not familiar with command line like avrdude, gcc, ... The user will just need to compile and upload the file. Thus, faster, easier and less demanding on user side. Anyway, the following shows the step-by-step using Arduino IDE.