Paz 'vako, ona pljucka na plocici za tastaturu je neka podvarijanta 874x mikrokontrolera (imam negde jedan sa prozorcetom za UV briskanje) koji je skenirao matricu i slao XT/AT varijante Scan kodova preko PS/2 port-a (mini DIN-5) ili klasicnog DIN-5 porta (sto ti jedno te isto). Ako bas hoces, napravi sa tvojim omiljenim kontrolerom skeniranje redova/kolona, prouci PS/2 tastaturu i resio si problem.
Mada, koliko sam ja uklavirio, ti bi da imitiras pritisnut taster u matrici koju kontrolise neki 874x
Sve u svemu, turis jednu stanovitu kolicinu Reed-ova i simuliras svoje klaparanje po tastaturi - napravis svoju matricu da bi simulirao tastatursku matricu. Ne vidim nikakvu logiku u tome. Nisam siguran, al' trebalo bi da bude nekih primera na MikroE sajtu a propos PS/2 (imaju to oni na razvojnim sistemima).
Evo i neki demo program
Code:
/*
* Project name:
PS2 (Demonstration on using mikroC's PS/2 keyboard library)
* Copyright:
(c) MikroElektronika, 2009.
* Revision History:
20080930:
- initial release;
- 20090818 - Slavisa Zlatanovic;
* Description:
In this example, key(s) pressed on the PS/2 keyboard are read and transferred
to PC through serial port connection. Various basic keyboard activities are
tested: "normal" keys, keys with <Shift> pressed, keys with <Caps Lock>
pressed, numerical keypad ON/OFF and keys. The result is visible on PC, via
USART Terminal tool.
* Test configuration:
MCU: ATmega16
http://www.atmel.com/dyn/resources/prod_documents/doc2466.pdf
Dev.Board: EasyAVR6
http://www.mikroe.com/en/tools/easyavr6/
Oscillator: External, 8.0000 MHz
Ext. Modules: PS/2 standard 101-keys keyboard
SW: mikroC PRO for AVR
http://www.mikroe.com/en/compilers/mikroc/avr/
* NOTES:
- Some keyboards with various multimedia attachments on them (especially the
cheap ones) tend to "choke" the communication by constantly sending
requests on various multimedia object's status (volume, mouse pos. etc.).
This may slow down the communication pace with the MCU.
- LEDs off and pull-ups on PORTC may be required.
- RX and TX UART switches on EasyAVR6 should be turned ON(SW9.2 and SW9.5).
*/
unsigned short keydata = 0, special = 0, down = 0;
sbit PS2_Data at PINC.B0;
sbit PS2_Clock_Input at PINC.B1;
sbit PS2_Clock_Output at PORTC.B1;
sbit PS2_Data_Direction at DDRC.B0;
sbit PS2_Clock_Direction at DDRC.B1;
void main() {
UART1_Init(19200); // Initialize UART module at 19200 bps
Ps2_Config(); // Init PS/2 Keyboard
Delay_ms(100); // Wait for keyboard to finish
UART1_Write('R'); // Ready
do {
if (Ps2_Key_Read(&keydata, &special, &down)) {
if (down && (keydata == 16)) { // Backspace
UART1_Write(0x08);
}
else if (down && (keydata == 13)) { // Enter
UART1_Write('\r'); // Send carriage return to usart terminal
//Usart_Write('\n'); // Uncomment this line if usart terminal also expects line feed
// for new line transition
}
else if (down && !special && keydata) {
UART1_Write(keydata);
}
}
Delay_ms(10); // Debounce
} while (1);
}
[Ovu poruku je menjao Sepa011 dana 27.05.2011. u 20:50 GMT+1]