Skip to content
Snippets Groups Projects
Commit a8dffcec authored by Peter Gerwinski's avatar Peter Gerwinski
Browse files

Beispielprogramme und Tafelbild 4.12.2017

parent b4302f2c
Branches
Tags
No related merge requests found
#include <avr/io.h>
#define F_CPU 16000000
#include <util/delay.h>
int main (void)
{
DDRD = 0x01; /* 00000001 */
PORTD = 0x03; /* 00000011 */
while (1)
{
while ((PIND & 0x02) == 0)
; /* just wait */
PORTD ^= 0x01;
_delay_ms (200);
}
return 0;
}
#include <avr/io.h>
#define F_CPU 16000000
#include <util/delay.h>
int main (void)
{
DDRD = 0x01; /* 00000001 */
PORTD = 0x03; /* 00000011 */
while (1)
; /* just wait */
return 0;
}
#include <avr/io.h>
#define F_CPU 16000000
#include <util/delay.h>
int main (void)
{
DDRD = 0x01; /* 00000001 */
PORTD = 0x03; /* 00000011 */
while (1)
{
_delay_ms (500);
PORTD ^= 0x02;
}
return 0;
}
#include <avr/io.h>
#include <avr/interrupt.h>
#include <stdint.h>
ISR (TIMER0_COMPB_vect)
{
static uint8_t counter = 0;
if (counter++ == 0)
PORTD ^= 0x40;
}
int main (void)
{
cli ();
TCCR0B = (1 << CS01) | (1 << CS00); /* Takt durch 64 dividieren */
TIMSK0 = 1 << OCIE0B; /* Interrupt einschalten */
sei ();
DDRD = 0xfd; /* binär: 1111 1101 */
PORTD = 0x40; /* binär: 0100 0000 */
cli ();
while (1);
return 0;
}
20171204/photo-20171204-170812.jpg

126 KiB

README: Pull-Down- und Pull-Up-Widerstände
echo avrdude -P /dev/ttyACM0 -c arduino -p m328p -U flash:w:$(ls -rt *.hex | tail -1) port=$(ls -rt /dev/ttyACM* | tail -1)
avrdude -P /dev/ttyACM0 -c arduino -p m328p -U flash:w:$(ls -rt *.hex | tail -1) 2>/dev/null echo avrdude -P $port -c arduino -p m328p -U flash:w:$(ls -rt *.hex | tail -1)
avrdude -P $port -c arduino -p m328p -U flash:w:$(ls -rt *.hex | tail -1) 2>/dev/null
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment