#define IN_CLOCK PIN_B0
#define IN_DATA PIN_B1
char recByte=0;
int8 nextBit=0;
int1 reccomplete=0;
// INTERRUPCIÓN por EXT0 Clock CK (Data - Clock) --------
#int_ext
ext_isr() {
int1 bit;
bit=!input(IN_DATA);
bit_clear(recByte,nextBit);
if(bit==1) bit_set(recByte,nextBit);
if(++nextBit=8){
nextBit=0;
reccomplete=1;
}
}
// MAIN ------------------------------------------------
void main(void){
ext_int_edge(0,H_TO_L);
enable_interrupts(int_ext);
enable_interrupts(global);
do {
// Lectura Completa
if(reccomplete==1){
readcomplete=0;
putc(recByte);
}
} while (TRUE);
}