Thursday 23 August 2012

Testing IO of Micro

This is a simple test to confirm all the pins are functioning as intended on your micro.  This is for a 32 channel device and using a 32 channel logic analyser (LogicPort).


#include <avr/io.h>
#include <stdint.h>
#include <avr/delay.h>
#include "global.h"

int main(void)
{
DDRA = DDRB = DDRC = DDRD = 0xFF;
    while(1)
    {
        int i;
for (i=0; i<8; i++){
PORTA = PORTB = PORTC = PORTD |= (1<<i);
_delay_ms(50);
PORTA = PORTB = PORTC = PORTD = 0;
}
    }
}


No comments:

Post a Comment