Week08

Introduction to this week

  • * Try to read datasheet of microcontroller.
  • * Program to the board.

    1. Datasheet reading

    For datasheet learning, I have gone through the whole documentation of ATtiny44A. Have understood how to control the microcontroller by changing the value of different registers. For example if you want to control a IO port to output an signal, there are to steps to be done, firstly setting the direction (input or output) of the IO port, and set the IO output high or low. avatar This pic shows some registers relative to port pin configurations.

    Also, there are some other issues are important:
  • PWM
  • ADC
  • DAC
  • Interrupt
  • Timer
  • Embedded Programming

    Here on my board, I have 2 buttoms and 2 LEDs placed. I thinking that I can try to program a tiny game--Memory Competition. avatar

    First try: Lighting on

    The LED ports should be changed according to schematic diagram. Here on my board is PA1 and PA0. And in order to make it easier for following programming. I defined some useful instructions. avatar

    Uploading

    To upload the code into MCU, we use GCC tool chain to generate hex file.

    Button test

    Test 2 buttons, the source file link.

    Button Game

    The source file link.
    The LEDs lighted on with some ramdon order. You have to memorize the order, and press the button with the right sequence. Onece you got one button wrongly pressed, game over! If you passed, times of LEDs flash increased. avatar