Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int sveti=128;
- int count=0;
- int i=0;
- int dali = 0;
- void znakP(){
- PORTB=0b00110111;
- }
- void znakC(){
- PORTB=0b00111001;
- }
- main(){
- ANSEL=ANSELH=0;
- TRISA=0x00;
- PORTA=0x00;
- TRISE=0b0001;
- PORTE=0b0000;
- TRISB=0x00;
- PORTB=0x00;
- while(1){
- if(PORTE.B0==0){
- PORTA=0b00000000;
- znakC();
- if(dali==1){
- EEPROM_Write(0x00,i);
- i++;
- EEPROM_Write(0x00+i,count);
- count=0;
- }
- }
- else if(PORTE.B0==1) {
- dali=1;
- znakP();
- PORTA=sveti;
- count++;
- delay_ms(20);
- sveti/=2;
- PORTA=sveti;
- count++;
- delay_ms(20);
- sveti/=2;
- PORTA=sveti;
- count++;
- delay_ms(20);
- sveti*=2;
- PORTA=sveti;
- count++;
- delay_ms(20);
- sveti/=2;
- if(sveti==0){
- sveti=128;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement