برمجة المتحكمات الميكروية باستخدام ميكرو سي 8.2 — الصفحة ٤٨٤

مشاريع تطبيقية بسيطة unsigned char getkeypad () unsigned char i, Key = 0; PORTB= 0x01; while ((PORTB & Mask) { 0) PORTB – (PORTB << 1); Key++; if (Key { == 4) PORTB = 0x01; Key = 0; } Delay_ms (20); for(i=0x10; i !=0; i <<=1) { if ((PORTB & i) != 0) break; Key = Key + 4; } PORTB=0x0F; while ((PORTB & Mask) != 0); Delay_ms (20); return (Key); } الفصل الرابع والعشرون void main() { unsigned char MyKey, i,j,Lcd[5], Op [12]; unsigned long Calc, Op1, Op2; TRISC = 0; TRISB = 0XF0; Lcd Init(&PORTC); Lcd Cmd (LCD_CLEAR); Lcd Out (1,1, "Calculator"); Delay_ms (2000); Lcd Cmd (LCD_CLEAR); - 484
ص ٤٨٤

النص مستخرج آليًّا من صور الكتاب، وقد يقع فيه خطأ.