Difference between revisions of "U23 2007/NoComment/schiebe.c"

From C4 Wiki
Jump to: navigation, search
(New page: TEST ;))
 
Line 1: Line 1:
TEST ;)
+
#include <avr/io.h>
 +
 
 +
int main(void) {
 +
 
 +
        DDRA = 0xFF;
 +
PORTA = 0x00;
 +
 
 +
// Set OE
 +
PORTA |= (1 << 3);
 +
 
 +
uint16_t i;
 +
 
 +
uint16_t a;
 +
uint16_t b;
 +
 
 +
 
 +
for (i = 0 ; i < 16 ; i ++) {
 +
 
 +
// Clock
 +
if ( i % 2 ) {
 +
PORTA |= (1 << 2 );
 +
} else {
 +
PORTA &= ~ (1 << 2 );
 +
}
 +
 
 +
PORTA &= ~ (1<<2);
 +
 
 +
}
 +
 
 +
// Set and unset Strobe
 +
PORTA |= (1 << 0 ) ;
 +
for (b = 0; b < 0xffff; b++) {
 +
PORTB &= (1 << 1);
 +
}
 +
PORTA &= ~ (1 << 0 ) ;
 +
 
 +
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);
 +
}
 +
*/
 +
 
 +
if ( ((int) i/2) % 2 ) {
 +
PORTA |= (1 << 1);
 +
}else {
 +
PORTA &= ~ (1 << 1);
 +
}
 +
 
 +
 
 +
// Clock
 +
if ( i % 2 ) {
 +
PORTA |= (1 << 2 );
 +
} else {
 +
PORTA &= ~ (1 << 2 );
 +
}
 +
 
 +
// DELAY
 +
 
 +
// Set and unset Strobe
 +
PORTA |= (1 << 0 ) ;
 +
PORTA &= ~ (1 << 0 ) ;
 +
 
 +
 
 +
// Set OE
 +
PORTA |= (1 << 3);
 +
 +
for (a = 0; a < 5; a++) {
 +
for (b = 0; b < 0xffff; b++) {
 +
/* nix */
 +
}
 +
}
 +
}
 +
 
 +
return 0;
 +
 
 +
}

Revision as of 22:50, 22 May 2007

  1. include <avr/io.h>

int main(void) {

       DDRA = 0xFF;

PORTA = 0x00;

// Set OE PORTA |= (1 << 3);

uint16_t i;

uint16_t a; uint16_t b;


for (i = 0 ; i < 16 ; i ++) {

// Clock if ( i % 2 ) { PORTA |= (1 << 2 ); } else { PORTA &= ~ (1 << 2 ); }

PORTA &= ~ (1<<2);

}

// Set and unset Strobe PORTA |= (1 << 0 ) ; for (b = 0; b < 0xffff; b++) { PORTB &= (1 << 1); } PORTA &= ~ (1 << 0 ) ;

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); }

  • /

if ( ((int) i/2) % 2 ) { PORTA |= (1 << 1); }else { PORTA &= ~ (1 << 1); }


// Clock if ( i % 2 ) { PORTA |= (1 << 2 ); } else { PORTA &= ~ (1 << 2 ); }

// DELAY

// Set and unset Strobe PORTA |= (1 << 0 ) ; PORTA &= ~ (1 << 0 ) ;


// Set OE PORTA |= (1 << 3);

for (a = 0; a < 5; a++) { for (b = 0; b < 0xffff; b++) { /* nix */ } } }

return 0;

}