blob: c1f43abc3d2bb8bf537ecf6bfce48d003ab194f0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
#define __AVR_ATmega328P__
#include <avr/io.h>
#define F_CPU 16000000UL
#include <util/delay.h>
typedef enum { false, true } bool;
typedef enum { INSTRUCTION, DATA = 2 } regselect;
typedef enum { WRITE, READ } readwrite;
static void setregrw(regselect reg, readwrite rw){
PORTC = (PORTC & ~3) | reg | rw;
}
#define enablepin(val) val ? (PORTC |= 4) : (PORTC &= ~4);
static void wdata(uint8_t data){
DDRD |= 0xF0;
enablepin(true);
PORTD = data;
__asm__ ("nop;");
enablepin(false);
}
int main(){
DDRC = 0x07;
DDRD = 0x08;
//PORTD = 0x08;
_delay_ms(10000);
return 0;
}
|