Programming the Atmel ATMEGA324A with Atmel Studio


I just completed a project working with:

  • 8-bit Atmel microcontroller ATMEGA324A
  • AVRISP mkII Programmer
  • IO board
  • 324 Dev board
  • Atmel Studio
dev board and IO board wired up with the LED matrix
dev board and IO board wired up with the LED matrix
ATMEL 324 dev board
324 dev board with ATMEGA324A microcontroller

Interfaces used were: Output:

  1. I/O Board LED (8 available)
  2. PC Terminal – standard screen output
  3. LED matrix – 8 rows by 16 columns (4 pins)
  4. I/O Board – seven segment display (7 pins + CC digit select)
  5. Buzzer – (1 pin OC1A)

Input:

  1. PC Terminal – keyboard
  2. Joystick (2 ADC pins)
  3. I/O Board – buttons and switches (8 available each)

The project involved creating a simple game program making use of all of the elements above. I ran into a couple of issues:

  • Ran into stack space overflow issues/sometimes causing restarts. Have to avoid large function variables. This was difficult to isolate as the system just failed to work correctly without providing any other indication of what the cause was.
  • The EEPROM is auto-erased whenever a new program is uploaded.
  • The LED matrix does not seem to work when the programmer is not connected to PC perhaps supplying additional power.
  • The led matrix will report error right after an upload. And may behave strangely during first few seconds but eventually normalizes.
  • The arrangement of the pins on the Joystick is workable but a bit odd. It could have been better arranged so that they can sit squarely on a breadboard power rail but it is not so. The actual pin arrangement:

    PIN0 PIN4
VCC PIN1 PIN5
GND

  X PIN2 PIN6 Y
    PIN3 PIN7

Other notes:

  • The seven segment display has a CC digit select PIN
  • There buzzer is driven using the OC1A timer PIN
  • The ATMEGA324A is sitting on the 324 dev board.
  • Putty can be used for terminal I/O. serialcomm at 19200 baud 8N1 (8 bits No parity 1 Stop).
Advertisements