#include sbit LS1 = P0^0; sbit LS2 = P0^1; void main(void) { unsigned char ucValue = 0; unsigned char released = 0; P2M1 = 0x00; // Port 2 als quasi-bidirektional P2 = ucValue; while (1) // Endlosschleife { while (( LS1 == 0) && ( LS2 == 0)) // Solange LS1 und LS2 unterbrochen { ucValue++; // erhöhe ucValue um 1 P2 = ucValue; // Zuweisung ucValue auf Port2 do //tue { released = 0; // Zuweisung Wert 0 auf Variable if ( LS1 == 1 ) // wenn LS1 nicht mehr unterbrochen { released = 1; // Zuweisung Wert 1 auf Variable } } while (released == 0); // solange Variable gleich 0 } } }