ScreenSFR.gif' alt='Proton Basic Serial Interrupt' title='Proton Basic Serial Interrupt' />PICBASIC PRO Compiler Gold Edition SW5. This product is no longer available for sale. The Legendary BASIC Compiler for PIC Microcontrollers. PICBASIC Pro PBP is a world class BASIC compiler for rapid development of Microchip PIC. You may need to go back and reselect the 'normal' USB serial port next time you want to use the normal upload. Ubuntu & Linux Issue Fix Note if you're using Ubuntu 15.04 (or perhaps other more recent Linux distributions) there is an issue with the modem manager service which causes the Bluefruit LE micro to be difficult to program.


I found that when combining the HW and SW serial implementations on a PIC®, it often occurs that you miss characters because of the rather strict timing restraints of the software implementation. I have put together an interrupt based serial buffer that allows the HW serial port to be buffered automatically. This way the 'normal' processing can continue and the SW serial port is not affected. This piece of code works on the 18F245x as far as I have tested and does serial buffering. It operates in a circular array way. When more then 65 characters are received, the first one will be overwritten and all 64 previous characters will be lost! So regular checking of the input buffer is still required.
It should be possible to implement this processing with buffers of sizes which are a power of 2 (2-4-8-16-32-64-128-256) without any problems. When using other sizes, makes sure that the generated code does not use the internal variables!! Code is constructed in such way that no compiler variables are altered when in the interrupt routine. This way the code should not interfere with the 'normal' run of the program. Example Code.
Proton Basic Serial Interrupts Code
Serial comunication can be annoying (custom cable connections, RS232 to TTL voltage levels, baud rates, etc). Use a feedback loop (connect serial port's 'out' pin with the 'in' pin) and hyperterminal (free prog that comes with windows) to test your computer's serial output before you try to connect to external electronics (like the PIC). Yeah, I guess I'm self taught, I started with BasicStamps and worked up to PICs when the basic stamp wasn't good enough for my projects. The PIC code is just in PICBasic, not assembly language. It would be really long and messy if it was in assembly.
Proton Basic Serial Interrupts Numbers
They do have assembly language interupt code examples in the PICBasic manual though.