Code:
//////////////////////////////////////////////////////////////
//
// LED Lauflicht f. Robby mit 74hc4094 Ansteuerung
//
// Sascha Becker 2004
//
//////////////////////////////////////////////////////////////
#define PORT1 0
#define STROBE 3
#define CLOCK 2
// 8 Bit an 74hc4094 senden
void BitMuster(bit b1, bit b2, bit b3, bit b4)
{
OutBit(STROBE,0); // Strobe
OutBit(PORT1,b1); // Data
OutBit(CLOCK,0); // Clock
OutBit(CLOCK,1);
OutBit(PORT1,b2); // Data
OutBit(CLOCK,0); // Clock
OutBit(CLOCK,1);
OutBit(PORT1,b3); // Data
OutBit(CLOCK,0); // Clock
OutBit(CLOCK,1);
OutBit(PORT1,b4); // Data
OutBit(CLOCK,0); // Clock
OutBit(CLOCK,1);
// 4 Leerbits hinterher
OutBit(PORT1,0); // Data
OutBit(CLOCK,0); // Clock
OutBit(CLOCK,1);
OutBit(CLOCK,0); // Clock
OutBit(CLOCK,1);
OutBit(CLOCK,0); // Clock
OutBit(CLOCK,1);
OutBit(CLOCK,0); // Clock
OutBit(CLOCK,1);
OutBit(STROBE,1); // Strobe
Wait(5);
}
void main()
{
while(1)
{
BitMuster(1,0,0,0);
BitMuster(0,1,0,0);
BitMuster(0,0,1,0);
BitMuster(0,0,0,1);
BitMuster(0,0,1,0);
BitMuster(0,1,0,0);
}
}
Lesezeichen