Você está na página 1de 1

PIC013.

c 27/02/2018 14:46:16

1: void main()
2: {
3: unsigned char catodo, cont = 0x00; //0x00
4: unsigned char segmento[] = {0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x67};
5:
6: CMCON = 0x07; //desabilita comparadores
7: TRISB = 0x00; //todo PORTB configurado como saída
8: PORTB = 0x00; //PORTB inicia em nível baixo
9:
10:
11:
12: while(1)
13: {
14: catodo = segmento[cont]; //numero a ser enviado para PORTB
15:
16: PORTB = catodo; //envia pattern para PORT B
17: cont++; //cont = cont + 1
18:
19: if(cont==10)cont=0; //reinicia contagem
20: delay_ms(1000); //delay de 1 segundo
21: } //end while
22:
23: } //end void main

1/1 mikroC PRO for PIC by mikroElektronika

Você também pode gostar