Rev Author Line No. Line
1746 kakl 1 #include "main.h"
2  
3 #case
4  
5 #define S105A1 input(PIN_A0)
6 #define R105A1U input(PIN_A1)
7 #define R105A1D input(PIN_A2)
8 #define S104A1 input(PIN_A3)
9 #define R104A1U input(PIN_A4)
10 #define R104A1D input(PIN_A5)
11 #define R104B1U input(PIN_A6)
12 #define R104B1D input(PIN_A7)
13  
14 #define S103A1 input(PIN_B0)
15 #define S103A2 input(PIN_B1)
16 #define S103A3 input(PIN_B2)
17 #define R103A1U input(PIN_B3)
18 #define R103A1D input(PIN_B4)
19 #define S106A1 input(PIN_B5)
20 #define S107A2 input(PIN_B6)
21 #define S109A1 input(PIN_B7)
22  
23 #define OS101 PIN_C0
24 #define OS105B PIN_C1
25 #define OS105C PIN_C2
26  
27 //#define PIN_C3 31763
28 //#define PIN_C4 31764
29 //#define PIN_C5 31765
30  
31 //#define PIN_C6 31766 //TX
32 //#define PIN_C7 31767 //RX
33  
34 #define S101A1 input(PIN_D0)
35 #define S101A2 input(PIN_D1)
36 #define S105B1 input(PIN_D2)
37 #define S105C1 input(PIN_D3)
38 #define S105D1 input(PIN_D4)
39 #define S102A1 input(PIN_D5)
40 #define S110A1 input(PIN_D6)
41 #define S108A1 input(PIN_D7)
42  
43 /*
44 #define PIN_E0 31776
45 #define PIN_E1 31777
46 #define PIN_E2 31778
47 #define PIN_E3 31779
48 #define PIN_E4 31780
49 #define PIN_E5 31781
50 #define PIN_E6 31782
51 #define PIN_E7 31783
52  
53 #define PIN_F0 31784
54 #define PIN_F1 31785
55 #define PIN_F2 31786
56 #define PIN_F3 31787
57 #define PIN_F4 31788
58 #define PIN_F5 31789
59 #define PIN_F6 31790
60 #define PIN_F7 31791
61  
62 #define PIN_G0 31792
63 #define PIN_G1 31793
64 #define PIN_G2 31794
65 #define PIN_G3 31795
66 #define PIN_G4 31796
67 #define PIN_G5 31797
68  
69 #define PIN_H0 31800
70 #define PIN_H1 31801
71 #define PIN_H2 31802
72 #define PIN_H3 31803
73 #define PIN_H4 31804
74 #define PIN_H5 31805
75 #define PIN_H6 31806
76 #define PIN_H7 31807
77  
78 #define PIN_J0 31808
79 #define PIN_J1 31809
80 #define PIN_J2 31810
81 #define PIN_J3 31811
82 #define PIN_J4 31812
83 #define PIN_J5 31813
84 #define PIN_J6 31814
85 #define PIN_J7 31815
86 */
87  
88 #define LED1 PIN_J7
89 #define LED2 PIN_J6
90  
91 int1 s105A1;
92 int1 r105A1U;
93 int1 r105A1D;
94 int1 s104A1;
95 int1 r104A1U;
96 int1 r104A1D;
97 int1 r104B1U;
98 int1 r104B1D;
99  
100 int1 s103A1;
101 int1 s103A2;
102 int1 s103A3;
103 int1 r103A1U;
104 int1 r103A1D;
105 int1 s106A1;
106 int1 s107A2;
107 int1 s109A1;
108  
109 int1 s101A1;
110 int1 s101A2;
111 int1 s105D1;
112 int1 s102A1;
113 int1 s110A1;
114 int1 s108A1;
115  
116 void main()
117 {
118  
119 setup_adc_ports(NO_ANALOGS|VSS_VDD);
120 setup_adc(ADC_CLOCK_DIV_2);
121 setup_psp(PSP_DISABLED);
122 setup_spi(SPI_SS_DISABLED);
123 setup_wdt(WDT_OFF);
124 setup_timer_0(RTCC_INTERNAL);
125 setup_timer_1(T1_DISABLED);
126 setup_timer_2(T2_DISABLED,0,1);
127 setup_timer_3(T3_DISABLED|T3_DIV_BY_1);
128 setup_ccp1(CCP_OFF);
129 setup_comparator(NC_NC_NC_NC);
130 setup_vref(FALSE);
131  
132 s105A1=S105A1;
133 r105A1U=R105A1U;
134 r105A1D=R105A1D;
135 s104A1=S104A1;
136 r104A1U=R104A1U;
137 r104A1D=R104A1D;
138 r104B1U=R104B1U;
139 r104B1D=R104B1D;
140  
141 s103A1=S103A1;
142 s103A2=S103A2;
143 s103A3=S103A3;
144 r103A1U=R103A1U;
145 r103A1D=R103A1D;
146 s106A1=S106A1;
147 s107A2=S107A2;
148 s109A1=S109A1;
149  
150 s101A1=S101A1;
151 s101A2=S101A2;
152 s105D1=S105D1;
153 s102A1=S102A1;
154 s110A1=S110A1;
155 s108A1=S108A1;
156  
157 while(TRUE)
158 {
159 if(s105A1!=S105A1) {s105A1=S105A1; printf("S15A");}
160 if(r105A1U!=R105A1U) {r105A1U=R105A1U; printf("R15AU");}
161 if(r105A1D!=R105A1D) {r105A1D=R105A1D; printf("R15AD");}
162 if(!S105B1) {output_low(OS105B);} else {output_high(OS105B);}
163 if(!S105C1) {output_low(OS105C);} else {output_high(OS105C);}
164 if(s105D1!=S105D1) {s105D1=S105D1; printf("S15D");}
165  
166 if(s104A1!=S104A1) {s104A1=S104A1; printf("S14A");}
167 if(r104A1U!=R104A1U) {r104A1U=R104A1U; printf("R14AU");}
168 if(r104A1D!=R104A1D) {r104A1D=R104A1D; printf("R14AD");}
169 if(r104B1U!=R104B1U) {r104B1U=R104B1U; printf("R14BU");}
170 if(r104B1D!=R104B1D) {r104B1D=R104B1D; printf("R14BD");}
171  
172 if(s103A1!=S103A1) {s103A1=S103A1; printf("S13A");}
173 if(s103A2!=S103A2) {s103A2=S103A2; printf("S13A");}
174 if(s103A3!=S103A3) {s103A3=S103A3; printf("S13A");}
175 if(r103A1U!=R103A1U) {r103A1U=R103A1U; printf("R13AU");}
176 if(r103A1D!=R103A1D) {r103A1D=R103A1D; printf("R13AD");}
177  
178 if(s106A1!=S106A1) {s106A1=S106A1; printf("S16A");}
179 if(s107A2!=S107A2) {s107A2=S107A2; printf("S17A");}
180 if(s109A1!=S109A1) {s109A1=S109A1; printf("S19A");}
181  
182 if(s101A1!=S101A1) {s101A1=S101A1; printf("S11A");}
183 if(s101A2!=S101A2) {s101A2=S101A2; printf("S11A");}
184  
185 if(s102A1!=S102A1) {s102A1=S102A1; printf("S12A");}
186 if(s110A1!=S110A1) {s110A1=S110A1; printf("S1aA");}
187 if(s108A1!=S108A1) {s108A1=S108A1; printf("S18A");}
188  
189 output_toggle(LED1);
190 delay_ms(100);
191 }
192 }