Rev Author Line No. Line
1746 kakl 1 #include "main.h"
2  
3 #case
4  
5 #define S105A1 input(PIN_A0)
1747 kakl 6 #define R110A1U input(PIN_A1)
7 #define R110A1D input(PIN_A2)
1746 kakl 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;
1747 kakl 92 int1 r110A1U;
93 int1 r110A1D;
1746 kakl 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  
1747 kakl 116 #define send(s) \
117 {\
118 printf("%s\r\n",#s);\
119 output_toggle(LED1);\
120 delay_ms(100);\
121 }
122  
1746 kakl 123 void main()
124 {
125  
126 setup_adc_ports(NO_ANALOGS|VSS_VDD);
127 setup_adc(ADC_CLOCK_DIV_2);
128 setup_psp(PSP_DISABLED);
129 setup_spi(SPI_SS_DISABLED);
130 setup_wdt(WDT_OFF);
131 setup_timer_0(RTCC_INTERNAL);
132 setup_timer_1(T1_DISABLED);
133 setup_timer_2(T2_DISABLED,0,1);
134 setup_timer_3(T3_DISABLED|T3_DIV_BY_1);
135 setup_ccp1(CCP_OFF);
136 setup_comparator(NC_NC_NC_NC);
137 setup_vref(FALSE);
138  
139 s105A1=S105A1;
1747 kakl 140 r110A1U=R110A1U;
141 r110A1D=R110A1D;
1746 kakl 142 s104A1=S104A1;
143 r104A1U=R104A1U;
144 r104A1D=R104A1D;
145 r104B1U=R104B1U;
146 r104B1D=R104B1D;
147  
148 s103A1=S103A1;
149 s103A2=S103A2;
150 s103A3=S103A3;
151 r103A1U=R103A1U;
152 r103A1D=R103A1D;
153 s106A1=S106A1;
154 s107A2=S107A2;
155 s109A1=S109A1;
156  
157 s101A1=S101A1;
158 s101A2=S101A2;
159 s105D1=S105D1;
160 s102A1=S102A1;
161 s110A1=S110A1;
162 s108A1=S108A1;
163  
164 while(TRUE)
165 {
1747 kakl 166 if(s105A1!=S105A1) {s105A1=S105A1; send(S15A);}
167 if(r110A1U!=R110A1U) {r110A1U=R110A1U; send(R1aAU);}
168 if(r110A1D!=R110A1D) {r110A1D=R110A1D; send(R1aAD);}
1746 kakl 169 if(!S105B1) {output_low(OS105B);} else {output_high(OS105B);}
170 if(!S105C1) {output_low(OS105C);} else {output_high(OS105C);}
1747 kakl 171 if(s105D1!=S105D1) {s105D1=S105D1; send(S15D);}
1746 kakl 172  
1747 kakl 173 if(s104A1!=S104A1) {s104A1=S104A1; send(S14A);}
174 if(r104A1U!=R104A1U) {r104A1U=R104A1U; send(R14AU);}
175 if(r104A1D!=R104A1D) {r104A1D=R104A1D; send(R14AD);}
176 if(r104B1U!=R104B1U) {r104B1U=R104B1U; send(R14BU);}
177 if(r104B1D!=R104B1D) {r104B1D=R104B1D; send(R14BD);}
1746 kakl 178  
1747 kakl 179 if(s103A1!=S103A1) {s103A1=S103A1; send(S13A);}
180 if(s103A2!=S103A2) {s103A2=S103A2; send(S13A);}
181 if(s103A3!=S103A3) {s103A3=S103A3; send(S13A);}
182 if(r103A1U!=R103A1U) {r103A1U=R103A1U; send(R13AU);}
183 if(r103A1D!=R103A1D) {r103A1D=R103A1D; send(R13AD);}
1746 kakl 184  
1747 kakl 185 if(s106A1!=S106A1) {s106A1=S106A1; send(S16A);}
186 if(s107A2!=S107A2) {s107A2=S107A2; send(S17A);}
187 if(s109A1!=S109A1) {s109A1=S109A1; send(S19A);}
1746 kakl 188  
1747 kakl 189 if(s101A1!=S101A1) {s101A1=S101A1; send(S11A);}
190 if(s101A2!=S101A2) {s101A2=S101A2; send(S11A);}
1746 kakl 191  
1747 kakl 192 if(s102A1!=S102A1) {s102A1=S102A1; send(S12A);}
193 if(s110A1!=S110A1) {s110A1=S110A1; send(S1aA);}
194 if(s108A1!=S108A1) {s108A1=S108A1; send(S18A);}
1746 kakl 195 }
196 }