slacx 0 Report post Posted January 9, 2008 Salam semua,aku sekarang tgh pening kepala camne nak bg switch yg ada kat board STK500 tu utk jd input nombor dan outputnye ke LCD STK502. Dah mcm2 cara aku try tp tak jadi. Aku bole buat switch(input) n increase kan turutan LED(output) but nak increase n decrease kan nombor pastu outputkan nye kt LCD mmg aku xdpat. Korang pahamke ape yg aku terang ni? Kalau tak paham nnt aku terangkan lg..Btw, ni code untuk ouput LEDint main(void) { DDRA = 0x00; //* All pins as input PORTA= 0x00; //* no pull-up on pins DDRB = 0xFF; //* All pins as output PORTB = 0xFF; //* All leds off (STK500) unsigned char count = 0xFF; char key_pressed = 0; while(1){ if (!(PINA & 0x01) && !key_pressed){ key_pressed = 1; PORTB = count; --count; } else if (PINA & 0x01){ key_pressed = 0; } if (count < 1) count = 0xFF; } return 0; } Sesape yg idea cmne nak tuka code ni supaya boleh kluar ke LCD? Quote Share this post Link to post Share on other sites