Silicon ChipPIC & AVR Chips from Microchip - October 2023 SILICON CHIP
  1. Outer Front Cover
  2. Contents
  3. Subscriptions: PE Subscription
  4. Subscriptions
  5. Back Issues: Hare & Forbes Machineryhouse
  6. Publisher's Letter: Time for some new PICs
  7. Feature: Holy Spheres, Batman! by Max the Magnificent
  8. Feature: Net Work by Alan Winstanley
  9. Project: Automatic Level Crossing and Semaphore Control by LES KERR
  10. Project: Multi-Stage Buck-Boost Battery Charger by Tim Blythman
  11. Project: PIC & AVR Chips from Microchip by Tim Blythman
  12. Project: PIC AND AVR Breakout Boards by Tim Blythman
  13. Feature: Arduino Bootcamp – Part 10 by Max’s Cool Beans
  14. Feature: AUDIO OUT by Jake Rothman
  15. Feature: KickStart by Mike Tooley
  16. Feature: Circuit Surgery by Ian Bell
  17. PCB Order Form
  18. Advertising Index by Ian Batty

This is only a preview of the October 2023 issue of Practical Electronics.

You can view 0 of the 72 pages in the full issue.

Articles in this series:
  • (November 2020)
  • Techno Talk (December 2020)
  • Techno Talk (January 2021)
  • Techno Talk (February 2021)
  • Techno Talk (March 2021)
  • Techno Talk (April 2021)
  • Techno Talk (May 2021)
  • Techno Talk (June 2021)
  • Techno Talk (July 2021)
  • Techno Talk (August 2021)
  • Techno Talk (September 2021)
  • Techno Talk (October 2021)
  • Techno Talk (November 2021)
  • Techno Talk (December 2021)
  • Communing with nature (January 2022)
  • Should we be worried? (February 2022)
  • How resilient is your lifeline? (March 2022)
  • Go eco, get ethical! (April 2022)
  • From nano to bio (May 2022)
  • Positivity follows the gloom (June 2022)
  • Mixed menu (July 2022)
  • Time for a total rethink? (August 2022)
  • What’s in a name? (September 2022)
  • Forget leaves on the line! (October 2022)
  • Giant Boost for Batteries (December 2022)
  • Raudive Voices Revisited (January 2023)
  • A thousand words (February 2023)
  • It’s handover time (March 2023)
  • AI, Robots, Horticulture and Agriculture (April 2023)
  • Prophecy can be perplexing (May 2023)
  • Technology comes in different shapes and sizes (June 2023)
  • AI and robots – what could possibly go wrong? (July 2023)
  • How long until we’re all out of work? (August 2023)
  • We both have truths, are mine the same as yours? (September 2023)
  • Holy Spheres, Batman! (October 2023)
  • Where’s my pneumatic car? (November 2023)
  • Good grief! (December 2023)
  • Cheeky chiplets (January 2024)
  • Cheeky chiplets (February 2024)
  • The Wibbly-Wobbly World of Quantum (March 2024)
  • Techno Talk - Wait! What? Really? (April 2024)
  • Techno Talk - One step closer to a dystopian abyss? (May 2024)
  • Techno Talk - Program that! (June 2024)
  • Techno Talk (July 2024)
  • Techno Talk - That makes so much sense! (August 2024)
  • Techno Talk - I don’t want to be a Norbert... (September 2024)
  • Techno Talk - Sticking the landing (October 2024)
  • Techno Talk (November 2024)
  • Techno Talk (December 2024)
  • Techno Talk (January 2025)
  • Techno Talk (February 2025)
  • Techno Talk (March 2025)
  • Techno Talk (April 2025)
  • Techno Talk (May 2025)
  • Techno Talk (June 2025)
Items relevant to "Stewart of Reading":
  • Bookshelf Speaker Passive Crossover PCB [01101201] (AUD $10.00)
  • Bookshelf Speaker Subwoofer Active Crossover PCB [01101202] (AUD $7.50)
  • Bookshelf Speaker Passive and Active Crossover PCB patterns (PDF download) [01101201-2] (Free)
  • Bookshelf Speaker System timber and metal cutting diagrams (PDF download) (Panel Artwork, Free)
Articles in this series:
  • Easy-to-build Bookshelf Speaker System (January 2020)
  • Building the new “bookshelf” stereo speakers, Pt 2 (February 2020)
  • Building Subwoofers for our new “Bookshelf” Speakers (March 2020)
  • Stewart of Reading (October 2023)
  • Stewart of Reading (November 2023)
  • ETI BUNDLE (December 2023)
  • Active Subwoofer For Hi-Fi at Home (January 2024)
  • Active Subwoofer For Hi-Fi at Home (February 2024)
NEW PIC & AVR Chips from Microchip The parts shortages in recent years have given us By Tim Blythman the incentive to look more widely for alternatives to the parts we’ve been using. Microchip Technology offered to send us samples of new microcontrollers and, as newer chips tend to have more features at a lower cost, we were keen to find out what the new parts bring. S earches for alternative parts are now something we do far too often. Microcontrollers have been some of the worst affected parts (along with MOSFETs), but other ICs and even some passives are becoming harder to find. Many of our favourite microcontrollers from years past are falling out of favour as newer, cheaper parts appear. The older PIC and AVR parts haven’t been discontinued, but as manufacturers cannot keep up with demand, they are allocating more resources to making the latest parts. As a result, many of the older chips have become scarce. However, every cloud has a silver lining, and many of the newer parts are much more capable than their predecessors. Many are also ‘drop-in replacements’, at least in terms of having the same pin allocations. Recently, in new projects, we have written about the new range of 8-pin Microchip devices. They are the PIC16F15213 and PIC16F15214, about the cheapest 8-pin, 8-bit PICs available. Despite that, they have more features than the earlier 8-pin parts we used, like the PIC12F675 and PIC12F1572. You may also be aware of the new PIC16F171xx series of parts, which includes (among many other features) a handy 12-bit analogue-to-­ digital converter (ADC) peripheral. The PIC16F17146 is from Farnell, Digi-Key and others and we obtained a handful to try out. 20-pin chips Microchip gave us further suggestions and sent sample parts for us to try. We bought some PIC16F18146 chips ourselves and received free samples of the PIC16F18045. These are all new 20-pin parts in DIL packages (ie, DIP). Other pin counts are available, but we figured that a 20-pin chip is a sweet spot for many applications. Another reason for choosing to try out parts with 20 pins is that this is a bit of a gap in our repertoire; we have tended to use either very small 8-pin chips or larger 28-pin chips. One 20-pin part we often use is the PIC16F1459. It’s handy because The five subjects of this review include a new 8-pin PIC, three new 20-pin PICs from different families and a 32-pin AVR microcontroller. They all have a slew of interesting features. From left to right, they are: PIC16F18015, PIC16F18045, PIC16F18146, PIC16F17146 and AVR64DD32. 34 it includes a USB peripheral but is relatively inexpensive. Unfortunately, though, three pins are occupied by the USB function, and one cannot be used for any other purpose. The other two can be used as inputs only, even if the USB peripheral is not used. With the next lower pin count being 14 pins, there is often little call for the PIC16F1459 unless the USB function is needed. So we figured it was time to see if there were other options for parts around this size. The next step above a 20-pin micro is usually 28 pins but they are pretty bulky, especially in DIP. There are other advantages for the 20-pin parts; for example, the PPS (peripheral pin select) feature can be used to remap all digital pins on 20-pin and smaller parts, but not on larger parts. Smaller parts To continue our theme of 8-pin parts from previous articles, we took up Microchip’s offer of a sample of the PIC16F18015. It is from the same family as the PIC16F18045 and has much the same complement of peripherals, although they are exposed on fewer pins, so it’s likely they can’t all be used simultaneously. So we have a good range which should provide some interesting comparisons both between families and between members of the same family. We can also draw some comparisons to the other 8-pin PICs. Currently, the PIC16F18015 also appears to be the cheapest 8-pin 8-bit PIC microcontroller with the most RAM and Flash memory, at 1kiB of RAM and 14kiB of Flash. The upcoming (at the time of writing) PIC16F17115 and PIC16F18115 will have similar quantities of RAM Practical Electronics | October | 2023 Fig.1: parts from the PIC16F180xx family, like many of the newer enhanced core 8-bit PICs, have matching pinouts that give an easy path to upgrade to parts with more pins. In this case, the topmost pins have the same designations across the 8-pin PIC16F18015, the 14-pin PIC16F18025 and the 20-pin PIC16F18045. and Flash memory. They belong to the same families as the 20-pin parts we are looking at here. The Improved SMD Test Tweezers project (PE, May 2023) was only possible because the PIC16F15214 offers an increase in available Flash memory over the PIC12F1572 used in the original Tweezers. That allowed us to add extra features to the firmware. AVR chips Microchip’s acquisition of Atmel in 2016 has meant that the popular AVR microcontrollers, used extensively in Arduino boards, are now also part of the Microchip stable. We looked at the ATtiny816 in the July 2021 issue. That article included details on using a PICkit 4 and MPLAB X to program an AVR chip with the tinyAVR core. We’ve received samples of some AVR64DD32 chips, part of their latest AVR DD series. One of the more interesting features we read about is MVIO (multi-voltage I/O), which allows some I/O pins to operate at a different voltage than the rest of the chip. We’ll get to the AVR64DD32 a bit later. architecture prefix. Of this code, the first three digits indicate the family. Parts in the same family will have much the same peripheral set. The fourth digit dictates the number of pins, while the fifth digit reflects the amount of RAM and Flash memory. This is summarised in Tables 1 and 2 for the PIC16F181xx family. Note that the ‘kiB’ is a unit of 1024 bytes, compared to ‘kB’, which might refer to 1000 bytes. While we drew up those tables from the PIC16F181xx data sheet, they seem to fit all recent 8-bit PIC parts with a five-digit suffix. For example, the PIC16F15213 has 256 bytes of RAM and 3.5kiB of Flash memory. We expect the gap between 2 and 4 for the fourth digit is to accommodate 18-pin parts that could substitute for older devices – for example, the PIC16F88. Cracking the code One thing that we do like about Microchip’s recent 8-bit PIC offerings is that there is a clear path to upgrade to different members of the same family, as well as between different families, due to a high degree of pin compatibility. The most recent parts, such as those discussed in this article, have five-digit part codes after the PIC16F Compatibility From the very limited examples we have tested, some parts that share a data sheet will run the same HEX file without problems, as long as it has been compiled for the part with the least RAM and Flash memory. That’s because all the critical peripheral registers are in the same locations, and all the peripherals are mapped to the same pins. There is even a degree of drop-in compatibility between parts in the same family with different pin counts. Fig.1 shows this for members of the PIC16F180xx family. These parts share the same data sheet and have a similar set of peripherals. You can see how pins 1-8 of the Table 1 – PIC16F181xx pin counts Table 2 – PIC16F181xx memory sizes 4th digit Pin count # I/O pins 5th digit RAM Flash 1 8 6 (3) 256B 3.5kiB 2 14 12 4 512B 7kiB 4 20 18 5 1kiB 14kiB 5 28 25 6 2kiB 28kiB 7 40 36 Practical Electronics | October | 2023 8-pin part correspond exactly to pins 1-4 and 11-14 of the 14-pin part, with six extra pins corresponding to PORTC being appended as pins 5-10 in between, but physically below the existing PORTA pins. Similarly, the 20-pin parts add more PORTC and PORTB pins without interfering with the relative locations of the existing pins. What is great about the 20-pin parts is that they offer the PPS (peripheral pin select) feature for all digital pins and peripherals. That means the digital peripherals can be shuffled around very easily at the software design stage, simplifying hardware design. Some peripherals appear to change locations between parts, but that would only be a problem for analogue peripherals that cannot be remapped with PPS. We noted this with some of the earlier enhanced 8-bit parts and our PIC Programming Helper from PE, June 2022. The Helper uses a 20-pin socket which can work with 8-pin and 14-pin parts due to their similar pinouts, at least in relation to the pins used for programming. This is straightforward enough for small DIP parts, which all have rows of pins spaced 0.3in (7.62mm) apart. The 20-pin SOIC parts are usually wider than the 8-pin or 14-pin parts, but a drop-in replacement could be made to work with a carefully crafted PCB pad pattern (‘footprint’) that caters for multiple widths. You might think that this is pure speculation, but the parts shortage has had us contemplate whether we could supply, for example, a 14-pin SOIC microcontroller in place of an 8-pin SOIC part from the same family. It is not that bad yet, but our new designs try to keep a few spare millimetres of space to allow that to happen if it’s needed in the future! It’s worth noting that all the recent PIC families we’ve seen have followed this trend, meaning that parts 35 Screen 1: MPLAB X can now install DFPs (device family packs) to provide device support. If a project is loaded that requires a specific DFP, you can install it by clicking on the blue link. The AVR64DD32 requires the AVR-Dx DFP, which also supports AVR DA and AVR DB series parts. from different families come close to being drop-in substitutes too, as the power and programming pins are in the same locations. With the smaller parts having PPS on all pins, purely digital applications should have no trouble being ported between different families with nothing more than minor code changes. We must admit that the vast range of PICs available can be overwhelming, and we are pretty well spoilt for choice. However, the range narrows somewhat when you limit yourself from choosing parts currently in stock. MPLAB X v6.00 and new chip support Earlier this year saw the release of MPLAB X v6.00, a major version jump from the various v5.xx versions that we’ve been using for the past few years. Unlike the older MPLAB, MPLAB X can be run on Linux and Mac as well as under Windows. MPLAB X is Microchip’s IDE (integrated development environment) for programming their microcontrollers and other devices. An IDE allows programs to be written, compiled and uploaded all using the same application. Version v5.40 was the first version to only support 64-bit operating systems, so if you are working on an older 32-bit computer, you can only use earlier versions of the IDE, which may not support some of the newer parts that are available. MPLAB X v5.40 also introduced the concept of DFPs (device family packs). To use the PIC16F1xxxx parts requires a DFP to be installed. That is easily and automatically done through the IDE – see Screen 1. The 8-bit parts (remember that this includes those parts with a PIC16 prefix) also require a separately installed compiler – known as ‘XC8’ – which can be downloaded from the Microchip website. We tried using a previously installed older (v2.20) compiler which gave some warnings about unknown identifiers. An upgrade to XC8 v2.40 removed those warnings. 36 From our experience, this combination of IDE (MPLAB X v6.00) and compiler (XC8 v2.40) will work best for the newer devices. It’s a reasonably large install, with MPLAB X taking almost 9GB and the compiler nearly 2GB of storage space on a Windows machine. It’s possible to install different MPLAB X and compiler versions simultaneously, so you can continue to use older configurations for your other projects. XC8 v2.40 and other recent versions of the XC8 compiler will also work with supported AVR microcontrollers. These are the 8-bit parts that Microchip took over from Atmel and that Microchip continues to develop. All our tests on the AVR64DD32 were performed using MPLAB X v6.00 and XC8 v2.40. If you have not used XC8 before, user guides are available for download. There are separate user guides for PIC and AVR parts, so ensure you are referring to the correct document. New 20-pin PICs Table 3 summarises the differences between the new 20-pin parts. It isn’t a complete list of the features of these parts, but many of their other peripherals are much the same. That table is not intended to be a comprehensive list of the features The MPLAB X IDE is the primary programming software to use with Microchip microcontrollers. of these parts, but to highlight their differences. All the PIC16F devices use a 14-bit Flash program memory word. The only difference we could see between the PIC16F17146 and the PIC16F18146 is that the former has an op amp. Apart from that, they both have a very strong analogue peripheral set. The Microchip product page for the PIC16F1846 notes that ‘It is the first product family to offer the 12-bit differential ADC with computation in low pin count packages.’ The parts are recommended for raw sensor applications that require gain and/ or filtering, assisted by the new ADC with computation. The Microchip page for the PIC16F18045 indicates that it is ‘for cost-sensitive sensor and real-time control applications.’ All three parts have the following features: zero-cross detect (ZCD), numerically controlled oscillator (NCO), peripheral pin select (PPS) and numerous communication and PWM channels. As mentioned earlier, PPS allows digital peripheral functions to be mapped to different physical pins. However, parts with more than 20 pins only offer a subset of pins with the PPS feature. Other features we have seen on many of the newer parts include the Microchip Unique Identifier (MUI). The PIC16F18045 While the PIC16F18045 clearly has fewer features than the PIC16F17146 and PIC16F18146, it is still better-­ endowed than members of the PIC16F152xx family. Since the PIC16F18015 and PIC16F18045 share the same data sheet, much of the following applies to the PIC16F18015 as well. The data sheet notes that their complement of peripherals is much the same, although there are fewer pins available on the PIC16F18015 for using them simultaneously. The PIC16F18045 (or PIC16F18015) includes a complementary waveform Practical Electronics | October | 2023 In addition to the DIP-20 package, these 20-pin PICs also come in VQFN-20 and SSOP-20 packages. generator and four configurable logic cells (CLCs). There are two fixed-­ v oltage references (FVRs), a comparator and a zero crossing detector (ZCD), adding to the ADC among the analogue peripherals. The FVRs offer 1.024V, 2.048V or 4.096V, subject to an adequate supply voltage. One can be used by the comparator and DAC, the other as a reference or input to the ADC. While the FVR voltages may vary up to 4% from nominal, their measured values are written to the DIA (Device Information Area) at the time of manufacture. That means a running program can calibrate itself by reading from the DIA. They can even be read from within the MPLAB X IDE or IPE, so a one-off design could use an accurate hard-coded value. The DIA sits alongside the MUI and is read-only data imprinted on individual chip dies with a laser during device manufacture. Since the comparator output is digital, it can be routed to any I/O pin or used internally to trigger interrupts. Separate rising and falling edge interrupts are also available. The comparator can even be used to trigger an ADC conversion. CLC modules The four CLC (Configurable Logic Cell) modules in the PIC16F18045 provide the option to implement either sequential or combinatorial logic. Each CLC module has four inputs and one output and can provide various fixed logic functions. The CLC outputs can be directed to digital I/O pins or be used to trigger interrupts internally. The internally-­ generated CLC output can be used as one of the inputs to other (or the same) CLCs to allow more complex logic to be created. The intention is to avoid the need to add an extra external logic chip to achieve a specific function. ADC advances The ADC on the PIC16F18015 and PIC16F18045 is referred to as an Practical Electronics | October | 2023 ‘ADCC’ or analogue-to-digital converter with computation. The computation feature means that the hardware can do things like averaging or low-pass filtering and perform comparisons to trigger interrupts. The ADCC also has hardware support for capacitive divider applications. A typical application for that is capacitive touch sensing. We experimented with this in the ATtiny816 Breakout Board using a standard ADC peripheral – see PE, July 2021. The hardware support makes it simpler to implement touch sensing, while other features like the precharge control, guard ring and adjustable sampling capacitance make the sensing more robust. 12-bit differential ADC On the PIC16F18146 and PIC­ 16F17146, there is also the benefit of a 12-bit (vs 10-bit) ADC and the option to perform differential readings between two channels. Note that while doing differential readings, both channels must sit inside the range set by the negative and positive ADC references. A legacy mode makes it behave much the same as older parts, so just because there are new features doesn’t mean that setting up the ADC is any more difficult. Interestingly, the two PWM peripherals on the PIC16F18146 (with two ‘slices’ each, giving a total of four channels) do not require a separate timer to be configured, simplifying configuration in straightforward cases. The CCP peripheral can also be used to provide more PWM channels. The PIC16F18146 and PIC16F17146 have the option of running the processor more slowly than the main clock. This is called ‘DOZE mode’, and the clock ratio can be set dynamically at runtime. It’s even possible to return the processor to full speed while interrupts are executing. That is handy for an application that needs to save power but also respond quickly to external events. All these parts provide other peripherals for serial communication protocols such as SPI, UART and I2C. We recommend taking a look at the data sheets (even just the contents) to get an idea of what else they provide. Practical applications We were curious about peripherals like the CLC and comparator, as we hadn’t had much experience using these types of peripherals on a microcontroller. So, we thought we’d put them to the test and see what we Table 3 – a comparison of the 20-pin PICs we tested PIC16F18045 PIC16F18146 PIC16F17146 Flash memory 14kiB 28kiB 28kiB CPU Speed 8 MIPS 8 MIPS 8 MIPS 256 bytes 256 bytes CCP channels 2 1 1 PWM channels 3 × 10-bit 2 × 16-bit 2 × 16-bit EEPROM 128 bytes 8-bit timers 3 ADCs 1 × 17 channel ADC resolution 10 bits 2 2 1 × 17 channel 1 × 17 channel 12 bits (differential) 12 bits (differential) Comparators 1 2 2 Op amps 0 0 1 2 × 8-bit 2 × 8-bit Yes Yes DAC 1 × 8-bit Processor DOZE No 37 Fig.2: this excerpt from the AVR64DD32 data sheet shows the other members of the AVR DD family, with the AVR64DD32 being the most powerful. The other members have fewer 0pins but still a similar number of peripherals. could achieve with a minimum of external components. We have designed a boost DC/DC converter using several of the chip’s peripherals along with an inductor and low-side switch in the form of an N-channel MOSFET. This configuration also requires a diode and capacitor to capture the energy from the inductor. We did some initial breadboard testing and succeeded in getting a circuit working with all four PICs we’re looking at, including the tiny PIC16F18015. It went so well that we have put together a demonstration board that does just that. We’ve secured some stock of the PIC16F18146, so we will base our PIC16F18146 Boost Regulator on this part. This project will be published in a future issue. AVR64DD32 As we noted earlier, we have covered several AVR parts since the Microchip takeover of Atmel, and the AVR DD family is the latest. Like the earlier ATtiny816, AVR128DA28 and AVR128DA48 parts, the AVR64DD32 uses the single-wire UPDI programming interface. UPDI stands for ‘unified program and debug interface’ and performs much the same role as ICSP (in-circuit serial programming) in PIC devices, although it is a pretty different protocol. It replaces the traditional SPI programming for AVRs that required more pins to be used. The DD family appears to focus more on low pin count applications than the DA family. For example, the DD family data sheet shows parts from 14 to 32 pins, while the DA family has 28 to 64 pins. Fig.2 is an excerpt from the AVR64DD32 data sheet and shows other members of the AVR DD family. The DB family introduced MVIO (multi-voltage I/O), allowing some of the I/O pins to operate on a separate digital voltage domain, powered from a dedicated pin. The DD family also has the MVIO feature. 38 For the AVR64DD32, the four PORTC pins can use the MVIO feature, with a VDDIO2 pin controlling the second IO voltage. Whether MVIO is operational is set by a configuration fuse, so it cannot be changed at runtime. There are status bits that report if the VDDIO2 rail is present and can trigger interrupts when it fails. If the VDDIO2 rail is too low, the MVIO pins are set to high impedance. The VDDIO2 rail can be between 1.8V and 5.5V, the same range as the main supply rail. L i k e t h e AV R 1 2 8 D A , t h e AVR64DD32 has ample Flash memory and RAM. There are also 256 bytes of EEPROM. So it appears that the DD family has many of the features of the DA and DB families, but with smaller pin counts and package sizes. CCL CCL (Configurable Custom Logic) is a similar peripheral to the PIC CLC. It is also intended to provide simple logic that can be attached to the digital peripherals and eliminate the need for an external logic chip. Rather than several fixed logic functions that can be selected (as for the PIC CLC), the CCL uses an eight-bit lookup table that takes three inputs and provides one output. It is an elegant idea and works well if you can reduce your logic to a truth table. You can also add sequential elements such as flip-flops and latches to the logic. Like the PIC CLC, signals can be passed between CCL units to create more complex logic. The AVR64DD32 also has peripherals that can provide serial communication features, as well as timers, a comparator, zero crossing detector and DAC. The ADC is a 12-bit differential type. The AVR64DD32 does not have PPS, but most digital peripherals can be switched to one alternative pin. The pin allocation is quite good, with several peripherals able to be allocated to PORTC to make use of the MVIO feature, including groups such as, for example, the four lines needed to implement an SPI interface. Software support As we saw with the AVR128DA parts, the integration of AVR parts into MPLAB X is quite good. We had no trouble creating a simple project from scratch in MPLAB X v6.00 to flash one LED on a breadboard. We encountered two minor problems with the AVR64DD32 and MPLAB X v6.00 but found solutions in online discussions. Those revealed that many people are interested in these new parts. Since the PICkit 4 cannot provide power in UPDI mode, we resorted to using the Snap programmer modified to supply 5V power from its own USB supply. We explained how to do that in the PIC Programming Helper article from PE, June 2022. The Snap has a pull-down on the pin used for UPDI, which interferes with programming. While we could have removed a resistor from the Snap, we found that a 1kW pull-up to the supply voltage (ie, between pins 2 and 4 on the Snap) was sufficient for UPDI programming to work. Also, it appears that the button for The AVR64DD32 is a Microchip / Atmel microcontroller with an AVR CPU core running at up to 24MHz. It is shown here in a VQFN-32 package but is also available in TQFP. Practical Electronics | October | 2023 reading from the device in the Configuration Bits window of MPLAB X does not work. The workaround is simply to use the Read Device Memory button from the main toolbar instead. The debugging feature works well. We could set breakpoints, pause program operation, view variables and view special function registers. The default configuration fuse settings mean that the processor uses an internal 4MHz oscillator when it starts up; it can be changed at runtime to 24MHz with a line of code. There are also options for using an external crystal or an internal or external 32.768kHz clock source. There is even the option of using a 48MHz clock (derived from a PLL) to feed peripherals that can use a higher clock speed than the processor (great for high-­precision PWM). With a lot of oscillator configuration able to be done in software, there is no longer the need or risk of setting the fuses to use an external oscillator, which could prevent reprogramming – an AVR bugbear. As with our ATtiny816 project, it wasn’t necessary to change from the default configuration fuse settings, avoiding such problems. Arduino compatibility Since the Arduino ecosystem started with 8-bit AVR parts like the ATmega328, it is no surprise that a cohort continues to add support for newer Atmel parts to the Arduino IDE. The core at: https://bit.ly/3OEEJdI supports many AVR Dx parts, including the promise of adding support for the AVR DD parts such as the AVR64DD32. We haven’t had a chance to try out DxCore since support for the AVR DD is so new, but it might be another way to start working with the AVR DD and other AVR Dx parts. You can find detailed installation instructions on the Installation page of the GitHub repository (linked above). For those familiar with the process, it’s as simple as adding this: https://bit.ly/pe-oct23-draz to the Additional Board Manager URLs and then installing the board package via the Boards Manager. Breakout boards We made a few small breakout boards to help test these parts, mainly to simplify connections to a programmer while the parts were on a breadboard. They’re not much more than a small PCB with some headers and a handful of passive components, Practical Electronics | October | 2023 but they proved so handy that we’ve decided to make them available from the PE PCB Service. See overleaf for information about the breakout boards and the parts you’ll need to assemble them. Summary We plan to keep the PIC16F18146 as our new 20-pin 8-bit PIC part of choice. Its core is similar to the recent PICs we have used, although the new DOZE feature could be pretty handy for low-power applications. While many recent parts support runtime Flash memory writing, a separate EEPROM space (as found on all three of the 20-pin PICs, and as described here) helps simplify development through its simpler interface and the ability to write a byte at a time. Choosing a set of peripherals to match a project design and potentially unknown future applications can be tricky, but the PIC16F18146 has a good set for just a little more cost than the less capable PIC16F18045. That said, all three chips have a rich set of features, sufficient to fully implement the digital boost regulator which we used to demonstrate their capabilities. It’s reassuring and handy to see this ability to drop in parts across families, especially when some parts remain in short supply. Working with AVR parts in MPLAB X is now quite simple. If you’re accustomed to working with PICs under MPLAB X and want to try AVR parts, try putting an AVR64DD32 onto one of our smaller breakout boards. We look forward to the 14-pin and 20-pin members of the AVR64DD32 family becoming available. The AVR64DD32 data sheet indicates that some of these will have up to 64kiB of Flash memory and 8kiB of RAM. With the AVR parts having a hardware multiplier that the PICs do not, and often much more Flash memory and RAM, we can see these parts becoming useful in more complex applications or those requiring substantial calculation and computation. At the time of writing, Digi-Key (www.digikey.com), Mouser (https:// mouser.com) and Microchip Direct (www.microchipdirect.com) all have stock of at least some of the PIC16F17146 and PIC16F18xxx chips. Stock of the AVR64DD32 is due in soon (October – December 2023). Reproduced by arrangement with SILICON CHIP magazine 2023. www.siliconchip.com.au www.poscope.com/epe - USB - Ethernet - Web server - Modbus - CNC (Mach3/4) - IO - PWM - Encoders - LCD - Analog inputs - Compact PLC - up to 256 - up to 32 microsteps microsteps - 50 V / 6 A - 30 V / 2.5 A - USB configuration - Isolated PoScope Mega1+ PoScope Mega50 - up to 50MS/s - resolution up to 12bit - Lowest power consumption - Smallest and lightest - 7 in 1: Oscilloscope, FFT, X/Y, Recorder, Logic Analyzer, Protocol decoder, Signal generator 39