Line 1... |
Line 1... |
1 |
#include "main.h" |
1 |
#include "main.h" |
2 |
|
2 |
|
3 |
#case |
3 |
#case |
4 |
|
4 |
|
5 |
#define S105A1 input(PIN_A0) |
5 |
#define S105A1 input(PIN_A0) |
6 |
#define R105A1U input(PIN_A1) |
6 |
#define R110A1U input(PIN_A1) |
7 |
#define R105A1D input(PIN_A2) |
7 |
#define R110A1D input(PIN_A2) |
8 |
#define S104A1 input(PIN_A3) |
8 |
#define S104A1 input(PIN_A3) |
9 |
#define R104A1U input(PIN_A4) |
9 |
#define R104A1U input(PIN_A4) |
10 |
#define R104A1D input(PIN_A5) |
10 |
#define R104A1D input(PIN_A5) |
11 |
#define R104B1U input(PIN_A6) |
11 |
#define R104B1U input(PIN_A6) |
12 |
#define R104B1D input(PIN_A7) |
12 |
#define R104B1D input(PIN_A7) |
Line 87... |
Line 87... |
87 |
|
87 |
|
88 |
#define LED1 PIN_J7 |
88 |
#define LED1 PIN_J7 |
89 |
#define LED2 PIN_J6 |
89 |
#define LED2 PIN_J6 |
90 |
|
90 |
|
91 |
int1 s105A1; |
91 |
int1 s105A1; |
92 |
int1 r105A1U; |
92 |
int1 r110A1U; |
93 |
int1 r105A1D; |
93 |
int1 r110A1D; |
94 |
int1 s104A1; |
94 |
int1 s104A1; |
95 |
int1 r104A1U; |
95 |
int1 r104A1U; |
96 |
int1 r104A1D; |
96 |
int1 r104A1D; |
97 |
int1 r104B1U; |
97 |
int1 r104B1U; |
98 |
int1 r104B1D; |
98 |
int1 r104B1D; |
Line 111... |
Line 111... |
111 |
int1 s105D1; |
111 |
int1 s105D1; |
112 |
int1 s102A1; |
112 |
int1 s102A1; |
113 |
int1 s110A1; |
113 |
int1 s110A1; |
114 |
int1 s108A1; |
114 |
int1 s108A1; |
115 |
|
115 |
|
- |
|
116 |
#define send(s) \ |
- |
|
117 |
{\ |
- |
|
118 |
printf("%s\r\n",#s);\ |
- |
|
119 |
output_toggle(LED1);\ |
- |
|
120 |
delay_ms(100);\ |
- |
|
121 |
} |
- |
|
122 |
|
116 |
void main() |
123 |
void main() |
117 |
{ |
124 |
{ |
118 |
|
125 |
|
119 |
setup_adc_ports(NO_ANALOGS|VSS_VDD); |
126 |
setup_adc_ports(NO_ANALOGS|VSS_VDD); |
120 |
setup_adc(ADC_CLOCK_DIV_2); |
127 |
setup_adc(ADC_CLOCK_DIV_2); |
Line 128... |
Line 135... |
128 |
setup_ccp1(CCP_OFF); |
135 |
setup_ccp1(CCP_OFF); |
129 |
setup_comparator(NC_NC_NC_NC); |
136 |
setup_comparator(NC_NC_NC_NC); |
130 |
setup_vref(FALSE); |
137 |
setup_vref(FALSE); |
131 |
|
138 |
|
132 |
s105A1=S105A1; |
139 |
s105A1=S105A1; |
133 |
r105A1U=R105A1U; |
140 |
r110A1U=R110A1U; |
134 |
r105A1D=R105A1D; |
141 |
r110A1D=R110A1D; |
135 |
s104A1=S104A1; |
142 |
s104A1=S104A1; |
136 |
r104A1U=R104A1U; |
143 |
r104A1U=R104A1U; |
137 |
r104A1D=R104A1D; |
144 |
r104A1D=R104A1D; |
138 |
r104B1U=R104B1U; |
145 |
r104B1U=R104B1U; |
139 |
r104B1D=R104B1D; |
146 |
r104B1D=R104B1D; |
Line 154... |
Line 161... |
154 |
s110A1=S110A1; |
161 |
s110A1=S110A1; |
155 |
s108A1=S108A1; |
162 |
s108A1=S108A1; |
156 |
|
163 |
|
157 |
while(TRUE) |
164 |
while(TRUE) |
158 |
{ |
165 |
{ |
159 |
if(s105A1!=S105A1) {s105A1=S105A1; printf("S15A");} |
166 |
if(s105A1!=S105A1) {s105A1=S105A1; send(S15A);} |
160 |
if(r105A1U!=R105A1U) {r105A1U=R105A1U; printf("R15AU");} |
167 |
if(r110A1U!=R110A1U) {r110A1U=R110A1U; send(R1aAU);} |
161 |
if(r105A1D!=R105A1D) {r105A1D=R105A1D; printf("R15AD");} |
168 |
if(r110A1D!=R110A1D) {r110A1D=R110A1D; send(R1aAD);} |
162 |
if(!S105B1) {output_low(OS105B);} else {output_high(OS105B);} |
169 |
if(!S105B1) {output_low(OS105B);} else {output_high(OS105B);} |
163 |
if(!S105C1) {output_low(OS105C);} else {output_high(OS105C);} |
170 |
if(!S105C1) {output_low(OS105C);} else {output_high(OS105C);} |
164 |
if(s105D1!=S105D1) {s105D1=S105D1; printf("S15D");} |
171 |
if(s105D1!=S105D1) {s105D1=S105D1; send(S15D);} |
165 |
|
172 |
|
166 |
if(s104A1!=S104A1) {s104A1=S104A1; printf("S14A");} |
173 |
if(s104A1!=S104A1) {s104A1=S104A1; send(S14A);} |
167 |
if(r104A1U!=R104A1U) {r104A1U=R104A1U; printf("R14AU");} |
174 |
if(r104A1U!=R104A1U) {r104A1U=R104A1U; send(R14AU);} |
168 |
if(r104A1D!=R104A1D) {r104A1D=R104A1D; printf("R14AD");} |
175 |
if(r104A1D!=R104A1D) {r104A1D=R104A1D; send(R14AD);} |
169 |
if(r104B1U!=R104B1U) {r104B1U=R104B1U; printf("R14BU");} |
176 |
if(r104B1U!=R104B1U) {r104B1U=R104B1U; send(R14BU);} |
170 |
if(r104B1D!=R104B1D) {r104B1D=R104B1D; printf("R14BD");} |
177 |
if(r104B1D!=R104B1D) {r104B1D=R104B1D; send(R14BD);} |
171 |
|
178 |
|
172 |
if(s103A1!=S103A1) {s103A1=S103A1; printf("S13A");} |
179 |
if(s103A1!=S103A1) {s103A1=S103A1; send(S13A);} |
173 |
if(s103A2!=S103A2) {s103A2=S103A2; printf("S13A");} |
180 |
if(s103A2!=S103A2) {s103A2=S103A2; send(S13A);} |
174 |
if(s103A3!=S103A3) {s103A3=S103A3; printf("S13A");} |
181 |
if(s103A3!=S103A3) {s103A3=S103A3; send(S13A);} |
175 |
if(r103A1U!=R103A1U) {r103A1U=R103A1U; printf("R13AU");} |
182 |
if(r103A1U!=R103A1U) {r103A1U=R103A1U; send(R13AU);} |
176 |
if(r103A1D!=R103A1D) {r103A1D=R103A1D; printf("R13AD");} |
183 |
if(r103A1D!=R103A1D) {r103A1D=R103A1D; send(R13AD);} |
177 |
|
184 |
|
178 |
if(s106A1!=S106A1) {s106A1=S106A1; printf("S16A");} |
185 |
if(s106A1!=S106A1) {s106A1=S106A1; send(S16A);} |
179 |
if(s107A2!=S107A2) {s107A2=S107A2; printf("S17A");} |
186 |
if(s107A2!=S107A2) {s107A2=S107A2; send(S17A);} |
180 |
if(s109A1!=S109A1) {s109A1=S109A1; printf("S19A");} |
187 |
if(s109A1!=S109A1) {s109A1=S109A1; send(S19A);} |
181 |
|
188 |
|
182 |
if(s101A1!=S101A1) {s101A1=S101A1; printf("S11A");} |
189 |
if(s101A1!=S101A1) {s101A1=S101A1; send(S11A);} |
183 |
if(s101A2!=S101A2) {s101A2=S101A2; printf("S11A");} |
190 |
if(s101A2!=S101A2) {s101A2=S101A2; send(S11A);} |
184 |
|
191 |
|
185 |
if(s102A1!=S102A1) {s102A1=S102A1; printf("S12A");} |
192 |
if(s102A1!=S102A1) {s102A1=S102A1; send(S12A);} |
186 |
if(s110A1!=S110A1) {s110A1=S110A1; printf("S1aA");} |
193 |
if(s110A1!=S110A1) {s110A1=S110A1; send(S1aA);} |
187 |
if(s108A1!=S108A1) {s108A1=S108A1; printf("S18A");} |
194 |
if(s108A1!=S108A1) {s108A1=S108A1; send(S18A);} |
188 |
|
- |
|
189 |
output_toggle(LED1); |
- |
|
190 |
delay_ms(100); |
- |
|
191 |
} |
195 |
} |
192 |
} |
196 |
} |