Fazer o Led piscar conforme o gráfico
Resolução:
Código feito em CCS C Compiler
#include <16F877A.h>
#device adc=8
#FUSES NOWDT //No Watch Dog Timer
#FUSES HS //High speed Osc (> 4mhz for PCM/PCH) (>10mhz for PCD)
#FUSES NOPUT //No Power Up Timer
#FUSES NOPROTECT //Code not protected from reading
#FUSES NODEBUG //No Debug mode for ICD
#FUSES BROWNOUT //Reset when brownout detected
#FUSES NOLVP //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
#FUSES NOCPD //No EE protection
#FUSES NOWRT //Program memory not write protected
#use delay(clock=20000000)
void main(){
while(TRUE){
output_low(PIN_B2);
for(int i = 0; i< 50; i++){
for(int j = 0; j < 100; j++){
output_high(PIN_B2);
delay_us(i*(1000/50));
output_low(PIN_B2);
delay_us(1000-(1*(1000/50)));
}
}
}
}
Nenhum comentário:
Postar um comentário