Silicon ChipNew PICs & AVRs from Microchip - October 2022 SILICON CHIP
  1. Outer Front Cover
  2. Contents
  3. Publisher's Letter: I3C: Coming soon to an IC near you
  4. Feature: Display Technologies, Part 2 by Dr David Maddison
  5. Project: 30V 2A Bench Supply, Part 1 by John Clarke
  6. Feature: New PICs & AVRs from Microchip by Tim Blythman
  7. Project: PIC & AVR Breakout Boards by Tim Blythman
  8. Subscriptions
  9. Feature: Buck/Boost Battery Charging by Tim Blythman
  10. Project: Multi-Stage Buck/Boost Charger by Tim Blythman
  11. Project: Automatic Train Controller by Les Kerr
  12. Serviceman's Log: Fixing feline follies by Dave Thompson
  13. Feature: Mouser Q & A by Nicholas Vinen & Mark Burr-Lonnon
  14. Project: WiFi Programmable DC Load, Part 2 by Richard Palmer
  15. PartShop
  16. Vintage Radio: STC model 510 portable by Associate Professor Graham Parslow
  17. Market Centre
  18. Advertising Index
  19. Notes & Errata: History of Op Amps, August 2021; AVO Valve Testers, August 2022; iSoundbar, August 2022
  20. Outer Back Cover

This is only a preview of the October 2022 issue of Silicon Chip.

You can view 44 of the 112 pages in the full issue, including the advertisments.

For full access, purchase the issue for $10.00 or subscribe for access to the latest issues.

Articles in this series:
  • Display Technologies, Part 1 (September 2022)
  • Display Technologies, Part 1 (September 2022)
  • Display Technologies, Part 2 (October 2022)
  • Display Technologies, Part 2 (October 2022)
Items relevant to "30V 2A Bench Supply, Part 1":
  • 30V 2A Bench Supply front panel control PCB [04105222] (AUD $2.50)
  • 30V 2A Bench Supply main PCB [04105221] (AUD $5.00)
  • INA282AIDR shunt monitor IC and 20mΩ 1W shunt resistor for 30V 2A Bench Supply (Component, AUD $10.00)
  • 30V 2A Bench Supply PCB patterns (PDF download) [04105221/2] (Free)
  • 30V 2A Bench Supply front panel artwork (PDF download) (Free)
Articles in this series:
  • 30V 2A Bench Supply, Part 1 (October 2022)
  • 30V 2A Bench Supply, Part 1 (October 2022)
  • 30V 2A Bench Supply, Part 2 (November 2022)
  • 30V 2A Bench Supply, Part 2 (November 2022)
Items relevant to "PIC & AVR Breakout Boards":
  • PIC16F18xxx DIP Breakout PCB [24110222] (AUD $2.50)
  • PIC16F18xxx SOIC Breakout PCB [24110225] (AUD $2.50)
  • AVRxxDD32 TQFP Breakout PCB [24110223] (AUD $2.50)
  • PIC & AVR Breakout Board PCB patterns (PDF download) [24110222,3,5] (Free)
Items relevant to "Buck/Boost Battery Charging":
  • Complete kit for the High Power Buck-Boost LED Driver (Component, AUD $80.00)
Items relevant to "Multi-Stage Buck/Boost Charger":
  • Buck/Boost Charger Adaptor PCB [14108221] (AUD $5.00)
  • PIC16F1459-I/SO programmed for the Buck/Boost Battery Charger Adaptor (1410822A.HEX) (Programmed Microcontroller, AUD $15.00)
  • 1.3-inch blue OLED with 4-pin I²C interface (Component, AUD $15.00)
  • 1.3-inch white OLED with 4-pin I²C interface (Component, AUD $15.00)
  • Complete kit for the Buck/Boost Charger Adaptor (Component, AUD $40.00)
  • Complete kit for the High Power Buck-Boost LED Driver (Component, AUD $80.00)
  • Laser-cut clear acrylic front panel for Buck/Boost Charge Adaptor (PCB, AUD $2.50)
  • Buck/Boost Charger Adaptor software & laser cutting files (1410822A.HEX) (Free)
  • Buck/Boost Charger Adaptor PCB pattern (PDF download) (14108221) (Free)
Items relevant to "Automatic Train Controller":
  • Automatic Train Control PCB [09109221] (AUD $2.50)
  • Chuff Sound PCB [09109222] (AUD $2.50)
  • PIC16F1455-I/P programmed for the Automatic Train Controller (0910922A.HEX) (Programmed Microcontroller, AUD $10.00)
  • PIC12F675-I/P programmed for the Chuff Sound module (0910922C.HEX) (Programmed Microcontroller, AUD $10.00)
  • ISD1820-based voice recording and playback module (Component, AUD $7.50)
  • Firmware for the Automatic Train Controller (0910922A/C.HEX) (Software, Free)
  • Auto Train Control and Chuff Sound Generator PCB patterns (PDF download) [09109221/2] (Free)
Items relevant to "WiFi Programmable DC Load, Part 2":
  • WiFi-Controlled DC Electronic Load main PCB [04108221] (AUD $7.50)
  • WiFi-Controlled DC Electronic Load daughter PCB [04108222] (AUD $5.00)
  • WiFi-Controlled DC Electronic Load control PCB [18104212] (AUD $10.00)
  • 3.5-inch TFT Touchscreen LCD module with SD card socket (Component, AUD $35.00)
  • Laser-cut acrylic fan mounting-side panel for the WiFi DC Electronic Load (PCB, AUD $7.50)
  • WiFi-Controlled DC Electronic Load laser-cut front panel (2mm matte black acrylic) (PCB, AUD $10.00)
  • Software and laser-cutting files for the WiFi DC Electronic Load (Free)
  • WiFi-Controlled DC Electronic Load PCB patterns (PDF download) [04108221/2, 18104212] (Free)
  • Front panel decal and cutting diagrams for the WiFi DC Electronic Load (Panel Artwork, Free)
Articles in this series:
  • WiFi Programmable DC Load, Part 1 (September 2022)
  • WiFi Programmable DC Load, Part 1 (September 2022)
  • WiFi Programmable DC Load, Part 2 (October 2022)
  • WiFi Programmable DC Load, Part 2 (October 2022)

Purchase a printed copy of this issue for $11.50.

NEW PIC & AVR Chips from Microchip The parts shortages over the last few years have given By Tim Blythman us 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. As they say, 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. In the April issue, we wrote about the new range of 8-pin parts we were using (siliconchip.au/Article/15277). 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. That article also mentioned the then-upcoming PIC16F171xx series of parts, which includes (amongst many other features) a 12-bit analogto-­digital converter (ADC) peripheral. The PIC16F17146 is (or was, at the time of writing) available from DigiKey, so we got 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 tend 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 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 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 & AVR64DD32. 44 Silicon Chip Australia's electronics magazine 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. siliconchip.com.au 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. 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 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 (April 2022; siliconchip. au/Article/15276) 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. 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. Cracking the code 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 reviewed the ATtiny816 in the January 2019 issue (siliconchip.au/ Article/11372). That article included details on using a PICkit 4 and MPLAB X to program an AVR chip with the tinyAVR core. In January 2021, we looked at Microchip’s AVR128DA48 microcontroller and the Curiosity Nano evaluation board (siliconchip.au/Article/14715). It was one of the first members of the new AVR Dx series. We also received samples of some One thing we 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 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 & 2 for the PIC16F181xx family. Note that “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 Table 1 – PIC16F181xx pin counts Table 2 – PIC16F181xx memory sizes AVR chips 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 siliconchip.com.au Australia's electronics magazine that could substitute for older devices like the PIC16F88. 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 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 analog 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 June 2021 (siliconchip.au/Article/14889). October 2022  45 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. It 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. Editor: can we convert a 14-pin chip to an 8-pin chip with a Dremel? 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 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. 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 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 (which 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. 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. 46 Silicon Chip The MPLAB X IDE is the primary programming software to use with Microchip microcontrollers. Australia's electronics magazine From our experience, this combination of IDE (MPLAB X v6.00) and compiler (XC8 v2.40) will work best for the newer parts. It’s a reasonably large install, with MPLAB X taking almost 9GB and the compiler nearly 2GB of storage space on Windows. 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 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 analog 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 siliconchip.com.au In addition to the DIP-20 package, these 20-pin PICs also come in VQFN-20 and SSOP-20 packages. or filtering, assisted by the new ADC with computation. The 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. 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). John Clarke used the MUI feature of the PIC16FLF15323 to generate a unique rolling code sequence for each transmitter in the Secure Remote Mains Switch (July-August 2022; siliconchip. com.au/Series/383). The PIC16F18045 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 manufacturing. 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 available. The comparator can even be used to trigger an ADC conversion. 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 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 intent is to avoid needing an extra external logic chip to achieve a specific function. ADC advances This ADC on the PIC16F18015 and PIC16F18045 is referred to as an ‘ADCC’ or analog 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. While the PIC16F18045 clearly has fewer features than the PIC16F17146 CLC modules and PIC16F18146, it is still better-­ The four CLC (Configurable Logic endowed than members of the Cell) modules in the PIC16F18045 PIC16F152xx family, the 8-pin members of which were the subject of our Table 3 – a comparison of the 20-pin PICs we tested last microcontroller review. PIC16F18045 PIC16F18146 Since the PIC16F18015 and Flash memory 14kiB 28kiB PIC16F18045 share the same data sheet, much of the following applies CPU Speed 8 MIPS 8 MIPS to the PIC16F18015 as well. The data EEPROM 128 bytes 256 bytes sheet notes that their complement of peripherals is much the same, CCP channels 2 1 although fewer pins are available on PWM channels 3 × 10-bit 2 × 16-bit the PIC16F18015 to use them simul8-bit timers 3 2 taneously. The PIC16F18045 (or PIC16F18015) ADCs 1 × 17 channel 1 × 17 channel includes a complementary waveform ADC resolution 10 bits 12 bits (differential) generator and four configurable logic Comparators 1 2 cells (CLCs). There are two fixed-­ voltage references (FVRs), a comparaOp amps 0 0 tor and a zero crossing detector (ZCD), DAC 1 × 8-bit 2 × 8-bit adding to the ADC amongst the analog peripherals. Processor DOZE No Yes siliconchip.com.au Australia's electronics magazine PIC16F17146 28kiB 8 MIPS 256 bytes 1 2 × 16-bit 2 1 × 17 channel 12 bits (differential) 2 1 2 × 8-bit Yes October 2022  47 The hardware support makes it simpler to implement touch sensing, while other features like the pre-charge 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. Whilst 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 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. We thought we’d put them to the test and see what we 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 48 Silicon Chip 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 later 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. 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. Like the AVR128DA, the 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 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. Australia's electronics magazine siliconchip.com.au 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 June 2022 (siliconchip.au/ Article/14889). 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 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://github.com/­ SpenceKonde/DxCore 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 http://drazzy. com/package_drazzy.com_index.json 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, but they proved so handy that we’ve decided to make them available in the Silicon Chip Shop. 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 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 we used to demonstrate their capabilities. It’s 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 smaller 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.au/), 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 October at Digi-Key and Mouser. SC 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 pins but still a similar number of peripherals. siliconchip.com.au Australia's electronics magazine October 2022  49