I am still new on electronics (my background is software), I played around a bit with Arduino, and I am trying to advance on other microcontrollers like PIC, ARM, etc.

Can I rely on existing libraries to use peripherals like UART, I2C, SPI as I am used to with Arduino?

I googled around for a bit, and pages like this detail how I can implement UART on a PIC16. So I was wondering, does microchip (or any other microcontroller vendor) have libraries readily available which I can simply include as I was used to with Arduino? Or am I supposed to learn all the low level registers and implement them myself? (because that sounds quite challenging for a beginner like me).

Hope I won't get burned over this question, but couldn't find the answer googling...

  • \$\begingroup\$ Yes, they have libraries and drivers, although using them isn't as "easy" as Arduino. Take a look at MPLab X, Code Configurator and Harmony (for 32-bit MPU's). \$\endgroup\$ – Ron Beyer Jul 29 '19 at 14:02
  • \$\begingroup\$ This question is really too broad and at least potentially a prohibited search for off-site resources like libraries. But yes, many MCU vendors publish libraries for basic peripherals and in at least some cases these are fairly popular. There are also various other multi-platform frameworks beyond Arduino, each having its own compromises. \$\endgroup\$ – Chris Stratton Jul 29 '19 at 14:03
  • \$\begingroup\$ Thanks for commenting, and sorry for the poor question. I am looking for a microcontroller that supports (the infamous?) 9 bit uart. And I was hoping that I could also rely on an existing library that allows me to configure 9 bit uart. But the amount of microcontrollers is quite overwhelming and I have no idea which vendor would be my safest bet for this specific requirement. Is the best way forward to just 'buy a bunch and try it out'? I mean, the fact that a microcontroller supports 9 bit uart doesn't mean that the library allows me to configure it (as I found out with arduino) \$\endgroup\$ – bas Jul 29 '19 at 14:15
  • \$\begingroup\$ You can bit-bang a 9-bit UART protocol if you wanted to using a uC, and that would work with pretty much any microcontroller depending on the timing (rate) you need, including Arduino (would require a small modification to the SoftwareSerial library). \$\endgroup\$ – Ron Beyer Jul 29 '19 at 14:22
  • \$\begingroup\$ Wouldn't bit banging be less robust than using the actual hardware peripheral? \$\endgroup\$ – bas Jul 29 '19 at 14:48

The easiest way to use the UART in a PIC 16 is to work with the MCC. I guess you also could use it as a 9 Bit UART.
But even if you use the MCC you had to learn a little bit more about the hardware than using an Arduino.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.