5 Ocak 2023 Perşembe

74hc595 entegresi 12f675 seven segment ccs c compiler

74hc595 entegresi 12f675 seven segment ccs c compiler  kullanımı.


 #include<12f675.h>

#device adc=10


#fuses nowdt,nobrownout,nomclr

#use delay(clock=4m)


#define sh_cp pin_a0

#define ds    pin_a1

#define st_cp pin_a2


unsigned int8 led[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x98};


void transfer(unsigned int8 data);

void countup(void);


void main()

{

output_bit(sh_cp,0);

output_bit(ds,0);

output_bit(st_cp,0);


while(true)

{

countup();


}

}

void transfer(unsigned int8 data)

{

unsigned int8 key,bitnumber;

for(bitnumber=0; bitnumber<=7; bitnumber++)

{

key = data&(0x80 >> bitnumber);

if(key>0)

{

output_bit(ds,1);

}

else

{

output_bit(ds,0);

}

output_bit(sh_cp,1);

output_bit(sh_cp,0);

}

output_bit(st_cp,1);

output_bit(st_cp,0);


}


void countup(void)

{

unsigned int8 number;

for(number=0;number<=99;number++)

{

transfer(led[number%10]);

transfer(led[number/10]);

delay_ms(200);

}

}






Hiç yorum yok:

Yorum Gönder

Her yorum bilgidir. Araştırmaya devam...