MiniMexleIO

From RoboWiki
Revision as of 12:52, 28 January 2008 by Balogh (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

The usual "Hello, World!" program in the area of the single chip microcontrollers is to connect a pushbutton and LED and to control them.

We already have the pushbutton and the LED on the MiniMexle board, so here is an excerpt from the whole schematics

Example.jpg

And here is a short C-code for controlling them:

#include <avr\io.h>

int main()
{
  while (1) {
  
  if (PORTA&&0x0F) then 
     PORTD = 0x01;
  else 
     PORTD = 0x01;

  }

}


Task:

The task is to control the on and off state of the LED with a single button. First press of the button will set LED on, second press off. Hint: You will need a memory to store the actual LED state to change it.