Silicon ChipA Rundown on New 8-pin PIC Microcontrollers - November 2020 SILICON CHIP
  1. Outer Front Cover
  2. Contents
  3. Publisher's Letter: Why is electronics male-dominated?
  4. Feature: MEMS (Micro-Electromechanical Systems) by Dr David Maddison
  5. Project: Eight Small LED Christmas Ornaments by Tim Blythman
  6. PartShop
  7. Project: Two Large LED Christmas Stars by Barry Cullen & Tim Blythman
  8. Project: Balanced Input Attenuator for the USB SuperCodec by Phil Prosser
  9. Serviceman's Log: One repair leads to another by Dave Thompson
  10. Vintage Radio: RCA BP-10 "miniature" valve portable radio by Ian Batty
  11. Feature: A Rundown on New 8-pin PIC Microcontrollers by Tim Blythman
  12. Feature: The Vintage Matrox ALT-512 Graphics Card by Hugo Holden
  13. Project: Flexible Digital Lighting Controller, part 2 by Tim Blythman
  14. Feature: Electronic ‘Wearables’ and the Jaycar Sparkle Stitch by Tim Blythman & Nicholas Vinen
  15. Market Centre
  16. Advertising Index
  17. Notes & Errata: USB SuperCodec, August-October 2020; History of the Australian GPO, September 2020; Shirt Pocket Oscillator, September 2020; Frequency Reference Signal Distributor, April 2020; 45V 8A Linear Bench Supply, October-December 2019
  18. Outer Back Cover

This is only a preview of the November 2020 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.

Items relevant to "Eight Small LED Christmas Ornaments":
  • Tiny LED Cap PCB [16111193] (AUD $3.00)
  • Tiny LED Stocking PCB [16111194] (AUD $3.00)
  • Tiny LED Reindeer PCB [16111195] (AUD $3.00)
  • Tiny LED Bauble PCB [16111196] (AUD $3.00)
  • Tiny LED Sleigh PCB [16111197] (AUD $3.00)
  • Tiny LED Star PCB [16111198] (AUD $3.00)
  • Tiny LED Candy Cane PCB [16111199] (AUD $3.00)
  • PIC12F1572-I/SN (or equivalent) programmed for the Tiny LED Christmas Ornaments (Programmed Microcontroller, AUD $10.00)
  • Tiny LED Christmas Ornament complete kit (Component, AUD $15.00)
  • Firmware for the LED Christmas Ornaments (Software, Free)
  • Eight Tiny LED Xmas Ornament PCB patterns (PDF download) [16111191-16111199] (Free)
Articles in this series:
  • Eight Small LED Christmas Ornaments (November 2020)
  • Eight Small LED Christmas Ornaments (November 2020)
  • Christmas LED Icicle Decoration (November 2022)
  • Christmas LED Icicle Decoration (November 2022)
Items relevant to "Two Large LED Christmas Stars":
  • Stackable LED Star PCB [16109201] (AUD $12.50)
  • RGB Stackable LED Star PCB [16109202] (AUD $15.00)
  • ATmega328P-AUR or ATmega88PB-AUR programmed for the RGB Stackable LED Star [1620920A.HEX or 1620920B.HEX] (Programmed Microcontroller, AUD $10.00)
  • Kit for the RGB Stackable LED Christmas Star (Component, AUD $40.00)
  • Firmware for the 30 RGB LED Xmas Star (Software, Free)
  • RGB Stackable LED Star PCB pattern (PDF download) [16209202] (Free)
  • Stackable LED Star PCB pattern (PDF download) [16109201] (Free)
Items relevant to "Balanced Input Attenuator for the USB SuperCodec":
  • USB SuperCodec PCB [01106201] (AUD $12.50)
  • USB SuperCodec Balanced Input Attenuator add-on PCB [01106202] (AUD $7.50)
  • Parts source grid for the USB SuperCodec (Software, Free)
  • USB SuperCodec PCB pattern (PDF download) [01106201] (Free)
  • USB SuperCodec Balanced Input Attenuator add-on PCB pattern (PDF download) [01106202] (Free)
  • USB SuperCodec front panel artwork (PDF download) (Free)
  • Drilling and cutting diagrams for the USB SuperCodec Balanced Input Attenuator (PDF download) (Panel Artwork, Free)
Articles in this series:
  • USB SuperCodec (August 2020)
  • USB SuperCodec (August 2020)
  • USB SuperCodec – part two (September 2020)
  • USB SuperCodec – part two (September 2020)
  • USB SuperCodec – part three (October 2020)
  • USB SuperCodec – part three (October 2020)
  • Balanced Input Attenuator for the USB SuperCodec (November 2020)
  • Balanced Input Attenuator for the USB SuperCodec (November 2020)
  • Balanced Input Attenuator for the USB SuperCodec, Part 2 (December 2020)
  • Balanced Input Attenuator for the USB SuperCodec, Part 2 (December 2020)
Articles in this series:
  • The Matrox ALT-256 Graphics Card (October 2020)
  • The Matrox ALT-256 Graphics Card (October 2020)
  • The Vintage Matrox ALT-512 Graphics Card (November 2020)
  • The Vintage Matrox ALT-512 Graphics Card (November 2020)
Items relevant to "Flexible Digital Lighting Controller, part 2":
  • Flexible Digital Lighting Controller main PCB [16110202] (AUD $20.00)
  • Flexible Digital Lighting Controller Micromite Master PCB [16110201] (AUD $5.00)
  • Flexible Digital Lighting Controller CP2102 Adaptor PCB [16110204] (AUD $2.50)
  • Flexible Digital Lighting Controller LED slave PCB [16110205] (AUD $5.00)
  • PIC16F1705-I/P programmed for the Flexible Digital Lighting Controller [1611020A.HEX] (Programmed Microcontroller, AUD $10.00)
  • PIC32MX170F256B-50I/SP programmed for the Flexible Digital Lighting Controller Micromite master [1611020B.hex] (Programmed Microcontroller, AUD $15.00)
  • PIC16F1455-I/P programmed for the Flexible Digital Lighting Controller WS2812 Slave [16110205.HEX] (Programmed Microcontroller, AUD $10.00)
  • Si8751AB 2.5kV isolated Mosfet driver with integral power supply (Component, AUD $10.00)
  • Micromite LCD BackPack V3 complete kit (Component, AUD $75.00)
  • Hard-to-get parts for the Flexible Digital Lighting Controller (Component, AUD $100.00)
  • Flexible Digital Lighting Controller front panel PCB [16110203] (AUD $20.00)
  • Firmware and software for the Fiexible Digital Lighting Controller (Free)
  • Firmware and PC software for the Digital Lighting Controller [1611010A.HEX] (Free)
  • Flexible Digital Lighting Controller mains slave PCB patterns (PDF download) [16110202-3] (Free)
  • Flexible Digital Lighting Controller Master PCB patterns (PDF download) [16110201, 16110204] (Free)
  • Flexible Digital Lighting Controller LED slave PCB pattern (PDF download) [16110205] (Free)
  • Drilling and cutting diagrams for the Flexible Digital Lighting Controller Micromite master (PDF download) (Panel Artwork, Free)
  • Cutting diagram for the Flexible Digital Lighting Controller mains slave rear panel (PDF download) (Panel Artwork, Free)
  • Cutting diagrams and front panel artwork for the Flexible Digital Lighting Controller LED slave (PDF download) (Free)
  • Matte/Gloss Black UB3 Lid for Micromite LCD BackPack V3 or Pico BackPack using 3.5in screen (PCB, AUD $5.00)
Articles in this series:
  • Flexible Digital Lighting Controller, part 1 (October 2020)
  • Flexible Digital Lighting Controller, part 1 (October 2020)
  • Flexible Digital Lighting Controller, part 2 (November 2020)
  • Flexible Digital Lighting Controller, part 2 (November 2020)
  • Flexible Digital Lighting Controller, part 3 (December 2020)
  • Flexible Digital Lighting Controller, part 3 (December 2020)
  • Digital Lighting Controller Translator (December 2021)
  • Digital Lighting Controller Translator (December 2021)

Purchase a printed copy of this issue for $10.00.

New 8-pin PIC microcontrollers by Tim Blythman Like many microcontroller manufacturers, Microchip frequently releases new devices. It’s easy to continue using the same micros you always have, but if you do, you’ll miss out. The newer micros are often cheaper than the ones they replace and also run faster, have more memory and more features! Here’s a report on the latest low-cost, 8-pin, 8-bit micros from Microchip. W e have been using the lowcost, 8-bit PIC12F675 microcontroller for more than ten years now. It was first mentioned in the Product Showcase section of our July 2003 issue. It then went on to feature in four Circuit Notebook entries (August 2006 and September, October & December 2008) before finally appearing in a project: the 433MHz UHF Remote Switch in the January 2009 issue (www.siliconchip.com. au/Article/1284). In early 2018, we noticed that prices on the PIC12F675 were starting to creep up, so much so that the PIC12F617 was actually cheaper, despite having twice as much flash memory, twice the RAM, twice the internal oscillator speed plus two hardware PWM (pulse width modulation) channels. It is also more power-efficient. So we started using this chip from the June 2018 Temperature Switch project (www.siliconchip.com.au/ Article/11101) onwards. We do still use the PIC12F675 occasionally; for example, we used it in last year’s Tiny LED Xmas Tree (www. siliconchip.com.au/Article/12086). However. . . Just recently, it has become clear that the PIC12F675 is moving towards mature status. Microchip’s resellers are no longer offering any discounts for purchasing larger quantities. In fact, the Microchip Technology web page for the PIC12F675 (www. microchip.com/wwwproduct/en/ PIC12F675) states that a newer alternative is available, although Microsiliconchip.com.au chip assures us that the 12F675 will never be discontinued, like any of their parts. We therefore decided to investigate the other 8-pin Microchip parts, to see whether any offered benefits over the PIC12F617. New PICs There are several newer 8-bit PIC models shown on Microchip’s part selector, and all of them are superior to the 12F675, both in features and price. This can be found at www.microchip. com/ParamChartSearch/chart.aspx? branchID=1005 We’ve also produced a summary of the most important parameters, shown in Table 1. Currently, the cheapest 8-pin PIC is the PIC12F1571, followed by its bigger sibling, the PIC12F1572. The main difference between these two parts is that the PIC12F1571 has 1kwords of flash memory and 128 bytes of RAM while the PIC12F1572 has 2kwords of flash memory and 256 bytes of RAM. Australia’s electronics magazine We’re using the units of kilo-words here because these parts use a 14-bit instruction word, so this count corresponds to the number of flash memory instructions that each can store. Note that when storing data in flash, unless you do something fancy, it is common to store one byte per word, wasting the other six bits. When storing text, it is often possible to pack two 7-bit characters into each flash word, but it requires extra processing to extract this data. So while a 2kword part has 3.5kbytes of flash, that doesn’t necessarily translate into 3.5kbytes of data storage. Peripherals The only other difference between those two parts is that the PIC12F1572 features the EUSART (enhanced universal synchronous/asynchronous receiver/transmitter) peripheral. Other features on the PIC12F1572 not seen on the PIC12F675 include a 5-bit DAC, which can be internally connected to other analog peripherals like the ADC or comparator. The PIC12F1572 also has six timer peripherals compared with the older parts’ two. It can produce three PWM waveforms without software intervention. The PIC12F675 does have 128 bytes of EEPROM which the newer part lacks, although the PIC12F1572 does have the ability to write to its own flash memory, of which 128 bytes is designated as high-endurance (same for the 1571 and 1612). These 128 bytes of flash are intended to be used in the same fashion November 2020  83 PIC 12F675 12F617 12F1571 12F1572 Released 2003 2010 2013 2013 Cost (1xDIP) $1.66 $1.33 $0.94 $1.01 Flash words 1k 2k 1k 2k RAM 64b 128b 128b 256b EEPROM 128b None None None Max int. oscillator 4MHz 8MHz 32MHz 32MHz PWM channels 0 2 3 3 Timers 2 3 6 6 DAC No No 5-bit 5-bit Supply range 2.0-5.5V 2.0-5.5V # # Standby current 1nA 50nA 20nA 20nA µA/MHz 100 65 30 30   #1.8-3.6V (LF variants) or 2.3-5.5V (F variants) 12F1612 2014 $1.28 2k 256b None 32MHz 2 5 8-bit # 50nA 32 Table 1 – 8-pin PIC comparison as EEPROM, so combined with the generally larger amount of flash memory available, it is not a significant downgrade. May 2019 issue at siliconchip.com. au/Article/11628) can be used to program these parts. Other parts Like many new 8-bit PICs, the PIC12F1572 has a 32MHz internal oscillator which can be set in software to run from 31kHz to 32MHz in powers of two. So instructions can be processed at up to 8MHz, or eight times faster than the PIC12F675 and four times faster than the PIC12F617. Many newer PICs (including parts like the PIC16F1455 which forms the Microbridge interface on Micromite BackPack PCBs) also feature a larger instruction set compared to the earlier parts. The new instruction set includes opcodes which allow access to larger memories and suit indirect addressing modes. Indeed, there is a swathe of new peripherals which can be found in varying combinations on the other 8-pin PICs. Peripheral Pin Select, a common feature on PIC32 devices, now provides the option of swapping most digital peripherals to alternative pins. This can be done while the device is running, so many of these can be changed at will. Some chips have a numerically controlled oscillator, which can be used to generate a square wave with a 50% duty cycle and precise frequency. A voltage reference (FVR) peripheral also provides several reference voltages; typically 1.024V, 2.048V and 4.096V. Depending on the device capabilities, these may be directed internally to the ADC, DAC or comparator peripherals. Of course, it is the varying combinations of these peripherals which provide the great diversity in part numbers. These peripherals also have the benefit of doing in hardware what might have previously been done in software, freeing up processor resources for other functions. Another hardware change is that low-voltage programming (also seen on PIC32 devices) is also common. This means that the VPP high voltage (typically 9-13V) is not needed. So economical programmers such as the Snap (see our review in the 84 Silicon Chip Processor speed use more power. Quite the opposite; they generally use less energy at the same speed compared to the older chips. There are even more low-power modes which can be used to reduce power consumption by shutting down parts of the micro which are not currently used (including the processor, in “sleep” mode). Many parts also have ‘LF’ variants which offer even lower power consumption and low-voltage operation, at the cost of a reduced maximum operating voltage. The key factor here is the removal of an internal voltage regulator which powers the core. For example, the PIC12F1572 can operate from 2.3V to 5.5V, while the PIC12LF1572 works in the lower 1.8V to 3.6V range. The so-called ‘enhanced’ parts can be identified by the part number, usually of the form ‘PIC1XF1XXX’, although five-digit part numbers are also used. More information can be found in the migration guide http:// ww1.microchip.com/downloads/en/ DeviceDoc/41375A.pdf Pin compatibility Fortunately, the newer 8-pin parts are generally pin-compatible with the older parts. In particular, the power and programming pins (including MCLR) are all in the same locations. The older parts use the “GP” designation for their (single) GPIO port, but the newer parts designate these as belonging to the “RA” port. Some of the eight-pin parts even have 14-pin and 20-pin siblings which are also pin-compatible on the ‘top’ eight pins. This makes it easier to move from smaller to larger parts, or make code work on a range of parts. For example, the eight-pin PIC12F1612 belongs to a large family which includes the 14-pin PIC16F1615 and the 20-pin PIC16F1619, with broadly similar features within the family. These parts all boast an 8-bit DAC. Migration Some of the new instructions are designed to allow C language features to be compiled more efficiently and effectively, meaning less need for writing code in assembly language. Although these processors can run faster, that doesn’t necessarily mean that they will Australia’s electronics magazine As an example, we got hold of some PIC12F1572 chips and used them instead of PIC12F675 chips on some of our Christmas decoration prototypes, to see if it would be possible to ‘migrate’ our design to the newer PICs. The software for the decorations is very simple. The pins are driven directly as GPIO (general purpose input/ siliconchip.com.au output) pins. The only peripheral that gets any real use is the watchdog timer, which is used to wake the processor up after it sleeps to conserve power. Note that the PIC12F1572 has a slightly narrower supply voltage range, working from 2.3V to 5.5V, compared to the PIC12F675 working from 2.0V to 5.5V. But since lithium cells usually don’t drop below 2.3V until they are pretty much exhausted, this won’t have much effect on cell life. For both the GPIO and watchdog timer, we had to make code changes. For the GPIO ports, this was simply a matter of changing the names which we used to refer to the I/O ports. We ‘cheated’ by adding three #define directives at the top of the source file to create aliases, allowing us to continue using the older register names: #define ANSEL ANSELA #define TRISIO TRISA #define GPIO LATA The watchdog timer has changed because it now has more features, and those extra features didn’t fit within the same set of control registers. An instruction to allocate a prescaler from the T0 peripheral to the watchdog timer is no longer needed as the watchdog timer now has its own prescaler. The register which sets the prescaler value has also changed. Thus, the command which sets the different prescaler values to get different watchdog timeouts had to change as well. This is necessary to achieve the specific LED flash rate and intervals. Interestingly, because the watchdog timeout intervals are not continuous, we could not get precisely the same 18ms/72ms periods as we had with the PIC12F675. The closest equivalents for the PIC12F1572 are 16ms/64ms, meaning that decorations with the newer PIC flash slightly faster. The chip configuration directives are different. We only had to make two changes from the defaults. The first one was to disable brown-out resetting, as this allows the decorations to continue flashing even when the cell voltage gets quite low. Since it is hardly a critical device, glitchy operation at low voltages is better than shutting down prematurely. We also enable the internal oscillator as the main clock source, instead of an external crystal. By default, the PIC12F1572 starts up at 500kHz. We could change this, but since it spends so much time in sleep mode and does very little actual processing, that doesn’t make any real difference. Conclusion Progress marches on, and older devices are slowly being replaced by newer designs. For the most part, the extra features make it a worthwhile change, with better resources, peripherals and processor speeds. It pays to keep track of newer parts being released by manufacturers, so you can migrate your code to them before the old parts are prohibitively expensive or hard-to-get. The 12F1572 isn’t even the newest 8-pin PIC; Microchip has recently released the PIC16F15213. To future proof ourselves, we’re going to distribute our new Ornament kits with programmed PIC12F1572 microcontrollers instead of the PIC12F675. Except for the slightly faster flashing rate, constructors won’t notice any differences. The construction process SC is the same. Build the world’s most popular D-I-Y computer! ALL-NEW COLOUR 2 480MHz, 32-bit proce ssor; 9MB of RAM ; 2MB flash m emory; 800 x 600 pix el colour displa y SILICON CHIP Don’t miss your opportunity July & August 2020 to experience Australia’s own world-class, world-famous single board computer that you build and program yourself! See And it’s so easy to build because all the hard work is done for you – the heart of the Colour Maximite II, the Waveshare CPU Module (arrowed) is completely pre-assembled and soldered. Short Form Kit includes: Waveshare CPU module pre-loaded with MMBasic the PCB front & rear panels and all other components required to build Does not include the plastic instrument case, the Colour Maximite 2 CR12xx cell or USB power supply/cable 14000 $ All this for only Plus $10.00 P&P in Aust 10%! SILICON CHIP Subscribers: Subscriber’s price just $126 plus $10 p&p $AVE Order now (or more information) at www.siliconchip.com.au/shop/20/5508 siliconchip.com.au Australia’s electronics magazine November 2020  85