Zurück |
(C) Christof Ermer, Regensburg |
|
|
26.03.2014 |
Auszug
der Funktionstabelle DS = Serial Datat Input ST_CP= Storage Register Clock Input /MR = Master Reset SH_CP= Shift Clk Input /OE = Output Enable SH_CP & /MR=L EMPTY Shiftreg To Storagereg SH_CP & /MR=L Ausgang 0 Stellen SH_CP & /MR=H Data in Shiftreg ST_CP & /MR=H Shiftreg to Storagereg ST_CP & ^ ST_CP Pass Throug Shiftreg to Storagereg |
|
/////////////////////////////////////////////////////////////////////////// //// Library for a 74165 Expanded Input Chip //// //// //// //// Any number of these chips may be connected in series to get //// //// 8 additional inputs per chip. The cost is 3 I/O pins for //// //// any number of chips. //// //// //// //// read_expanded_inputs(ei); Reads the array ei from the chips //// //// //// /////////////////////////////////////////////////////////////////////////// //// (C) Copyright 1996,1997 Custom Computer Services //// //// This source code may only be used by licensed users of the CCS C //// //// compiler. This source code may only be distributed to other //// //// licensed users of the CCS C compiler. No other use, reproduction //// //// or distribution is permitted without written permission. //// //// Derivative programs created using this software in object code //// //// form are not restricted in any way. //// //////////////////////////////////////////////////////////////////////////// #IFNDEF EXP_IN_ENABLE #define EXP_IN_ENABLE PIN_B3 #define EXP_IN_CLOCK PIN_B4 #define EXP_IN_DI PIN_B5 #define NUMBER_OF_74165 1 #ENDIF void read_expanded_inputs(byte *ei) { byte i; output_high(EXP_IN_CLOCK); output_low(EXP_IN_ENABLE); // Latch all inputs output_high(EXP_IN_ENABLE); for(i=1;i<=NUMBER_OF_74165*8;++i) { // Clock in bits to the ei structure shift_left(ei,NUMBER_OF_74165,input(EXP_IN_DI)); output_low(EXP_IN_CLOCK); output_high(EXP_IN_CLOCK); } output_low(EXP_IN_ENABLE); } |
Zustandsautomat odetr Stamaschine = ST-- UART Konzeptdas Prinzip ist, dass du mit jedem empfangenen Byte guckst, was du
http://de.wikipedia.org/wiki/Endlicher_Automat
http://www.mikrocontroller.net/articles/Statemachine
damit anfangen kannst. Wenn dieses Byte dazu führt, dass du
(basierend auf dem aktuellen Zustand des Automaten) einen bestimmten
Abschnitt des Headers jetzt erkannt hast, dann schaltet der
Automat weiter und guckt, was danach kommt. Auf diese Weise
hangelt man sich Stück für Stück weiter. Wenn irgendetwas
unerwartetes im Datenstrom ankommt, bricht der Zustandsautomat
(so der offizielle deutsche Name) ab und fällt auf den Grundzustandzurück.
Inzwischen ist es auch möglich eine Philips DC-3840 anzuschliessen