Difference between revisions of "U23 2007/NoComment/schiebe.c"
< U23 2007
m (Link wird schon automagisch angezeigt) |
m (Kommentare) |
||
Line 7: | Line 7: | ||
PORTA = 0x00; | PORTA = 0x00; | ||
− | // Set OE | + | // Set OE @ PORTA3 |
PORTA |= (1 << 3); | PORTA |= (1 << 3); | ||
Line 18: | Line 18: | ||
for (i = 0 ; i < 16 ; i ++) { | for (i = 0 ; i < 16 ; i ++) { | ||
− | // Clock | + | // Clock @ PORTA2 every 2× |
+ | // on->off->on->off->… | ||
if ( i % 2 ) { | if ( i % 2 ) { | ||
PORTA |= (1 << 2 ); | PORTA |= (1 << 2 ); | ||
Line 29: | Line 30: | ||
} | } | ||
− | // Set | + | // Set Strobe @ PORTA0 |
PORTA |= (1 << 0 ) ; | PORTA |= (1 << 0 ) ; | ||
+ | // Delay | ||
for (b = 0; b < 0xffff; b++) { | for (b = 0; b < 0xffff; b++) { | ||
PORTB &= (1 << 1); | PORTB &= (1 << 1); | ||
} | } | ||
+ | // Unset Strobe @ PORTA0 | ||
PORTA &= ~ (1 << 0 ) ; | PORTA &= ~ (1 << 0 ) ; | ||
+ | // Delay | ||
for (a = 0; a < 5; a++) { | for (a = 0; a < 5; a++) { | ||
for (b = 0; b < 0xffff; b++) { | for (b = 0; b < 0xffff; b++) { | ||
Line 52: | Line 56: | ||
*/ | */ | ||
+ | // set Data @ PORTA1 every 4× | ||
if ( ((int) i/2) % 2 ) { | if ( ((int) i/2) % 2 ) { | ||
PORTA |= (1 << 1); | PORTA |= (1 << 1); | ||
Line 59: | Line 64: | ||
− | // Clock | + | // set Clock @ PORTA2 every 2× |
if ( i % 2 ) { | if ( i % 2 ) { | ||
PORTA |= (1 << 2 ); | PORTA |= (1 << 2 ); | ||
Line 66: | Line 71: | ||
} | } | ||
− | + | // Set and unset Strobe @ PORTA0 | |
− | |||
− | // Set and unset Strobe | ||
PORTA |= (1 << 0 ) ; | PORTA |= (1 << 0 ) ; | ||
PORTA &= ~ (1 << 0 ) ; | PORTA &= ~ (1 << 0 ) ; | ||
− | // Set OE | + | // Set OE @ PORTA3 |
PORTA |= (1 << 3); | PORTA |= (1 << 3); | ||
+ | // Delay | ||
for (a = 0; a < 5; a++) { | for (a = 0; a < 5; a++) { | ||
for (b = 0; b < 0xffff; b++) { | for (b = 0; b < 0xffff; b++) { |
Revision as of 20:20, 28 May 2007
#include <avr/io.h> int main(void) { DDRA = 0xFF; PORTA = 0x00; // Set OE @ PORTA3 PORTA |= (1 << 3); uint16_t i; uint16_t a; uint16_t b; for (i = 0 ; i < 16 ; i ++) { // Clock @ PORTA2 every 2× // on->off->on->off->… if ( i % 2 ) { PORTA |= (1 << 2 ); } else { PORTA &= ~ (1 << 2 ); } PORTA &= ~ (1<<2); } // Set Strobe @ PORTA0 PORTA |= (1 << 0 ) ; // Delay for (b = 0; b < 0xffff; b++) { PORTB &= (1 << 1); } // Unset Strobe @ PORTA0 PORTA &= ~ (1 << 0 ) ; // Delay for (a = 0; a < 5; a++) { for (b = 0; b < 0xffff; b++) { /* nix */ } } for ( i = 0; i < 16 ; i ++) { /* // Set Data if ( ((int) (i/2)) >= 2 && ((int) (i/2)) <= 5) { PORTA &= ~ (1 << 1); } else { PORTA |= (1 << 1); } */ // set Data @ PORTA1 every 4× if ( ((int) i/2) % 2 ) { PORTA |= (1 << 1); }else { PORTA &= ~ (1 << 1); } // set Clock @ PORTA2 every 2× if ( i % 2 ) { PORTA |= (1 << 2 ); } else { PORTA &= ~ (1 << 2 ); } // Set and unset Strobe @ PORTA0 PORTA |= (1 << 0 ) ; PORTA &= ~ (1 << 0 ) ; // Set OE @ PORTA3 PORTA |= (1 << 3); // Delay for (a = 0; a < 5; a++) { for (b = 0; b < 0xffff; b++) { /* nix */ } } } return 0; }