Wednesday, April 2, 2014

MIDI2VC, Inline Assembly optimisation

I've been trying to use inline assembly to optimise the push and pop uart queue functions, since I still have some problems with overflowing of the UART reception.
 Even though the free version of XC8 seems to add some assembly instructions that doesn't do anything, it still seems to be doing a pretty good job. At least better than mine. When writing inline assembly, there are some precautions you need to take so that assembly code doesn't mess up what XC8 have been doing. This takes quite a bit of code to do, so it seems my try at optimisation wasn't that successful...
 In the end, learning assembly gives some insight into how the MCU works, so I still did some optimisation of the C code, by changing the queue to char's(8 bit), instead of int's(16bit).
 Right now it is quite difficult to provoke an UART overflow, but it's still possible. So I'm going to turn up the clock speed of the PIC, and think some more about how to make the UART functions faster.

No comments:

Post a Comment