Update (2010-05-19): schematic updated to reflect real circuit.
Since I could not manage to find a decent matrix keyboard plugin for Keil uVision, I’ve decided to develop one.
Internally, it responds to the following schematic:
It’s prepared to accept multiple key presses at once, so you can simulate a real world application:
First of all, you must install it on the Keil uVision and configure your project in order to use it while simulating. The plugin name, for the configuration, is MatrixKeyboard. You can follow this step by step guide.
Then, you must copy the MatrixKeyboard.ini file to your project and modify it to satisfy your needs. For example, given the following pin definitions:
sbit Keyboard_Scan_0 = P1^1; sbit Keyboard_Scan_1 = P1^2; sbit Keyboard_Scan_2 = P1^3; sbit Keyboard_Scan_3 = P1^4; sbit Keyboard_Return_0 = P1^5; sbit Keyboard_Return_1 = P1^6; sbit Keyboard_Return_2 = P1^7;
You could configure the INI file like this:
[Settings] ; All port addresses in hexadecimal ; Bits: 0-7 Scan0_Port_Address = 90 Scan0_Port_Bit = 1 Scan1_Port_Address = 90 Scan1_Port_Bit = 2 Scan2_Port_Address = 90 Scan2_Port_Bit = 3 Scan3_Port_Address = 90 Scan3_Port_Bit = 4 Return0_Port_Address = 90 Return0_Port_Bit = 5 Return1_Port_Address = 90 Return1_Port_Bit = 6 Return2_Port_Address = 90 Return2_Port_Bit = 7
If you don’t remember the port addresses, you can always check the header file corresponding to you microcontroller and look for a line like this:
sfr P1 = 0x90;
Well, that’s all. You can now run your project in simulation mode and open the plugin via Peripherals->Matrix Keyboard.
MatrixKeyboard is licensed under the GNU GPL v3 (attached)…
Finally, the downloads:
The source code proyect is done in Visual Studio 2008, but it can be easily adapted for other versions.
All the content offered in this website is, except noted otherwise, of free nature. This means you can share it wherever you want if you do it freely and stating its source.
If it was useful for you and you’d like to contribute, you can make a donation or, at least, visit one of our advertisers of your choice; they are all around the site.