summaryrefslogtreecommitdiffstats
path: root/main.c
blob: d77d118e5bfb3497e56629c15747f5ec250f0469 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
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);
}


}