PIC16F18446 vs Arduino Uno – Overview, Speed Comparison

PIC16F18446 vs Piksey 328 – Overview, Speed Comparison

Microchip have been giving away some of the PIC16F18446 xpress boards and now that we’ve received our board, it’s time to take a closer look at what it has to offer. We will also be comparing it to the most popular Arduino board  – the Arduino UNO.

First Impressions

PIC16F18446 Xpress Board – Top

On the surface, the board looks well designed. We’ve always liked rounded corners and the cut-out holes make it easy to solder this board onto PCBs.

The board itself is split up into 2 sections – one is the on-board programmer and the other is the actual core. The microcontroller is in a 20-pin QFN package which is handy for compact designs. It doesn’t have an external oscillator or clock but uses a precision internal oscillator that can clock the core at 32MHz, which is very impressive. The board contains a secondary, low power 32.768KHz crystal which is not connected by default and this allows the two pins to be used as GPIOs.

PIC16F18446 Xpress Board – Bottom

There’s not much on the bottom side of the PCB. There are some test pads along with PCB markings which are useful.

Dimensions

Arduino UNO, PIC16F18446 Xpress, Piksey Dimensions

As can be seen, the PIC16F18446 xpress board is much smaller than the standard Arduino UNO. It still is much bigger than the Piksey 328 though.

Specifications

Before we run some code, let’s spend some time comparing a few basic parameters. Since the Piksey 328 uses the same core as the Arduino UNO (ATmega328P), the specifications are almost identical between the two.

Clock Frequency:

The PIC xpress board can be clocked at 32MHz using the internal oscillator while the Arduino and Piksey 328 are clocked at 16MHz using an external crystal (resonator). The ATmega328P can be clocked at 20MHz but the Arduino libraries natively support 16MHz clock rates and that’s what we will be using for future tests.

CPU Speed:

The PIC16F18446 has a CPU speed of 8 while the ATmega328P has a CPU speed of 20 as per the details on the product pages. This means the ATmega328P is much faster, at least on paper. It’s easy to confuse CPU speed (throughput) and clock frequency, so we’ll try to provide a simple explanation below:

Every microcontroller needs a clock pulse in order to operate. The clock acts as a trigger which is used by the internal logic to execute instructions. The microcontroller architecture determines how many clock pulses are needed to execute certain instructions and this roughly translates to what is meant by throughput. In other words, throughput links the actual execution speed to the input clock pulses. Determining throughput is not a straightforward calculation and there are many factors that need to be considered but one way to determine throughput is to execute reference code using both the microcontrollers and measuring the performance. The most common metric used in the industry is called DMIPS (Dhrystone MIPS) which is nothing but the measure of computer performance in comparison with that of microcomputer from the 1970s (DEC VAX 11/780).

Peripherals:

There’s no surprise here, the PIC has a lot more peripherals than the ATmega and that’s one of the reasons why the PIC has been a popular architecture.

Pin Count:

The PIC has about 20 pins with 18 I/Os, the Arduino UNO has 28 pins (23 I/Os) while the Piksey 328 has 32 pins (25 I/Os). There’s not much to say here but it really depends on the application and if you actually need those many I/Os in a given project.

Power:

This is where the PIC really shines. It has something called XLP – eXtreme Low Power mode which means it only consumes 50nA in sleep mode at 1.8V. For low speed applications, it has an operating current of 8uA when clocked at 32KHz (1.8V) while the operating current is roughly 32uA/MHz (1.8V) for higher clock rates.

We’ve not seen a low power mode for the ATmega328 in the datasheet but it does state that it consumes 100nA in power down mode (similar to sleep mode?) and about 200uA in active mode at 1MHZ (1.8V).

Clearly, the PIC is far superior for low power applications.

In conclusion, they’re both very different micro-controllers and are targeted at different application but we’re going to take this one step further and test how quickly each of them can toggle an LED using mostly default settings. In the real world, this would determine the responsiveness or the ability to poll inputs, check flags and set outputs which is what most low-level applications would require.

Performance Comparison (toggling I/O)

Here’s what we’re going to do:

  1. Setup the microcontroller (system clocks, I/Os etc)
  2. Set an I/O pin (connected to internal LED) to login 1 (High/ON)
  3. Quickly set the same I/O pin to logic 0 (Low/OFF) without any delay or additional code between the two statements.
  4. We will use an oscilloscope to measure the ON and OFF time.

We’re also going to use embedded C in both cases and will be using the Arduino & MPLAB IDE with standard compiler settings in both cases.

ATmega328 – 16MHz

Here’s the code that we will be running on the Piksey (Arduino):

void loop() {
  digitalWrite(LED_BUILTIN, HIGH); 
  digitalWrite(LED_BUILTIN, LOW);  
}
Piksey LED Toggle

And here are the results:

Time: 3.400uS, Frequency: 294KHz
PIC16F18446 – 16MHz

Here’s the code that we will be running on the PIC16F18446:

    while (1)
    {
      led0_Toggle();  //#define led0_Toggle()  do { LATAbits.LATA2 = ~LATAbits.LATA2; } while(0) 
    }
PIC16F18446 LED Toggle

And here are the results:

Time: 3.400uS, Frequency: 294KHz
PIC16F18446 – 32MHz

We can’t run the Arduino at 32MHz so we will only test the PIC16F18446 at 32MHz.

    // HFFRQ x_MHz; 
    OSCFRQ = 0x06;      //0x02 - 4MHz, 0x05 - 16MHz, 0x06 - 32MHz
PIC16F18446 Clock Configuration

We updated the clock configuration for the PIC and ran the tests again, here are the results:

Time: 1.700uS, Frequency: 588KHz

So there you have it. The PIC16F18446 is certainly a very nice micro-controller and is perhaps well suited for applications that have a small footprint. It also has a lot more peripherals at a much lower price point (as per pricing from Microchip direct) and this makes it a very good overall device.

We’re certainly happy to have requested a sample and perhaps it’s time for us to revisit the PIC family. What are your thoughts? Would you like us to design a product with the PIC16F18446? Perhaps a Piksey – PIC? Let us know in the comments below or get in touch with us on social media.

Source

The test projects are available for download using the following links. Downloads are restricted to registered users. Registration is and will always be 100% FREE.

Arduino/Piksey Speed Test: Piksey Speed Test - LED

PIC Speed Test – 16MHz: PIC16F18446_Speed_Test_16MHz

PIC Speed Test – 32MHz: PIC16F18446_Speed_Test_32MHz

Disclosure: The PIC16F18446 xpress board was provided to us as part of a promotional giveaway. This post has not been sponsored and all content/views presented here are unbiased.

5
Leave a Reply

  Enable Notifications  
newest oldest most voted
Notify me for
WestfW

If you can’t get the PIC doing raw register manipulation to be MUCH faster than the Arduino using digitalWrite(), I suspect you’ve done something terribly wrong. While the AVR is nominally a faster processor (1 clock per instruction cycle vs 4 clock per instruction cycle), the overhead of the Arduino digitalWrite() is substantial (10x-20x) Most likely, the clock isn’t set up the way you think – for example, mplab Xpress (the online version) has the hello_world app for PIC16f18855 (I don’t have a 18446, but they should be similar) inexplicably sets OSCCON1 for an additional 4x divisor (and 4MHz internal… Read more »