00001
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042 #include <conio.h>
00043 #include <mem.h>
00044
00045 #ifdef CONF_CONIO
00046
00048
00049
00050
00052
00054
00055 const char hex_display_codes[] =
00056 {
00057 0x7e,
00058 0x42,
00059 0x37,
00060 0x67,
00061 0x4b,
00062 0x6d,
00063 0x7d,
00064 0x46,
00065 0x7f,
00066 0x6f,
00067 0x5f,
00068 0x79,
00069 0x31,
00070 0x73,
00071 0x3d,
00072 0x1d,
00073 };
00074
00075 #ifdef CONF_ASCII
00076
00078
00080 const char ascii_display_codes[] =
00081 {
00082 0x00, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
00083 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
00084 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
00085 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
00086
00087 0x00,
00088 0x42,
00089 0x0a,
00090 0x7b,
00091 0x6d,
00092 0x13,
00093 0x7d,
00094 0x08,
00095 0x3c,
00096 0x66,
00097 0x5b,
00098 0x43,
00099 0x10,
00100 0x01,
00101 0x10,
00102 0x13,
00103
00104 0x7e,
00105 0x42,
00106 0x37,
00107 0x67,
00108 0x4b,
00109 0x6d,
00110 0x7d,
00111 0x46,
00112 0x7f,
00113 0x6f,
00114
00115 0x21,
00116 0x21,
00117 0x31,
00118 0x21,
00119 0x61,
00120 0x17,
00121 0x3f,
00122
00123 0x5f,
00124 0x79,
00125 0x3c,
00126 0x73,
00127 0x3d,
00128 0x1d,
00129 0x7c,
00130 0x5b,
00131 0x42,
00132 0x62,
00133 0x5b,
00134 0x38,
00135 0x5e,
00136 0x5e,
00137 0x7e,
00138 0x1f,
00139 0x4f,
00140 0x11,
00141 0x6d,
00142 0x46,
00143 0x7a,
00144 0x7a,
00145 0x7a,
00146 0x5b,
00147 0x6b,
00148 0x37,
00149
00150 0x3c,
00151 0x49,
00152 0x66,
00153 0x0e,
00154 0x20,
00155 0x02,
00156
00157 0x5f,
00158 0x79,
00159 0x31,
00160 0x73,
00161 0x3d,
00162 0x1d,
00163 0x7c,
00164 0x59,
00165 0x42,
00166 0x62,
00167 0x5b,
00168 0x38,
00169 0x51,
00170 0x51,
00171 0x71,
00172 0x1f,
00173 0x4f,
00174 0x11,
00175 0x6d,
00176 0x39,
00177 0x70,
00178 0x70,
00179 0x70,
00180 0x5b,
00181 0x6b,
00182 0x37,
00183
00184 0x3c,
00185 0x18,
00186 0x66,
00187 0x0e,
00188 0x00
00189 };
00190
00191 #endif // CONF_ASCII
00192
00194
00195
00196
00198
00199 #endif // CONF_CONIO
00200
00202
00204 void delay(unsigned ms)
00205 {
00206 unsigned i;
00207
00208 while (ms-- > 0)
00209 for (i = 0; i < 600; i++)
00210 ;
00211
00212 }
00213
00214 #ifdef CONF_CONIO
00215
00217
00222 void cputc_native(char mask, int pos)
00223 {
00224 switch (pos) {
00225 case 0:
00226 cputc_native_0(mask);
00227 break;
00228 case 1:
00229 cputc_native_1(mask);
00230 break;
00231 case 2:
00232 cputc_native_2(mask);
00233 break;
00234 case 3:
00235 cputc_native_3(mask);
00236 break;
00237 case 4:
00238 cputc_native_4(mask);
00239 break;
00240 case 5:
00241 cputc_native_5(mask);
00242 }
00243 }
00244
00246
00248 void cputc_native_0(char mask)
00249 {
00250
00251
00252
00253
00254 bit_load(mask, 0x2);
00255 dlcd_store(LCD_0_TOP);
00256 bit_load(mask, 0x0);
00257 dlcd_store(LCD_0_MID);
00258 bit_load(mask, 0x5);
00259 dlcd_store(LCD_0_BOT);
00260 bit_load(mask, 0x1);
00261 dlcd_store(LCD_0_TOPR);
00262 bit_load(mask, 0x6);
00263 dlcd_store(LCD_0_BOTR);
00264 bit_load(mask, 0x3);
00265 dlcd_store(LCD_0_TOPL);
00266 bit_load(mask, 0x4);
00267 dlcd_store(LCD_0_BOTL);
00268 }
00269
00271
00273 void cputc_native_1(char mask)
00274 {
00275 bit_load(mask, 0x2);
00276 dlcd_store(LCD_1_TOP);
00277 bit_load(mask, 0x0);
00278 dlcd_store(LCD_1_MID);
00279 bit_load(mask, 0x5);
00280 dlcd_store(LCD_1_BOT);
00281 bit_load(mask, 0x1);
00282 dlcd_store(LCD_1_TOPR);
00283 bit_load(mask, 0x6);
00284 dlcd_store(LCD_1_BOTR);
00285 bit_load(mask, 0x3);
00286 dlcd_store(LCD_1_TOPL);
00287 bit_load(mask, 0x4);
00288 dlcd_store(LCD_1_BOTL);
00289 }
00290
00292
00294 void cputc_native_2(char mask)
00295 {
00296 bit_load(mask, 0x2);
00297 dlcd_store(LCD_2_TOP);
00298 bit_load(mask, 0x0);
00299 dlcd_store(LCD_2_MID);
00300 bit_load(mask, 0x5);
00301 dlcd_store(LCD_2_BOT);
00302 dlcd_hide(LCD_2_DOT);
00303 bit_load(mask, 0x1);
00304 dlcd_store(LCD_2_TOPR);
00305 bit_load(mask, 0x6);
00306 dlcd_store(LCD_2_BOTR);
00307 bit_load(mask, 0x3);
00308 dlcd_store(LCD_2_TOPL);
00309 bit_load(mask, 0x4);
00310 dlcd_store(LCD_2_BOTL);
00311 }
00312
00314
00316 void cputc_native_3(char mask)
00317 {
00318 dlcd_hide(LCD_3_DOT);
00319 bit_load(mask, 0x2);
00320 dlcd_store(LCD_3_TOP);
00321 bit_load(mask, 0x0);
00322 dlcd_store(LCD_3_MID);
00323 bit_load(mask, 0x5);
00324 dlcd_store(LCD_3_BOT);
00325 bit_load(mask, 0x1);
00326 dlcd_store(LCD_3_TOPR);
00327 bit_load(mask, 0x6);
00328 dlcd_store(LCD_3_BOTR);
00329 bit_load(mask, 0x3);
00330 dlcd_store(LCD_3_TOPL);
00331 bit_load(mask, 0x4);
00332 dlcd_store(LCD_3_BOTL);
00333 }
00334
00336
00338 void cputc_native_4(char mask)
00339 {
00340 dlcd_hide(LCD_4_DOT);
00341 bit_load(mask, 0x2);
00342 dlcd_store(LCD_4_TOP);
00343 bit_load(mask, 0x0);
00344 dlcd_store(LCD_4_MID);
00345 bit_load(mask, 0x5);
00346 dlcd_store(LCD_4_BOT);
00347 bit_load(mask, 0x1);
00348 dlcd_store(LCD_4_TOPR);
00349 bit_load(mask, 0x6);
00350 dlcd_store(LCD_4_BOTR);
00351 bit_load(mask, 0x3);
00352 dlcd_store(LCD_4_TOPL);
00353 bit_load(mask, 0x4);
00354 dlcd_store(LCD_4_BOTL);
00355 }
00356
00358
00361 void cputc_native_5(char mask)
00362 {
00363 bit_load(mask, 0x0);
00364 dlcd_store(LCD_5_MID);
00365 }
00366
00368
00372 void cputw(unsigned word)
00373 {
00374 int i;
00375
00376 cputc_native(0, 5);
00377 for (i = 1; i <= 4; i++) {
00378 cputc_hex(word & 0x0f, i);
00379 word >>= 4;
00380 }
00381
00382 #if !defined(CONF_LCD_REFRESH)
00383 lcd_refresh();
00384 #endif
00385 }
00386
00387 #ifdef CONF_ASCII
00388
00390
00396 void cputs(char *s)
00397 {
00398 int i;
00399
00400 cputc_native(0, 5);
00401 for (i = 4; (*s) && (i >= 0);)
00402 cputc(*(s++), i--);
00403 while (i >= 1)
00404 cputc_native(0, i--);
00405
00406 #if !defined(CONF_LCD_REFRESH)
00407 lcd_refresh();
00408 #endif
00409 }
00410
00412 void cls() {
00413 cputs(" ");
00414 }
00415 #endif // CONF_ASCII
00416
00417 #endif // CONF_CONIO