zondag 22 april 2018

Updated source for SERVO.ASM

Will Collier has updated the source code for my servo controller (described in my post here). It should now be able to reach its full range.

maandag 9 april 2018

PS/2 keyboard to MIDI translation

In 2011 I made a PS/2 keyboard to MIDI converter. It came with a sample source code, but this source code had some issues as it was originally meant for a regular keyboard read, not one that is MIDI specific. So at the encouragement of Oscar I wrote a better version of the source code that has the following additional features:

  • It allows mapping of every key on the keyboard using two tables, one for the regular keys (BaseKeyboard) and one for the keys whose scan codes start with 0xE0 (SuperfluousKeyboard). Setting a key is as simple as giving it a note (1-127).
  • It removes the auto repeat that some keyboards have that could create notes with an annoying echo.
  • It allows assigning of MIDI CC messages. This is done by adding 128 to the channel you wish the CC message to be sent over. By default it will send key presses with 127 and releases with 0. This can be changed globally, but not per CC.
  • It has various fixes that make the code run smoother and be less error prone.
The source code is available here. Remember to keep the spacing intact, as otherwise the file may not compile. It is intended for a PIC16F690. The wiring is described at the top, and in the original article.

The biggest flaw so far is that upon startup it sends a few random MIDI sequences out, because the keyboard sends its start up sequence to the PICmicro. This can be avoided by mapping those specific keys to 0, or by adding a startup delay.