aal
Guest
|
|
« Reply #2 on: April 04, 2008, 10:05:28 22:05 » |
|
#include <16F877.h> #device adc=10 #fuses HS,NOWDT,PROTECT,NOLVP #use delay(clock=20000000) //one instruction=0.2us #use rs232(baud=9600, xmit=PIN_c6, rcv=PIN_c7) #include <lcdtart.c> #define COLON_0 PIN_B0 #define COLON_1 PIN_B1 #define COLON_2 PIN_B2 #define COLON_3 PIN_B3 #define ROW_0 PIN_B4 #define ROW_1 PIN_B5 #define ROW_2 PIN_B6 #define ROW_3 PIN_B7 void colon0() { output_high(COLON_0); //delay_ms(100); if (input(ROW_0)) { //lcd_gotoxy( 1, 1); printf(lcd_putc,"7"); printf("7"); } else { if (input(ROW_1)) { //lcd_gotoxy( 1, 1); printf(lcd_putc,"8"); } else { if (input(ROW_2)) { //lcd_gotoxy( 1, 1); printf(lcd_putc,"9"); } else { if (input(PIN_B7)) { //lcd_gotoxy( 1, 1); printf(lcd_putc,"/"); } /*else { lcd_gotoxy( 1, 1); printf(lcd_putc," "); }*/ } } } output_low(COLON_0); } void colon1() { output_high(COLON_1); //delay_ms(100); if (input(ROW_0)) { //lcd_gotoxy( 1, 1); printf(lcd_putc,"4"); } else { if (input(ROW_1)) { //lcd_gotoxy( 1, 1); printf(lcd_putc,"5"); } else { if (input(ROW_2)) { //lcd_gotoxy( 1, 1); printf(lcd_putc,"6"); } else { if (input(PIN_B7)) { //lcd_gotoxy( 1, 1); printf(lcd_putc,"X"); } /*else { lcd_gotoxy( 1, 1); printf(lcd_putc," "); }*/ } } } output_low(COLON_1); } void colon2() { output_high(COLON_2); //delay_ms(100); if (input(ROW_0)) { //lcd_gotoxy( 1, 1); printf(lcd_putc,"1"); } else { if (input(ROW_1)) { //lcd_gotoxy( 1, 1); printf(lcd_putc,"2"); } else { if (input(ROW_2)) { //lcd_gotoxy( 1, 1); printf(lcd_putc,"3"); } else { if (input(PIN_B7)) { //lcd_gotoxy( 1, 1); printf(lcd_putc,"-"); } /*else { lcd_gotoxy( 1, 1); printf(lcd_putc," "); }*/ } } } output_low(COLON_2); } void colon3() { output_high(COLON_3); //delay_ms(100); if (input(ROW_0)) { lcd_gotoxy( 1, 1); //printf(lcd_putc,"C"); printf(lcd_putc," "); lcd_gotoxy( 1, 1); } else { if (input(ROW_1)) { //lcd_gotoxy( 1, 1); printf(lcd_putc,"0"); } else { if (input(ROW_2)) { //lcd_gotoxy( 1, 1); printf(lcd_putc,"="); } else { if (input(ROW_3)) { //lcd_gotoxy( 1, 1); printf(lcd_putc,"+"); } /*else { lcd_gotoxy( 1, 1); printf(lcd_putc," "); }*/ } } } output_low(COLON_3); } void main() { lcd_init(); lcd_gotoxy( 1, 1); while(true) { colon0(); colon1(); colon2(); colon3(); delay_ms(200); } }
|
|
|
Logged
|
|
|
|