Difference between revisions of "MiniMexleIO"

From RoboWiki
Jump to: navigation, search
m
 
Line 5: Line 5:
 
from the whole schematics
 
from the whole schematics
  
[[Image:Example.jpg]]
+
[[Image:MiniMexleIO.png]]
  
 
And here is a short C-code for controlling them:
 
And here is a short C-code for controlling them:

Revision as of 11:13, 5 November 2008

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

MiniMexleIO.png

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.