I have made some progress on the Open8055 project.
It still needs MinGW and MSys to compile the interface library, sorry. But I have added the beginning of a VC++ 2008 demo. And it is actually working with the MinGW compiled interface library, so there is a bit of a silver lining for all you windows folks.
What I have so far:
[ul][li]The code base supports both boards (P8055-1 and P8055N-2).[/li]
[li]The code supports two Microchip PICs. The PIC18F2550 and its designated replacement, the PIC18F25K50.[/li]
[li]To use the PIC18F2550 on a P8055-1, the crystal must be replaced with a 4 MHz one and R35 removed.[/li]
[li]To use the PIC18F25K50 on a P8055-1, only R35 must be removed.[/li]
[li]Both chips work with no modifications on a P8055N-2.[/li]
[li]The interface library works on Win32 and FreeBSD (possibly Linux too).[/li]
[li]I got rid of threads in the interface library. It uses OVERLAPPED IO under Windows and the libusb asynchronous features under Unix.[/li]
[li]A command line utility works under Win32 and FreeBSD and is able to access all current card functionality.[/li]
[li]A rudimentary VC++ 2008 Demo application can display the 5 digital inputs. This means the MinGW compiled interface library can be used with Visual Studio.[/li]
[li]The firmware at this point has little more than the original K8055(N) features: [list][]2 Analog inputs (10 bits resolution)[/li][li]5 digital inputs with counters and debounce feature in 0.1 millisecond increments from 0.0 to 5000.0[/li][li]8 digital outputs[/li][li]2 PWM outputs (10 bits resolution).[/li][/ul][/:m]
[li]The PWM frequency has changed to 47kHz. This should not be much of a problem. A future configuration setting could reenable the original PWM frequency, but only at 9 bits resolution.[/li]
[li]At a debounce setting of 0.0ms, the 5 digital counters can safely keep up with a 2 kHz square wave input signal. That is good enough to measure RPMs up to 120,000. The “frequency” feature for digital inputs will be back soon.[/li][/list:u]
The github repository for this new code base is here: github.com/wieck/open8055
Any questions?
Pushed a new version of the VC++ 2008 demo. It now shows the counters, supports reset and debounce. No outputs yet …
The demo now works with ADC, digital inputs, counters, debouncing, digital outputs and PWM.
I wonder if anyone out there is actually able to work off the github repository with the source code, or if I need to provide binaries instead.
The next steps will be to get the frequency counter mode for digital inputs and the servo control mode for digital outputs.
What would other members here like to see?
I have merged the frequency counter code into the new code base. Digital inputs can again be used as frequency counters. In this mode, the Open8055 forces the visible state of a digital input to be off all the time and instead updates the counter of the input once every second with the number of input signals received.
I have tested this functionality successfully with a signal generator up to 2 kHz. Since the controller’s main loop only executes about 7,000 times per second, the implementation will not work for frequencies above 3 kHz anyway. But frequencies of 2 kHz and below are rather accurate when using a debounce delay of 0.1 ms.
Next I’m going to try to lift the Servo control functionality from the old code and after that maybe play with the EEPROM save features.
Updated instructions on how to use all this are here: jannicash.info/k8055/
Servo control on the digital outputs is finally back. The Open8055 can again control up to 8 standard hobby servos with its digital outputs. This obsoletes the old code base.
A much bigger change though, which has happened a few commits ago, is that the Open8055 firmware will never send any HID report, unless some input data has actually changed or explicitly instructed by the host. Because of this the interface library (libopen8055) now uses asynchronous IO to receive updates. Under Windows this is known as OVERLAPPED IO.
Accordingly the VC_2008 demo is no longer using a timer, but a BackgroundWorker instead. The BackgroundWorker thread will basically do nothing, unless some input change is reported from the card. And all it does at that point is to use the ReportProgress event to inform the main thread that it has to update the input values.
Waiting for input changes has a timeout feature, so it is not necessary to use multi threading in simple programs. Waiting for 1 millisecond, then continuing with the last known data if nothing has changed, is functionally identical to a blocking read from a card, that sends redundant data every millisecond.
With that the Open8055 firmware and client library offer the following functionality:
[ul][li]5 digital inputs with counters. The inputs have a debounce feature that can be set in 0.1 ms increments from 0.0 to 5000.0 ms.[/li]
[li]The 5 digital inputs have an alternate mode for frequency counting. In this mode the ON/OFF state of the input is not reported. The counter is only reported once per second and automatically reset. This feature can measure frequencies up to 4 kHz and can be used in connection with debouncing.[/li]
[li]2 analog inputs with 8, 9 or 10 bit resolution.[/li]
[li]2 PWM outputs with 10 bit resolution at 47 kHz.[/li]
[li]8 digital outputs.[/li]
[li]The 8 digital outputs can be used to drive standard hobby servos with 40 pulses of 500…2500 microseconds.[/li][/ul]
A zip archive of the most up to date source code can be downloaded here: github.com/wieck/open8055/archive/master.zip