History
The first idea was only to control GPIO of the PIC to read digital data (like as parallel port) or control devices (by set on or off it's GPIO) using the 18F2550 built in USB module configures as CDC, but then I want more than that, with a PIC capable of PWM, ADC, Analog comparation, SPI, I2C, USART and voltage reference output it woud be a waste to use only GPIO.
So I want to USB HID inestead, why? well no drivers are needed in any OS, and I want to try something new. First was to configure the USB a HID gamepad and read the data sent, but that was too limiting so I opted for USB HID Custom device, Microchip MLA has a demo for that and I decided to reuse it, with USB HID custom you have 64 bytes per transmission/reception to use for what you want. With this I implement "functional blocks" in firmware that do simple things like configure pheripherals, read the contents of special function registers and send back to Host, read ADC convertions, turn on PWM, etc. by the side of C# I implemented a series of methods that controls all the functional blocks in the firmware of the PIC.
In the end I created two C# class files one to find the device, send data to or retrive data from the PIC and the other have all the methods that control the functional blocks in the firmware of the PIC:
- AccessB_class.cs (contains all the methods to configure and use the peripherals)
- AccessB_winusbapi.cs (containts the methods to find and send/retrive data from the PIC)
- One firmware file for the PIC 18F2550, and a simple PCB desing files in Eagle.
Make your own tools.
AccessB is a very versatile tool, using visual studio and the peripherals of the PIC you can make a tool that meets you needs, a simple SPI/I2C memory dumper, create a GUI to control complex process (using AccessB to interface with electronics devices), Parallel IO for you PC, as the data is processed by the Host, you can retrive data from analog sensors process it with the application (PID control) and take actions with the GPIO, PWM or sending orders to others devices I2C, SPI, USART.
Knowledge is power
Yes you will need to know about Visual studio C# and the internals of the PIC at least have a copy of the datasheet but that isn't a real problem. I had declared all the SFR of the 18F2550 in the class and mapped all the bits from almost all SFR so you can access the SFR using his name, I also defined configurations for the peripherals to ease the task of configuration. Look at some of the simple examples to see how AccessB works.
Manufacturer Tools isn't bad as you think.
All the firmware project is created with MPLABX XC8 and it's based on MLA USB HID Device Custom, and the software class files are made in Visual Studio 2012
Simple Hardware
No special parts are needed, yes In my design I use PIC18F2550 in SOIC package but you can use the PDIP version without problems, you only need a programmer compatible with PIC18F2550. If you need more I/O or peripherals then you can adapt the firmware to work with the bigger version 18F4550 (but you need to add the extra SFR in the class files).
How to see it?
Well AccessB along with the class files allows you to "use" the Board like the PIC18F2550 itself, you will have access to all SFR, if you are familiar with these PIC family you will be using AccessB without problems, and if you never used that PIC in that case there are some configuration macros included to easy the configuration process. AccessB isn't designed to spy communication buses or using it like a logic analyzer, is designed to use as a extension of the PC bringing access to parallel I/O, ADC with 10 multiplexed channels, I2C, SPI, etc. that you can use to communicate with electronic stuff.
Development phase
At this time, the project is on development, for that reason all the firmware code is like spaguetti and with spanish comments, but I will put some order in the code when I finish. In other hand, this is a tool that I want to reuse in a lot of projects that I have in mind, but for now the only...
Read more »
So, where are the files?