Summary:
For the Atmel AVR microcontroller, write a PS/2 keyboard host routine in assembler so that I can turn on and off the LEDs on the PS/2 keyboard. The assembler routine needs to be setup as a library for the BASCOM BASIC compiler. This BASIC compiler can be downloaded free from <[login to view URL]>. I am not familiar with AVR assembler, I do all of my programming from BASIC, that is why I need this routine as a BASCOM library.
## Deliverables
1) Complete and fully-functional working program(s) in executable form as well as complete source code of all work done.
2) Deliverables must be in ready-to-run condition, as follows (depending on the nature of the deliverables):
a) For web sites or other server-side deliverables intended to only ever exist in one place in the Buyer's environment--Deliverables must be installed by the Seller in ready-to-run condition in the Buyer's environment.
b) For all others including desktop software or software the buyer intends to distribute: A software installation package that will install the software in ready-to-run condition on the platform(s) specified in this bid request.
3) All deliverables will be considered "work made for hire" under U.S. Copyright law. Buyer will receive exclusive and complete copyrights to all work purchased. (No GPL, GNU, 3rd party components, etc. unless all copyright ramifications are explained AND AGREED TO by the buyer on the site per the coder's Seller Legal Agreement).
BACKGROUND
For those not familiar with BASCOM, BASCOM already has two PS/2 keyboard related libraries right now:
1 The first one is to read keyboard data from a PS/2 keyboard that is attached to an AVR:
CONFIG KEYBOARD = PINX.y , DATA = PINX.y , KEYDATA = table
var = GETATKBD()
var = GETATKBDRAW()
2. The second one is for AVR to emulate a PS/2 keyboard when it is hooked up to a desktop computer's keyboard port:
CONFIG PS2EMU= int , DATA = data, CLOCK=clock
SENDSCAN label
(Note, this library is sold separately and is not in the standard BASCOM library, see attached page from MSC website:
PS2_AT Mouse and Keyboard Emul - MCS [login to view URL]).
What BASCOM is lacking is a PS/2 host routine (emulate a desktop computer) to issue commands to the keyboard such as reset the PS/2 keyboard, initialize it, turn on the Num Lock and Caps Lock LEDs, etc.
There are several PS/2 host source codes available on the internet but they are not written in AVR assembler and I am just NOT familiar with AVR assembler to do this programming myself. I have done quite a bit of searches on the PS/2 host control and programming and I have attached them here to save you time in searching, I think all you need to know to do the work are attached in the enclosed Zip file:
1. Interfacing the PC's [login to view URL] (document explaining the PS/2 protocol)
2. [login to view URL] (source code of the above code for 68HC705J1A)
3. PS_2 Mouse_Keyboard Protocol - [login to view URL] (good explaination of PS/2 protocol)
4. Interfacing the PC's [login to view URL] (more detailed explaination of PS/2 protocol)
5. 8052_com SBC - PS_2 Keyboard for [login to view URL] (documentation and source code with the PS/2 host routine)
6. AT Keyboard Interface V2_04 for Microchip PIC16F84 [login to view URL] (documentation and source code for PIC with PS/2 host routine)
So the end result I am looking is a library routine that can be integrated with BASCOM to act as a Host to send commands to keyboard and receive responses back from the keyboard. The format of the new librarycould be something like:
CONFIG PS2HOST= int , DATA = data, CLOCK=clock
SENDCOMMAND xx, args...
where xx are the Host to Keboard commands such as F0-FF, EE, ED. Some args need to pass to the keyboard while some results needs to come back from the keyboard so please suggest how to best handle this bidirectional flow of command and response data. Note that when I am not sending host commands to the keyboard, I will be using the GETATKBD() routine in BASCOM to read keyboard so your library must co-exists with the GETATKBD without conflict.
I have two thoughts on the approach, one is that I can buy the PS2EMU program from MCS and you can simply modify it to turn it into PS/2 host because the communication protocols between sending ad receiving are quite similar. According to Mark at MCS, the source code is supplied if I purchase the PS2EMU. Alternatively, if you are comfortable to write it yourself by translating code examples given above, that is fine also.
Please tell me which approach will be better and faster! :-) Thank you!
Regards,
Ron Hu
## Platform
BASCOM compiler
AVR micro (I am currently using ATMEGA162)
Please hook up a PS/2 to your AVR micro to test that your routine actually works.