Difference between revisions of "U23 2007/Inhalt Abend 2/Schieberegister"

From C4 Wiki
Jump to: navigation, search
Line 5: Line 5:
 
  #define STROBE 2
 
  #define STROBE 2
 
  #define OE 3
 
  #define OE 3
 +
 
  int main(void)
 
  int main(void)
 
  {
 
  {

Revision as of 21:42, 14 May 2007

Schieberegister - Ansteuerung schiebe 1 0 rein und Ausgabe aktiv.

#include <avr/io.h>
#define CP 0
#define DATA 1
#define STROBE 2
#define OE 3

int main(void)
{
       DDRA = 0xFF;
       PORTA = 0x00;
       PORTA |= (1<<STROBE)|(1<<OE);
       PORTA |= (1<<DATA);
       PORTA |= (1<<CP);
       PORTA &= ~(1<<CP);
       PORTA &= ~(1<<DATA);
       PORTA |= (1<<CP);
       PORTA &= ~(1<<CP);
       return 0;
}