BASCOM
Code:
$regfile = "m32def.dat"
$crystal = 16000000
Config Porta = Output
Config Portc = Output
Do
Portc = &B00000000
Porta = &B00000001
Waitms 100
Porta = &B00000010
Waitms 100
Porta = &B00000100
Waitms 100
Porta = &B00001000
Waitms 100
Porta = &B00010000
Waitms 100
Porta = &B00100000
Waitms 100
Porta = &B01000000
Waitms 100
Porta = &B10000000
Waitms 100
Porta = &B00000000
Portc = &B10000000
Waitms 100
Loop
C
Code:
#include <avr/io.h> // (1)
#ifndef F_CPU
#warning "F_CPU war noch nicht definiert, wird nun mit 16000000 definiert"
# define F_CPU 16000000UL
#endif
#include <util/delay.h>
int main (void) { // (2)
DDRB = 0x00;
//PORTB = 0xff;
DDRA = 0xff;
// (3)
//PORTA = 0xff; // (4)
PORTA = 0x00;
//PORTA = (1 << PA7);
while(1) { // (5a)
/* "leere" Schleife*/ // (5b)
PORTA |= (1<<PA0) | (1<<PA7);
_delay_ms(100);
PORTA = 0x00;
_delay_ms(100);
} // (5c)
/* wird nie erreicht */
return 0; // (6)
}
Sollte eigentlich stimmen. Also noch jemand ne idee?
Lesezeichen