In the mean time I have been working on the software. Here I am using a Microchip Curiosity LPC Development board (P/N DM164137) with a PIC16F18326.
Most of the code came together rather quickly. As I mentioned in the previous posts, this PCB can use 4 different PICs (PIC16F18326, PIC16F18426, PIC18F06Q40 or PIC18F06Q40). My recent experience with lack of availability drove me to this. But I wanted one piece of firmware. Thus I have been experiencing the joy of #IFDEF.......#ENDIF. I have actually spent quite a bit time with the development board and two of the PICs building the app. Since these 4 PICs span a few years of introduction, the consistency on the peripheral naming is not great. I finally have the first two in the above list working at the 95% completion point, the other two are about at the %60 point. But the last two in the above list should come up quickly since most of the infrastructure is there. I will have to move to a newer XC8 compiler and newer version of MPLAB X, though to finish up with those newer PICs.
Just as an aside, sometime in the last few years, Tech Writing at Microchip under went some changes. The datasheets are laid out a little differently now. I am using PICs that have dedicated PWM controllers in addition to the normal CCP/PWM modules. On the PICs the CCPs are numbered 1 to 4 like normal. But the PWMs are number 5&6 on one PIC and 6&7 on another. The Timers names are different as are the UARTs. I ended up with lots of #IFDEF to handle this, including an additional system type 'h' file, because there was some circular reference driving the compiler to spit all kinds of weird errors.
Since this is an old fashion RS232 interface, I had to resurrect some very old code. For all of my PC LEGO control, I am trying to use one windows APP. In the USB HID world this proved to be quite easy since identification is built into the USB HID protocol. The WIN APP then just determines who just connected and adjust accordingly. Well plugging in an RS232 device that stuff doesn't happen. You have to code it. Integrating this into the existing code was not hard, just time consuming. Surprisingly some remnants of old RS232 interfaces were still present in some of the code. Dont think I have started form scratch in a long time.
I am fairly close to building a few and testing. While these do not have a remote control feature, in some cases hiding it in something small is advantageous.
No comments:
Post a Comment