First experiments with AVR (AtTiny2313)
[mirrors/Programs.git] / avr / blink / helloworld2.c
CommitLineData
1375f65d
H
1#include <avr/io.h>
2#include <util/delay.h>
3
4//#include <compat/deprecated.h>
5/*
6variable = PINx; // Read a byte from a port, replace x with the port number
7PORTx = variable; //Write a byte to a port
8PORTx |= 1<<pin_number; // Set a pin in a port
9PORTx &= ~(1<<pin_number); // Clear a pin in a port
10*/
11
12void delay(unsigned int ms) {
13 unsigned int i,j;
14 for ( j=0; j<1000; j++)
15 for ( i=0; i<ms; i++);
16}
17
18int main (void){
19
20 //sbi(DDRD,PD5); /*enable port 5 for output*/
21 DDRD |= 1<<5;
22
23 while (1) {
24 //cbi (PORTD, PD5);
25 PORTD &= ~(1<<5);
26 delay (500);
27 //sbi (PORTD, PD5);
28 PORTD |= 1<<5;
29 delay (500);
30 }
31
32 return 0;
33}
This page took 0.096828 seconds and 4 git commands to generate.