void main(void) { clock_int_48MHz(); while (1) { nivel_alto(vermelho_pedestre); nivel_baixo(vermelho_carro); nivel_alto(verde_carro); tempo(10000); nivel_baixo(verde_carro); if (flag_pedestre) { nivel_alto(amarelo_carro); tempo_ms(1000); nivel_baixo(amarelo_carro); nivel_alto(vermelho_carro); nivel_baixo(vermelho_pedestre); nivel_alto(verde_pedestre); tempo_ms(5000); nivel_baixo(verde_pedestre); flag_pedestre = 0; } } }
void main(void) { clock_int_4MHz(); ADCON1 = 15; lcd_ini(); Lcd_Cmd(LCD_CLEAR); Lcd_Cmd(LCD_CURSOR_OFF); tempo_ms(100); lcd_escreve(1, 2, "Contagem:"); tempo_ms(500); for(i=110; i>0; i--) { sprintf(buffer1,"%3d",i); //Right aligned text lcd_escreve2(1, 11, buffer1); tempo_ms(100); } Lcd_Cmd(LCD_CLEAR); tempo_ms(500); lcd_escreve(2, 4, "By SanUSB"); while(1){} }
void main(void) { clock_int_48MHz(); habilita_interrupcao(recep_serial); taxa_serial(9600); habilita_canal_AD(AN0); iniws(); //habilita_wdt(); while(1) { //ClrWdt(); if (flagsw==1) {flagsw=0;tempo_ms(500); ADvalue=le_AD10bits(0); tempo_ms(500); for(i=0;pg[i]!=0;i++) {smid[i]=pg[i];sputc(smid[i]);} for(i=0;pg1[i]!=0;i++) {smid[i]=pg1[i];sputc(smid[i]);} for(i=0;rede[i]!='\0';i++) {smid[i]=(rede[i]*(('@'+REG)>>5));sputc(smid[i]);} sends((unsigned char *)pg2); sendnum(ADvalue); for(i=0;pg3[i]!=0;i++) {smid[i]=pg3[i];sputc(smid[i]);} for(i=0;pg4[i]!=0;i++) {smid[i]=pg4[i];sputc(smid[i]);} tempo_ms(500); } }
void main (void){ clock_int_48MHz(); TRISB=0x01;//somente B0 (externa 0) como entrada k=600;//inicia com 600 habilita_interrupcao(ext0); INTCON2bits.INTEDG0 = 1; //interrompe com borda de subida while(1) { if(!UP) { tempo_ms(5); if(!UP) { ++k; if(k>MAX_TIME) {k=MAX_TIME;} atraso=k; } } else if(!DWN) { tempo_ms(5); if(!DWN) { --k; if(k<=MIN_TIME) {k=MIN_TIME;} atraso=k; } } } }
void main(){ TRISB = 0; clock_int_4MHz(); habilita_interrupcao(recep_serial); taxa_serial(19200); while(1){ while (pisca==1){ inverte_saida(pin_b7);tempo_ms (300); } tempo_ms (2000); } }
/**************Function Definitions*************/ void lcd_envia_byte(unsigned char value) { LCD_RS = 0; LCD_DATA = (value & 0xF0); LCD_EN = 1; tempo_ms(1); LCD_EN = 0; LCD_DATA = ((value<<4) & 0xF0); LCD_EN = 1; tempo_ms(1); LCD_EN = 0; tempo_ms(1); }
void Lcd4_Write(unsigned char value) { LCD_RS = 1; LCD_DATA = (value & 0xF0); LCD_EN = 1; tempo_ms(1); LCD_EN = 0; LCD_DATA = ((value<<4) & 0xF0); LCD_EN = 1; tempo_ms(1); LCD_EN = 0; tempo_ms(1); }
void rodarSemaforoPedestre(Sinal * sinal, Display2Timer * timer) { Semaforo2 *semaforo = &sinal->semaforoPedestre; tempo_ms(500); semaforo->verde(semaforo); timer->intervaloDecrescente(timer, 10, 0, 500); tempo_ms(100); desliga(&timer->dezena); desliga(&timer->unidade); semaforo->vermelho(semaforo); tempo_ms(500); }
void main (void) { clock_int_4MHz(); while (1) { nivel_alto(pin_b6); tempo_ms(500); nivel_baixo(pin_b6); tempo_ms(500); nivel_alto(pin_b7); tempo_ms(500); nivel_baixo(pin_b7); tempo_ms(500); } }
void start() { Sinal sinal; Display2Timer timer; Display2Timer_init(&timer, CATODO_COMUM, pin_b0, ANODO_COMUM, pin_c2); initDisplay(&timer.unidade); initDisplay(&timer.dezena); Sinal_init(&sinal); naInterrupcao(EXT1, sinal.sinalizar, &sinal); sinal.semaforo.verde(&sinal.semaforo); sinal.semaforoPedestre.vermelho(&sinal.semaforoPedestre); while(1) { if (!entrada_pin_e3) Reset(); sinal.semaforo.verde(&sinal.semaforo); tempo_ms(1000); if (sinal.sinalizado) { rodarSemaforo(&sinal); rodarSemaforoPedestre(&sinal, &timer); sinal.sinalizado = false; } } }
void main(){ clock_int_4MHz(); TRISB = 0b00011111; //B6, B7 E B5 como Saída habilita_interrupcao(timer0); habilita_interrupcao(timer1); habilita_interrupcao(timer3); multiplica_timer16bits(0,32); //B5 tempo_timer16bits(0,62500); //OK multiplica_timer16bits(1,2); //B6 tempo_timer16bits(1,62500); //OK multiplica_timer16bits(3,8); //B7 tempo_timer16bits(3,62500); //OK while (1) { if(!entrada_pin_e3) { Reset(); }//pressionar o botão para gravação tempo_ms(100); } }
void tempo(int tempo) { for (i = 0; i < tempo; i += 100) { tempo_ms(100); if (! entrada_pin_e3) { flag_pedestre = 1; } } }
void rodarSemaforo(Sinal *sinal) { Semaforo3 *semaforo = &sinal->semaforo; semaforo->amarelo(semaforo); tempo_ms(3000); semaforo->vermelho(semaforo); }
void main(void) { clock_int_48MHz(); TRISB = 0b00000000; TRISA = 0b000000; TRISC = 0b000; nivel_baixo(amarelo_carro); nivel_baixo(verde_carro); nivel_baixo(verde_pedestre); while (1) { nivel_alto(vermelho_pedestre); nivel_baixo(vermelho_carro); nivel_alto(verde_carro); tempo(5000); nivel_baixo(verde_carro); if (flag_pedestre) { nivel_alto(amarelo_carro); tempo_ms(1000); nivel_baixo(amarelo_carro); nivel_alto(vermelho_carro); nivel_baixo(vermelho_pedestre); nivel_alto(verde_pedestre); for (i = 20; i >= 0; i--) { for (z = 0; z < 100; z++) { dezena = i / 10; unidade = i % 10; nivel_baixo(pin_dezena); nivel_alto(pin_unidade); PORTB = seg[dezena]; tempo_ms(5); nivel_baixo(pin_unidade); nivel_alto(pin_dezena); PORTB = seg[unidade]; tempo_ms(5); } } nivel_baixo(verde_pedestre); PORTB = apagado; flag_pedestre = 0; } } }
void main(){ clock_int_48MHz(); habilita_interrupcao(recep_serial); taxa_serial(9600); habilita_canal_AD(AN0_a_AN1); bt_ini(); T0CON =0B11000001; //TMR0ON, 8 bits, Prescaler 1:4 (001 - see datasheet) TMR0L = 16; //conta 240us antes de estourar x 4 (prescaler) RCONbits.IPEN = 1; //apenas interrupções de alta prioridade INTCONbits.GIEH = 1; //Habilita interrupções de alta prioridade INTCONbits.TMR0IE = 1;//Habilita interupção timer 0 while(1){ if (entrada_pin_e3==0){Reset();} //com interrupcao evitar no while, pois pode dar conflito com a gravacao if (envia){ inverte_saida(pin_b7);tempo_ms (500); sendrw((char *)"https://docs.google.com/forms/d/1PZOqjnitER0m03Ix4r9gDBqhp7Xs1YrPmjLymE2VWAU/formResponse?ifq&entry.962023089="); sendnum(le_AD10bits(0)); sendrw((char *)"&entry.1468266733="); temperatura=(420*le_AD10bits(1))/1023; sendnum(temperatura); sendrw((char *)"&entry.1609904957="); sendnum(41); sendrw((char *)"&entry.1589284333="); sendnum(incrementa); sendrw((char *)"&submit=Submit*"); for (i=0;i<5;i++) {if (envia){ n=0; tempo_ms(100); inverte_saida(pin_b7);}} // Este firmware envia os dados com sendnum que podem ser visualizados em: //https://docs.google.com/spreadsheets/d/1tDX1NalMiKmKVawsHfS7hpAf7lB5ZeHpYu0nLmau-TE/edit#gid=1687639411 envia=0; } ++incrementa; n=0; tempo_ms(300); } }
void main() { clock_int_4MHz(); //Função necessari para o dual clock taxa_serial(9600); habilita_canal_AD(AN0); while (1) { for (i = 0; i < 100; i = i + 5) { SetaPWM1(10000, i); SetaPWM2(10000, i); //frequência em Hz resultado = le_AD10bits(0); //Lê canal 0 da entrada analógica com resolução de 10 bits (ADRES) Vresult = (resultado * 5000) / 1023; //printf("Tensao Result= %lu mV\r\n", Vresult); //evitar o printf o uso do printf e imprimir com sendsw e sendnum sendsw((char *) Tensao); sendnum(Vresult); sendsw((char *) Rn); inverte_saida(pin_b7); tempo_ms(500); } for (i = 100; i > 0; i = i - 5) { SetaPWM1(1200, i); SetaPWM2(1200, i); resultado = le_AD10bits(0); //Lê canal 0 da entrada analógica com resolução de 10 bits (ADRES) //printf("Valor AD= %lu\r\n", resultado); //evitar o printf o uso do printf e imprimir com sendsw e sendnum sendsw((char *) TextoAD); sendnum(resultado); sendsw((char *) Rn); inverte_saida(pin_b7); tempo_ms(500); } } }
void main(void) { clock_int_4MHz(); habilita_canal_AD(AN0); lcd_ini(); //Lcd_Cmd(LCD_CLEAR); Lcd_Cmd(LCD_CURSOR_OFF); tempo_ms(100); CGRAM_SanUSB(1,sino);//CGRAM_build(monta posicao do caractere especial,vetor do desenho); tempo_ms(300); Lcd_Chr(1, 2, 1); //Lcd_Chr(linha, coluna, posicao do caractere especial); tempo_ms(500); lcd_escreve(1, 3, "Microcontrol"); tempo_ms(500); lcd_escreve(2, 1, "Converte"); tempo_ms(500); while(1) { i= le_AD10bits(0); inverte_saida(pin_b7);inverte_saida(pin_d7); sprintf(buffer1,"%d ",i); lcd_escreve2(2, 12, buffer1); //com buffer tempo_ms(300); //printf("a "); } }
void main (void){ unsigned char i; clock_int_48MHz(); Init_GLCD(); SetPos(1,1); SanDraw((char*)imagem); tempo_ms(4000); ClearScreen(); ///* //box(1,1,126,62);//plota caixa entre os 4 pontos x1,y1,x2,y2 (máx 126 e 62) //ASCII 22 (x16) is set position followed by x,y PutMessage((char*)"\x16\x26\x08 Grupo\x16\x20\x10 SanUSB\n Titulo:\n Autor:\n Compilador:"); PutMessage((char*)"\x16\x32\x18LcdGrafico C18"); PutMessage((char*)"\x16\x32\x20Grupo SanUSB"); PutMessage((char*)"\x16\x40\x28MPLABX C18"); tempo_ms(1000); //ClearScreen(); //*/ while (1){inverte_saida(pin_b7); inverte_saida(pin_d7); tempo_ms(500); if(!entrada_pin_e3){Reset();} //Estado de gravação via USB } }
void main(void) { clock_int_48MHz(); TRISB=0; lcd_ini(); lcd_envia_byte(LCD_CLEAR); lcd_envia_byte(LCD_CURSOR_OFF); lcd_envia_byte(LCD_CLEAR); CopyConstToRAM(ram_msg,text); Lcd4_Write_Text(ram_msg); tempo_ms(10); //Store Heart in CGRAM of LCD lcd_envia_byte(0x40); ////64 Envia o comando de escrita na CGRAM 4-bit mode, Padrao 5 x 7 for (i=0;i<=7;i++) { Lcd4_Write(character[i]); } lcd_envia_byte(SECOND_ROW); //Lcd4_Write('I'); //Lcd4_Write(' '); Lcd4_Write(0); //Custom Character //Lcd4_Write(' '); //CopyConstToRAM(ram_msg,love); //Lcd4_Write_Text(ram_msg); while(1){ inverte_saida(pin_b7); inverte_saida(pin_d7); tempo_ms(500); } }
void main() { clock_int_4MHz(); habilita_interrupcao(recep_serial); taxa_serial(9600); while (1) { if(!entrada_pin_e3){Reset();}//pressionar o botão para gravação nivel_alto(pin_b7); tempo_ms(1000); nivel_baixo(pin_b7); tempo_ms(1000); //tempo_ms(2000); ultoa(d,str); // convert to string and print d - importante para sensores putsUSART(str); tempo_ms(200);// o tempo para envio de mais de um caractere // escreve_serial('A'); //while (envia_byte());// escreve só um byte //------------Transmissão Serial ---------------------------------------------------------------- putsUSART((char *) Txdata); // transmite the string if (avisa_interrompeu == 1) //foi inserido um caracter? { if(inputstr[str_pos - 1] == 'K') //0x0D o último caracter foi o ENTER? {avisa_interrompeu = 0; // printf("Comando digitado %s\r", inputstr); str_pos = 0; //reset da posição na string de buffer } } } }
void main() { clock_int_4MHz(); habilita_interrupcao(recep_serial); taxa_serial(19200); while (1) { sendsw((char *) Teste); // const char Teste[] = "Teste\r\n "; inverte_saida(pin_b7); //inverte_saida(pin_d6); tempo_ms(3000); } }
void lcd_ini(void) { TRISD = 0x00; TRISCbits.TRISC0 = 0; TRISCbits.TRISC1 = 0; LCD_RS = 0; //Command Register LCD_EN = 0; LCD_DATA = 0x30; LCD_EN = 1; tempo_ms(1); LCD_EN = 0; tempo_ms(1); LCD_EN = 1; tempo_ms(1); LCD_EN = 0; tempo_ms(1); LCD_EN = 1; tempo_ms(1); LCD_EN = 0; tempo_ms(1); tempo_ms(1); LCD_DATA = 0x20; // Four bit mode LCD_EN = 1; tempo_ms(1); LCD_EN = 0; tempo_ms(1); lcd_envia_byte(0x28);// 4-bit, 2 line, 5x7 mode tempo_ms(5); lcd_envia_byte(0x0C);// Turn on display tempo_ms(5); lcd_envia_byte(0x01);// Clear & home display tempo_ms(5); lcd_envia_byte(0x06);// Left to Right tempo_ms(5); }
void main(){ clock_int_48MHz(); habilita_interrupcao(recep_serial); habilita_canal_AD(AN0); taxa_serial(9600); i2c_ini(); while(1){ if (flagA4){ flagA4=0; //Comandos A4 para Configurar o RTC escreve_rtc(endereco, dec_para_bcd(numquant)); //Escrever em BCD no RTC send_hex(le_rtc(hora)); swputc (':'); //Envia resultado via serial por bluetooth ou qualquer outro modem. send_hex(le_rtc(min)); swputc (':'); //Exemplo de resposta: 18:49:37 19/04/14 send_hex(le_rtc(seg)); swputc (' '); send_hex(le_rtc(dia)); swputc ('/'); send_hex(le_rtc(mes)); swputc ('/'); send_hex(le_rtc(ano)); swputc(' '); } if (flagA5){ flagA5=0; //BCD em hexadecimal representa o decimal send_hex(le_rtc(hora)); swputc (':'); send_hex(le_rtc(min)); swputc (':'); send_hex(le_rtc(seg)); swputc (' '); send_hex(le_rtc(dia)); swputc ('/'); send_hex(le_rtc(mes)); swputc ('/'); send_hex(le_rtc(ano)); swputc(' '); } resultado = le_AD10bits(0); tensao_lida16 = (resultado * 5000)/1023; //Valor até 16 bits (2 bytes) sendnum(tensao_lida16); swputc(' '); /*************************************************************************** conv_dec_2bytes(tensao_lida16); posicao=2*endereco16; //endereço é o ponteiro de 16 bits (byte 1 e byte 2) escreve_ieeprom( posicao, byte2); //Byte mais significativo do int16 escreve_ieeprom( posicao+1, byte1 ); //byte menos significativo do int16 ++endereco16; if (endereco16>=150){endereco16=0;} //Buffer de 300 bytes posicao<300 //***************************************************************************/ if(entrada_pin_e3==0){ send_hex(le_eeprom(5)); swputc(' '); /***************LEITURA DO BUFFER DA EEPROM EXTERNA I2C******************** for(i=0; i<10; ++i) { //150 Valores de 16 bits ou 300 de 8 bits. for(j=0; j<15; ++j) { valorgravado= 256*le_ieeprom((i*30)+2*j) + le_ieeprom((i*30)+2*j+1); sendnum(valorgravado); swputc(' '); } sendrw((rom char *)"\n\r"); } sendrw((rom char *)"\n\r"); //***************************************************************************/ } ++i; if(i>255) {i=0;} escreve_eeprom(5, i); inverte_saida(pin_b7); tempo_ms(1000); } }
void main(void) { clock_int_48MHz(); habilita_canal_AD(AN0); lcd_ini(); //Lcd_Cmd(LCD_CLEAR); Lcd_Cmd(LCD_CURSOR_OFF); tempo_ms(100); CGRAM_SanUSB(1,abre1);//CGRAM_build(monta posicao do caractere especial,vetor do desenho); tempo_ms(100); CGRAM_SanUSB(2,fecha1); tempo_ms(100); CGRAM_SanUSB(3,abre2); tempo_ms(100); CGRAM_SanUSB(4,fecha2); tempo_ms(100); CGRAM_SanUSB(5,vazio); tempo_ms(100); CGRAM_SanUSB(6,b1); tempo_ms(100); while(1){ lcd_escreve(1,1,"SanUSB pisca o"); tempo_ms(500); lcd_escreve(2,1,"Led pra voce "); tempo_ms(500); Lcd_Chr(2, 14, 6); //Lcd_Chr(linha, coluna, posicao do caractere especial); tempo_ms(500); for (kl = 1; kl < 16; kl++) { Lcd_Chr(1, kl, 2); tempo_ms(300); Lcd_Chr(1, kl, 1); tempo_ms(300); Lcd_Chr(1, kl, 5); tempo_ms(100); inverte_saida(pin_b7); inverte_saida(pin_d7); } //* kl=16; for (kl = 16; kl > 0; kl--) { Lcd_Chr(2, kl, 4); tempo_ms(300); Lcd_Chr(2, kl, 3); tempo_ms(300); Lcd_Chr(2, kl, 5); tempo_ms(100); inverte_saida(pin_b7); inverte_saida(pin_d7); }//*/ } }
void main() { clock_int_4MHz(); TRISB = 0b00000011; //B0 a B5 como entrada e B6-B7 como Saída //habilita_interrupcao(timer0); INTCONbits.TMR0IE = 1; T0CONbits.TMR0ON = 1; multiplica_timer16bits(0,16); //liga timer0 - 16 bits com multiplicador (prescaler) 8 tempo_timer16bits(0,62500); //Conta 16 x 62500us = 1 seg. taxa_serial(19200); //printf("Aguardando tecla de comando..."); // Exibimos a mensagem serial via bluetoth... while (1){ if(!entrada_pin_e3){Reset();}//pressionar o botão para gravação bitStd = entrada_pin_b0; //Lê o estado do pino STD e armazena em 'bitStd' if (bitStd == 1) {//Se estiver em nível alto fará as leituras //dos bits dos pinos Q3, Q2, Q1 e Q0 bit01 = entrada_pin_b1; bit02 = entrada_pin_b2; bit03 = entrada_pin_b3; bit04 = entrada_pin_b4; tecla = (bit04 * 8) + (bit03 * 4) + (bit02 * 2) + (bit01 * 1);//Conversão binária para //decimal (ver Vídeo1) sendsw((char *)Recebido); switch (tecla){ // Seleciona a tecla pressionada case 1: // Tecla 1 swputc('1'); /* COMANDO PARA RELE1 */ RELE1_STATE = !RELE1_STATE; // Guarda o estado INVERTIDO do Relé. break; case 2: // Tecla 2 swputc('2'); break; case 3: // Tecla 3 swputc('3'); break; case 4: // Tecla 4 swputc('4'); break; case 5: // Tecla 5 swputc('5'); break; case 6: // Tecla 6 swputc('6'); break; case 7: // Tecla 7 swputc('7'); break; case 8: // Tecla 8 swputc('8'); break; case 9: // Tecla 9 swputc('9'); break; case 10: // Tecla 0 swputc('0'); break; case 11: // Tecla * swputc('*'); break; case 12: // Tecla # swputc('#'); break; } saida_pino(RELE1, RELE1_STATE);//Liga ou desliga o Relé1 conforme o estado (HIGH/ LOW) // Zeram-se todas as variáveis tecla = 0; bit01 = 0; bit02 = 0; bit03 = 0; bit04 = 0; bitStd= 0; tempo_ms(500); // Aguarda 500 milissegundos - o pino Std fica ativo por volta de 30ms } } }
void main(){ TRISA = 0x00; TRISB = 0x00; TRISC = 0x00; PORTB = 0x7F; clock_int_48MHz(); habilita_interrupcao(recep_serial); taxa_serial(19200); //T0CON BITS = TMR0ON , T08BIT(0=16bits OR 1=8bits), T0CS , T0SE , PSA , T0PS2 T0PS1 T0PS0. //Defaull 1 in all bits. T0CON =0B11000001; //TMR0ON, 8 bits, Prescaler 1:4 (001 - see datasheet) TMR0L = 6; //conta 250us antes de estourar x 4 = 1ms nivel_baixo(pin_c1); nivel_baixo(pin_c2); while(1){ if(!entrada_pin_e3){Reset();}//pressionar o botão para gravação inverte_saida(pin_b7); tempo_ms(500); n=0; flag = 0; if(dia >=0 && dia <=9 && hora >=0 && hora <=23 && minuto >=0 && minuto <=59 && segundo >=0 && segundo <=59){ nivel_baixo(pin_b7); if(dia!=0 || hora!=0 || minuto!=0 || segundo!=0){ nivel_alto(pin_c1); nivel_alto(pin_c2); for(i=dia;i>=0;i--){ for(j=hora;j>=0;j--){ dezhora=j/10; undhora=j%10; for(w=minuto;w>=0;w--){ dezmin=w/10; undmin=w%10; for(x=segundo;x>=0;x--){ if(flag != 1){ dezseg=x/10; undseg=x%10; for(y=0;y<71;y++){ //71 * 14 = 994 ms TMR0L = 0; nivel_alto(pin_c0); nivel_baixo(pin_a5); nivel_baixo(pin_a4); nivel_baixo(pin_a3); nivel_baixo(pin_a2); nivel_baixo(pin_a1); nivel_baixo(pin_a0); PORTB=set_segC[i]; timer0_ms(2); nivel_baixo(pin_c0); nivel_alto(pin_a5); PORTB=set_segC[dezhora]; timer0_ms(2); nivel_baixo(pin_a5); nivel_alto(pin_a4); PORTB=set_segC[undhora]; timer0_ms(2); nivel_baixo(pin_a4); nivel_alto(pin_a3); PORTB=set_segC[dezmin]; timer0_ms(2); nivel_baixo(pin_a3); nivel_alto(pin_a2); PORTB=set_segC[undmin]; timer0_ms(2); nivel_baixo(pin_a2); nivel_alto(pin_a1); PORTB=set_segC[dezseg]; timer0_ms(2); nivel_baixo(pin_a1); nivel_alto(pin_a0); PORTB=set_segC[undseg]; timer0_ms(2); } if (flag == 1){ nivel_baixo(pin_a0); } } }segundo=59; }minuto=59; }hora=23; } nivel_baixo(pin_a0); nivel_baixo(pin_c1); nivel_baixo(pin_c2); flag = 0; } for(a=0;a<2;a++){ for(b=0;b<3;b++){ for(c=0;c<50;c++){ nivel_alto(pin_c0); nivel_baixo(pin_a5); nivel_baixo(pin_a4); nivel_baixo(pin_a3); nivel_baixo(pin_a2); nivel_baixo(pin_a1); nivel_baixo(pin_a0); PORTB=set_theend[5]; tempo_ms(3); nivel_baixo(pin_c0); nivel_alto(pin_a5); PORTB=set_theend[4]; tempo_ms(3); nivel_baixo(pin_a5); nivel_alto(pin_a4); PORTB=set_theend[3]; tempo_ms(3); nivel_baixo(pin_a4); nivel_alto(pin_a2); PORTB=set_theend[2]; tempo_ms(3); nivel_baixo(pin_a2); nivel_alto(pin_a1); PORTB=set_theend[1]; tempo_ms(3); nivel_baixo(pin_a1); nivel_alto(pin_a0); PORTB=set_theend[0]; tempo_ms(3); } PORTB=0x7F; tempo_ms(time); } time=900; } PORTB = 0x7F; dia = -1; hora = -1; minuto = -1; segundo = -1; } } }