Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void setup() {
- DDRD=0x90;
- DDRB=0x01;
- }
- unsigned char functie(unsigned char octet, unsigned char digit)
- {
- unsigned char temp, i;
- PORTB = 0x00;
- PORTD = 0x00;
- for (i =0; i < 8; i++)
- {
- PORTD = 0x00; //pas 1
- temp = (octet >> (7 - i));
- temp = temp & 0x01;
- PORTB = temp; //pas 2
- PORTD = 0x80; //pas 3
- PORTB=0;
- }
- for (i =0; i < 8; i++)
- {
- PORTD = 0x00; //pas 1
- temp = (digit >> (7 - i));
- temp = temp & 0x01;
- PORTB = temp; //pas 2
- PORTD = 0x80; //pas 3
- PORTB = 0;
- }
- PORTB=0x00;
- PORTD=0x10;
- }
- int main(){
- unsigned char octet, temp, i;
- unsigned char digit;
- setup();
- while(1){
- functie(~0x5B,0x01);
- functie(~0x5B,0x08);
- functie(~0xbf,0x02);
- functie(~0x06,0x04);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement