What (4 or 5) micros to buy?

Thread Starter

atferrari

Joined Jan 6, 2004
4,764
I realized I would like to catch up with the new peripherals in 18F micros so I intend to buy 4 or 5 to get reasonably familiar with most of what came after the original 18F part of the family (bought my last about 6 years ago).

Been perusing the lists in MCHP site but found overwhelming the variety and hard to narrow a selection (!!!)

Found Q10 / Q40/Q41 / Q43 / 18J and 18K. PDIP /SOIC packing is what I would like to keep buying for this test.

Concrete suggestions appreciated, even those that I should skip for any reason.
 

Ian0

Joined Aug 7, 2020
9,668
Buy anything you can get, and stockpile them!
But seriously. . .
About 6 years ago, I made the break from 8-bit and changed to ARMs and have never wanted to return to 8-bit. The ability to use numbers greater than 255 without any software overhead was a revelation!
But some of the ARM peripherals are mighty complicated, but once you have mastered them the amount of things they can do on their own is impressive - i.e. ADCs that can sequentially scan all the inputs and average them compare with references and interrupt, timers with multiple states etc.
 

Thread Starter

atferrari

Joined Jan 6, 2004
4,764
I use 8-bit when I need something that's practically indestructible in a harsh operating environment. The advanced 8-bit controllers have scanning and computational ADC too. Many of the complex 32-bit peripherals have implementations in the latest 8-bit architectures.

https://www.microchip.com/en-us/pro...g-to-digital-converter-with-enhanced-features
Few weeks ago, I heard occasionally of ADCC. When browsing the mass of "new" (for me) micros, I realized how many new peripherals and complements exist.
 

Ian0

Joined Aug 7, 2020
9,668
I work in Assembly only and feel reluctant to start with C. The main reason.
A fellow assembler fan! I've tried C and didn't much like it. You should try ARM assembler.
Have you ever use ATMega devices? Cortex M0 assembler looks much the same, except you have 32 bit numbers.
Cortex M3/M4 still has only a small number of instructions, but adds some really handy ones!
It would be wrong to say that the ARM was based on the 6502, but the people who designed it had an awful lot of experience on 6502s.
 

Thread Starter

atferrari

Joined Jan 6, 2004
4,764
A fellow assembler fan! I've tried C and didn't much like it. You should try ARM assembler.
Have you ever use ATMega devices? Cortex M0 assembler looks much the same, except you have 32 bit numbers.
Cortex M3/M4 still has only a small number of instructions, but adds some really handy ones!
It would be wrong to say that the ARM was based on the 6502, but the people who designed it had an awful lot of experience on 6502s.
I will take a look. Piqued my curiosity.
 

MrChips

Joined Oct 2, 2009
30,711
I work in Assembly only and feel reluctant to start with C. The main reason.
I admire your determination for adherence to ASM. I always promote ASM as the first language to learn when embarking in acquiring knowledge in embedded systems. You have a solid foundation on the principles of MCU technology.

Give C a try. We can help you along. You may find that C constructs are no different from ASM constructs.
Moreover, your programming efficiency will increase 1000-fold. Added to that, your code can be easily portable from one MCU to another. You will be able to benefit from other manufacturer's MCU families.
 

MrSalts

Joined Apr 2, 2020
2,767
Back with microcontrollers had limited program memory, ASM was the way to go. Now, even the cheapest microcontrollers seem to have more memory than I need when written in C.

C with Timer interrupts is also a much more efficient way to time an event instead of counting executed instructions. I always fell back on counting instructions instead of using interrupts when I programmed in ASM (I don't know why).
 

Ian0

Joined Aug 7, 2020
9,668
Oh no, the great C vs. assembler debate! It won't end well . . . (Moderators on standby to close the thread when things get nasty)
I admit that assembler for 8-bit devices is a real pain as soon as you need a number >255, but how many of those who prefer C have written assembler for a 32-bit device?
As for portability - it is a complete fallacy. I'm currently changing from NXP Cortex-M3 devices to Renesas Cortex-M3 devices - the software isn't portable at all. Each manufacturer uses completely different peripherals, so most of it will have to be re-written.
 

MrSalts

Joined Apr 2, 2020
2,767
Oh no, the great C vs. assembler debate! It won't end well . . . (Moderators on standby to close the thread when things get nasty)
I admit that assembler for 8-bit devices is a real pain as soon as you need a number >255, but how many of those who prefer C have written assembler for a 32-bit device?
As for portability - it is a complete fallacy. I'm currently changing from NXP Cortex-M3 devices to Renesas Cortex-M3 devices - the software isn't portable at all. Each manufacturer uses completely different peripherals, so most of it will have to be re-written.
Agree with your portability fallacy comment. Setting up the registers for an ADC or PWM is way different. Timers are different. Anyone doing something "cute" or "clever" with one microcontroller will take some work to figure out how to do it on another -whether in c or asm. Maybe a BCD to 7-segment translator or font data for a display can be copied/pasted easily but, I don't see anyone grabbing the cheapest micro off if a shelf, I see people using what they are familiar with. Life is too short to keep learning different flavors of micros each week.
 

MrChips

Joined Oct 2, 2009
30,711
There is a fallacy on the portability fallacy comment.

One cannot expect 100% portability with zero code changes. The hardware is different. The way modules are programmed and interfaced is different. If one designs the software with library functionality one only needs to modify the low level interface. Depending on how one designs, configures and organizes the software-hardware interface one can achieve a high degree of portability.

Here is an example. I recently created a data acquisition system that uses an nRF24L01+ RF link between two systems.
On end of the link uses an STM32 ARM MCU. The other end uses an ATMEL AVR MCU. Both systems use the same RF library to interface to the nRF24L01+.
 

MrSalts

Joined Apr 2, 2020
2,767
There is a fallacy on the portability fallacy comment.

One cannot expect 100% portability with zero code changes. The hardware is different. The way modules are programmed and interfaced is different. If one designs the software with library functionality one only needs to modify the low level interface. Depending on how one designs, configures and organizes the software-hardware interface one can achieve a high degree of portability.

Here is an example. I recently created a data acquisition system that uses an nRF24L01+ RF link between two systems.
On end of the link uses an STM32 ARM MCU. The other end uses an ATMEL AVR MCU. Both systems use the same RF library to interface to the nRF24L01+.
Yup, the libraries can be interchangeable if you are using common library functions but, library functions for most data acquisition or UI or whatever devices are widely available for all devices so, as you said, the only thing that has to be developed and not ported across Micros, is the low level setup. Complete waste of time to try to port in many cases - much easier to just download libraries for the micro platform you are using and develop from scratch.
 

click_here

Joined Sep 22, 2020
548
Sure assembly is portable - I'll just copy over my encryption/decryption code I wrote on a PIC to an AVR and... Why are there so many errors? Oh that's right, they are different instruction sets.

Where as if I wrote it with nice portable C for the algorithm, I can just copy it over. One more, I can just include the same header file and they can share it.

Back to the original question - I really like the newer PICs with PPS, like the PIC16F15325
 
Last edited:

dcbingaman

Joined Jun 30, 2021
1,065
I have programmed both microcontrollers and even PC's in assembly. Back in the days of DOS I had to program a graphics application that used VGA all in assembly language for the '486 processor. Now I pretty much prefer C for microcontrollers. Though for microcontrollers it does not matter to much. The code is not portable to another application anyways. So kind of a personal choice. The only advantage I have found with C is I can create high level libraries for my specific application. Now I may need to rewrite the code for them if porting to another platform but by having a good abstraction layer my application code does not have to change just the low level stuff. I also do not prefer vendor libraries (like Harmony). I prefer to know what is going on under the hood. The datasheets tell you everything you need to know to program a given peripheral with just reading/writing to registers. I do happen to use the libraries that make the registers along with the names available to you and they match the datasheets. I prefer to not have to create them myself as it is down right painful being there are hundreds of control registers in a modern microcontroller.
 

dcbingaman

Joined Jun 30, 2021
1,065
Wish I had more micros suggested instead of C / Assembly comments.
That depends what you intend to use it for that is your 'requirements'. If a USB based application then one type if a Ethernet application then a different one. If a complex video processing application another type. If you are just trying to catch up on the latest, I don't think it matters much which one you choose. For learning purposes I would recommend a general purpose one that is not specialized in any specific area.

Personally when it comes to microcontrollers I prefer the PIC32 series or any 32bit one. They are competitively priced compared to 8 or 16 bit micros and not as limited in capabilities. They are more flexible IMHO. Of course if you work for a company making 1 million toaster ovens then you probably only want to use 8/16 bit to save money. Naturally a 32bit can handle a toaster oven but a little on the overkill side.
 
Last edited:

Thread Starter

atferrari

Joined Jan 6, 2004
4,764
That depends what you intend to use it for that is your 'requirements'. If a USB based application then one type if a Ethernet application then a different one. If a complex video processing application another type. If you are just trying to catch up on the latest, I don't think it matters much which one you choose.
I see.
 

MrSalts

Joined Apr 2, 2020
2,767
I would buy some ESP32 modules - wifi enabled projects are so much fun. You can download the Espressif IDE or Arduino IDE and work from the examples to modify them and do surprising things. Even private networks with phone to ESP32 and serve web pages that allow you to control whatever you want. PIC was fun and useful back 10 to 30 years ago but the ESP32 with 32-bit processing, wiFi, bluetooth and low power modes. I use them all the time for secure point-to-point communication and control.
 
Top