Just Code Challenge Week 6 Projects

In my real job, I do a fair bit of microprocessor work, mostly with PIC processors. Microchip Inc’s free MPLAB-X development IDE is very good, but if you need to run a simulation over and over again with different inputs, it gets cumbersome. So, I’ve developed a XOJO project with a set of methods that emulate the instruction set of the PIC “midrange” processor line. These methods have the same names as the corresponding PIC instruction mnemonics, and so the calling syntax is identical in all but a few minor cases. As a result, I can write PIC assembly language code in XOJO and run it in XOJO. Plus, I can add some outer XOJO looping code to call the emulated PIC code over and over with varying input parameter values to give it a thorough test.

This has been a big help in debugging some complex code. The example that I’ve submitted this week, uses emulated PIC assembly language to perform rectangular to polar conversion using Volder’s CORDIC algorithm. To see what the assembly language code looks like, look at the method Rect2Polar in the project file. For the internals of an emulated instruction, have a look at method “addwf” (add register without carry) as an example. Also refer to app.RevisionNotes in the project file for more info.

Project file is here:
PICsim Project