Skip to content

Instantly share code, notes, and snippets.

@JulioAlexanderAguilarAngulo
Last active August 29, 2015 14:25
Show Gist options
  • Save JulioAlexanderAguilarAngulo/4673acbd2bab505e91f1 to your computer and use it in GitHub Desktop.
Save JulioAlexanderAguilarAngulo/4673acbd2bab505e91f1 to your computer and use it in GitHub Desktop.
void SendData_4094(uint8_t sel,uint8_t data)
{
#define DAT_4094 1<<4
#define CLK_4094 1<<5
#define ENA_4094 1<<6
#define STB_4094 1<<7
uint8_t LOOP, FLAG;
PORTA &= ~ ( ENA_4094 | STB_4094 ) ; PORTB &= ~ ( CLK_4094 ); PORTA |= ENA_4094;
for (LOOP=0; LOOP<8; LOOP++) { PORTB &= ~ ( CLK_4094 ); FLAG=sel&0x80;
if(FLAG==0){ PORTB &= ~ ( DAT_4094 );}
else { PORTB |= DAT_4094 ;}
sel <<= 1; PORTB |= ( CLK_4094 ); }
for (LOOP=0; LOOP<8; LOOP++) { PORTB &= ~ ( CLK_4094 ); FLAG=data&0x80;
if(FLAG==0){ PORTB &= ~ ( DAT_4094 );}
else { PORTB |= DAT_4094 ;}
data <<= 1; PORTB |= ( CLK_4094 );}
PORTB &= ~ ( CLK_4094 ); PORTA |= STB_4094;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment