diff options
Diffstat (limited to 'main.c')
-rw-r--r-- | main.c | 72 |
1 files changed, 72 insertions, 0 deletions
@@ -0,0 +1,72 @@ +#undef TESTING + +#include "pic16f917.h" + +#define __16f917 + + +typedef unsigned int config; +config __at 0x2007 __CONFIG = _CPD_OFF & _CP_OFF & _MCLRE_ON & _PWRTE_ON & _WDT_OFF & _HS_OSC ; + +void +msleep (int n) +{ + int j; + while (n--) + { + for (j = 0; j < 255; ++j) + { + } + } +} +void +sleep (int n) +{ + while (n--) + { + msleep (255); + } +} + +void thing(__sfr *t,__sfr *d) +{ +int i; + +for (i=0;i<8;++i) { +int c=1<<i; +*t=255^c; +*d=0; + +sleep(1); +sleep(1); +sleep(1); + +*d=255; + +sleep(1); +sleep(1); +sleep(1); + +} + +*t=255; +} + +void +main (void) +{ + + //ANSEL = 0x00; + WPU = 0xff; + +for (;;) { + +thing(&TRISA,&PORTA); +thing(&TRISB,&PORTB); +thing(&TRISC,&PORTC); +thing(&TRISD,&PORTD); +thing(&TRISE,&PORTE); +} + + +} |