K8055M (modified PIC18F) Feature Wish List

The K8055M Open Source Project is at this point emulating everything, the original PIC16C745 did. So far, so good.

I would like to get input and collect some kind of feature wish list. Having an 18F PIC running on the board is like having a hybrid. It is still a USB interface board. But it is also a microcontroller experiment board. So we could offload parts of some complex tasks, that are impossible to implement via HID USB protocol, more or less to the PIC.

The following wish list will be updated, as this thread progresses.

[ul][li]Use Digital Input as frequency counter
At this point, the main loop of the PIC is still capable of running in under 100 microseconds. This means it can reliably maintain counters at up to 2 kHz speed. The problem is that this causes a flood of HID protocol packets, that are relatively useless. I propose to be able to switch a digital channel to a different mode, where it stops reporting on/off status changes and its “counter” represents the current frequency in Hz. This frequency will be counted inside the PIC and reported to the PC every second.

[/li]
[li]Use Digital Output to control a standard servo motor
Standard Servo Motors, like those used in hobby RC models, use a PWM protocol to control their angular position. A pulse between 1.0 and 2.0 milliseconds long, send up to 40 times per second, represents “full counter clockwise” to “full clockwise”. With the HID USB communication it is impossible to switch the ports fast enough to do that.

[/li]
[li]Register a callback function to signal input state changes
In the current implementation, the application has to call k8055m_poll() or read inputs in timed intervals to notice input state changes. Add the ability to register a callback function that the library will call, whenever any input state data has changed.

[/li]
[li]Saving power-up and reset default settings
The 256 bytes of EEprom memory should be more than enough to store all configuration settings and output values and use them at power on and when the reset command is issued. Since the data sheet claims that the EEprom area is only good for about one million write cycles, it is not a good idea to automatically store the information on every change of a port setting. An explicit API function k8055m_save_config() would be more appropriate.[/li][/ul]

Prototype Servo-Control

If you are into robotics, this is for you!

I succeeded in prototyping some interrupt driven servo-control code into a test branch of the firmware. This prototype code is currently hijacking the PWM1 output value as control input for proof of concept. An actual HID protocol implementation and associated library functions need to be written. No problems expected there.

Once the 1.0 version is released, I will merge this functionality into master and upload a new devel snapshot.

The prototype proves that this implementation can control up to 8 standard servos independently through the 8 digital output channels at 10 bit resolution. It is entirely interrupt driven and does not seem to interfere with any of the other functionality. It needs minimal control input from the PC. One control message sets the desired angular position of the servo and the K8055M will maintain the required pulse width until instructed otherwise. Very similar to a PWM output. The standard servo protocol is just slow enough to be implemented using PIC18 interrupts.

I used a real RC hobby servo for testing. A Futaba FUTM0031 S3003 standard servo. Apparently this particular model likes 0.5 to 2.5 ms pulses to control a range of 180 degrees total movement. That was a bit of a surprise to me because everything about servo control, I found on the Internet, said they expect 1.0 to 2.0 ms pulses. So much for the Interwebs telling the truth. Anyhow, the K8055M is driving it at 40 Hz and it is moving absolutely smooth and precise.

The 8 ports (those used for servo control) are triggered in an interlaced fashion, all at 40 Hz. The oscilloscope snapshot below shows, how the signals of 4 adjacent channels (all at full 2.5 ms pulse width) line up and also demonstrates, how well the K8055M can do this. The card was actually driving all 8 channels at full pulse width at that time.