/* ----------------------------------------------------------------------- */
/* Bits de configuración: adapte los parámetros a su necesidad */
typedef unsigned int word;
word at 0x2007 CONFIG = _HS_OSC & _WDT_OFF & _LVP_OFF &_DEBUG_OFF & _CPD_OFF &_PWRTE_ON &_BODEN_ON;
void isr() interrupt 0 { /* rutina de servicio de interrupciones */
/* << agregue el código de interrupción >> */
}
int i;
void retardo (int);
void main() {
TRISA = 0b11111111;
TRISB = 0b00000000;
while(1) {
PORTB = i;
retardo(250);
i++;
}
}
void retardo(int c)
{
unsigned int a,b;
for (b=1;b<=c;b++){
for (a = 1; a <= 1000; a++);
}
}
gpsim -p p16f873a -s Ejemplo.cod

No hay comentarios:
Publicar un comentario