Werbung
Im P5DRIV wird's so gemacht:
-- Hast Du das gesucht?Code:*IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII *III EXTPORT, LEDPORT: shift data out III *IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII *III on entry: DATA line is DDR=OUT III *III on entry: CLOCK line is DDR=OUT, ON III *III on entry: STROBE line is DDR=OUT, OFF III *III on entry: LSTROBE line is DDR=OUT, OFF III *III in CCBASIC: must pulse selected STROBE III *IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII * REMAINS PA3=0, PA2=1 ; init: index of EXTPORT relative EXTPORT PDRIVE: CLRX ; EXTPORT is at index 0 BRA PDSHIFT ; shift out 8 bits LDRIVE: ; init: index of LEDPORT relative EXTPORT LDX #2 ; LEDPORT is EXTPORT + 2 ; fall thru ; shift out 8 bits to indexed PORT PDSHIFT: LDA #8 ; shift out 8 bits * BSET 0,PADDR ; DATA LINE IS OUTPUT LP2: ROL EXTP,X BCLR 0,PADAT ; OUT = lo BCC LP1 BSET 0,PADAT ; OUT = HI LP1: BCLR 2,PADAT ; pulse CLOCK out BSET 2,PADAT DECA BNE LP2 ; restore cached value ROL EXTP,X ; NOTE: must pulse STROBE line in CCBASIC * BSET 3,PADAT ;STROBE * BCLR 3,PADAT ; NOTE: input not supported any more * BCLR 0,PADDR ;DATA LINE IS INPUT RTS
@Jörg
Ja Danke. Genau das hatte ich gesucht. Letzten Endes habe ich mich aber an die Spezifikation im Datenblatt des 74HC4094 gehalten. und die einzelnen Ports direkt angesteuert.
Und es hat funktioniert. Das Ergebnis ist im Anhang zu finden.
Als nächstes werde ich versuchen den Antrieb anzusteuern.
Gruß
Sascha
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