News:

Let's find out together what makes a PIC Tick!

Main Menu

Compiler moving to faster micros?

Started by Ecoli-557, May 09, 2025, 04:36 PM

Previous topic - Next topic

top204

#20
Many thanks Bob.

I have a PICkit4, and it does not support the newer devices (again, the American way, because it would if programmed too, because the circuitry is all there to do so). LOL

It is difficult finding information on supported devices with that ICSP unit, so I do not know if it is suitable. But many thanks. I have a sneaky feeling they have ripped off the mikroelektronika programmer unit, which was absolutely dreadful. But...... It is using a "32-bit Arm" microcontroller operating at hundreds of MHz, so it "must" be good, according to them.

What a load of bullshit.... It is just a 'bloody' device programmer, not a starship navigation unit, navigating to another solar system, and also maintaining life support! :-)

Best regards
Les

Fanie

I have always said that Microchip makes awesome hardware, until it gets handed over to the software ....
But, it's not just them, Arduino does the same.  Espressif makes a very nice programmer, but do you think you can write a hex file into a micro ?  And just try to find the programmer.  They want you to buy a 3rd party board to write your code into a micro.

What is in the pickit4 that does not allow newer pics to be programmed ?
Can it be an external file created for a micro that prevent in it the programmer from using it ?

Fanie

#22
QuoteI have a PICkit4, and it does not support the newer devices (again, the American way, because it would if programmed too, because the circuitry is all there to do so). LOL

pickit 5 vs pickit 4  - The only functional differences are the use of the USB-C connector (instead of the older micro-B USB) and Bluetooth connectivity.

MPLab IPE is supposed to upload the micro selected files so you can program that one.
What is a bit retarded is that if you select a "slower" micro is you have to tell the IPE to program slower.

It is possible that since Microchip buy other micro's up with different structures that a problem can arise from that.

https://packs.download.microchip.com/DeviceDoc/Device_Support.pdf


Stephen Moss

Quote from: Fanie on May 20, 2025, 03:13 PMWhat is in the pickit4 that does not allow newer pics to be programmed ?
It may just be a software issue, in that Microchip stop updating the firmware with support for new devices, thus you have to purchase their latest PICkit incarnation to program newer devices.
They did the same with the PICkit 2 & 3, when the PICkit4 came out, hence why myself and others started using software like PICKitPlus/PICkitMinus as that allows us to program the newer devices with the older programmers. It has been a while since I did any PIC work so if you are having problems programming a particular device it may be worth checking them out to see which programmers and devices they currently support.

Fanie

#24
Quote from: Stephen Moss on May 22, 2025, 08:06 AMIt may just be a software issue, in that Microchip stop updating the firmware with support for new devices, thus you have to purchase their latest PICkit incarnation to program newer devices.
They did the same with the PICkit 2 & 3, when the PICkit4 came out, hence why myself and others started using software like PICKitPlus/PICkitMinus as that allows us to program the newer devices with the older programmers. It has been a while since I did any PIC work so if you are having problems programming a particular device it may be worth checking them out to see which programmers and devices they currently support.

I discussed the programmer issue with my brother, and he said that the firmware is supplied by Microchip.  I think if you re-install the MPLab IDE it could perhaps solve the problem with newer devices.  Apparently the PICkit4 still have sufficient hardware to support any of the newest pics.
This file https://packs.download.microchip.com/DeviceDoc/Device_Support.pdf indicate the PICkit4 program all the pics and is listed at the end of the document.

If you search any micro using Everything, you will see the list of files associated with that micro.

It is possible that the PICkit2 & 3 did not support certain functions required for the newer larger micro's, perhaps the size of the SD card that can be saved to for programmer-on-the-go or another issue like program speed.

My brother said the 33AK Les mentioned has some very nice peripherals and he used it in a project.

JonW

Many programmers today rely on brute-force approaches—cranking up clock speeds and throwing more processing power at problems—rather than developing deeper technical skills. While good compilers certainly help, nothing beats understanding your target hardware architecture, its instruction set, and designing efficient code flow. This combination delivers blazing performance that raw speed alone can't match.

Breaking complex operations into small, efficient tasks and measuring execution times seems foreign to many younger developers. There's an excellent YouTube video demonstrating L1 cache optimization and how C programmers often overlook that a single bit declaration can consume 64 bits of memory, or that bitwise operations sometimes require floating-point routines depending on the allocation  of memory and the compiler.

Take the humble Padauk microcontroller—costing under 10 cents—with its multiple FPPA (Field Programmable Processor Array) or time-sliced soft cores. For simple real-time processes, these chips outperform ARM Cortex-M3 processors. This illustrates how understanding underlying processes, rather than simply increasing clock speeds, can reduce costs, improve reliability, and simplify code.

While I'm not a full-time programmer, I believe I can write more efficient code using devices that cost and consume a fraction of what others typically employ. My experience with the RP2040 and ESP32 was disappointing—30KB of code just to blink an LED was excessive. Arduino-based WiFi projects quickly exhausted device memory. I achieved the same functionality using a Wiznet chipset and an 8-bit PIC microcontroller in under 4KB.

This reminds me of Bill Gates' infamous comment about 512KB being sufficient for any task. Now my phone probably uses several megabytes just to boot up—a testament to how far we've drifted from efficient programming practices.

Oskar-svr

#26
When I started this whole adventure, I did it with INTEL microprocessors, such as the 8080, 8088, and the glorious Z80. I understood the topology of the architecture of interfaces such as memory and peripherals, among many other things. It was very important to understand how a microprocessor and a microcontroller work, in machine language, learn the instruction set of each device, understand how the instructions work and what they are for, take into account the clock cycles that each instruction executes, and with this, calculate the time each instruction takes in a programming line.
For example, if you wanted to create a 500 ms delay, you had to know what the set of instructions you needed was, and when you started the program, this depended on how many programming lines were needed, and we calculated all the clock cycles that all the instructions used took to reach the optimal delay—not easy at all.

Nowadays, it's very easy to use with the compiler POSITRON; just type the DELAYMS 500 instruction and that's it, your delay is ready.
In truth, knowing the instruction set in machine language helped us optimize the code due to the limitations of an EPROM memory.

Today, the new generations want it very easy, like in the case of Arduino and all those new systems, everything is based on libraries that make life easier, and as JONW says, they don't understand or don't know how to optimize a program. I don't mean to say that I'm against the new high-speed chips, but few understand what I mentioned before.
I don't know if they know what a clock cycle is, as a note, and with this, how to choose an 8, 16, or 32-bit device to carry out a project and even how to determine so that the cost is not high. In my experience, in a project I advised, people wanted to use a Spartan FPGA, and when I explained the differences in cost and functionality, they leaned toward a PIC16F877.
Speed ��is not the solution as it says. JONW

Fanie

QuoteSpeed ��is not the solution as it says. JONW
Says all the guys with slow bikes  ;D

RGV250

QuoteSays all the guys with slow bikes
I have an RGV250 and I am not complaining about the lack of top speed as it is faster round corners and much more fun :)  :)  :)  :)

And the lovely 2 stroke noise !

top204

#29
You are correct Fanie. I updated the MPLABX to version 6.25, and the MPLAB IPE software now has the dsPIC33AK devices in it. Many thanks. :-)

There are so many wise, and intelligent, people on this forum, and following this post shows how rational and down-to earth you all are.

Wimax

Having done, I think, a good job with the CK/CH series I thought Microchip intended to continue on the right track with the right slope. On paper the AK series is presented as a successor with a number of supposed architectural improvements that apparently can be compared to the numbers of a good race car, but light years away from a Ferrari.
Les, I was struck by what you were able to discover, apparently it seems more like a regression than an evolution of the species.
Indeed some of the choices made by Microchip seem to lack logical sense, not to mention the inefficiency of the C compiler.
I imagine they must have invested time, money and resources to come up with a new series of microcontrollers from the previous series, having well in mind what requirements to meet...but maybe I am wrong.
However, I am pleased to see that you are continuing to analyze the new series.

trastikata

Check this out, I just found out that the latest MPLABX 6.25 IPE no longer supports PICit3 ... simply doesn't show anymore under devices, had to revert back to 6.20 and lost time for nothing removing and installing back 6.20 ...

Fanie

Quote from: top204 on May 23, 2025, 09:31 AMYou are correct Fanie.

 :o   I will have to show this to the wife, although I doubt she will believe it.  ;D

Quote from: RGV250 on May 23, 2025, 07:01 AMI have an RGV250 and I am not complaining about the lack of top speed as it is faster round corners and much more fun :)  :)  :)  :)

And the lovely 2 stroke noise !

When I was still in school I had a 50cc Suzuki, two stroke, but slow, just one step up from walking.  My mother got piano lessons and the tutor had an RD350, and when he arrived he handed me the key's.  Now that was fun for a 16 year old...  Had the nickname Big Bike Killer.  Many of the big bike riders back then squirmed when you pull up with an RD350.

Find a friend with a GSX-R1000RRR...R and take it for a ride.  There is a severe difference in the newer bikes performance vs the older ones.  Under 4000rpm it's very tame, beyond that and over 6000rpm it gets nippy and you move from the lower slow earth to the middle earth  ;D  world.  The higher godly fast world is micro clocks, RF and explosives, and bike pistons.  (Referring to ancient times, apparently earth was divided into lower earth where the humans lived, middle earth where the trolls lived and upper earth where the gods lived.  Since the trolls moved into lower earth too, you have an opportunity to briefly elevate to middle earth...)
Consider that at 6000rpm that each piston moves up and down 100 times in a second.  Bikes can double that  8) The one thing scares me of the V engines is that the one piston shows directly to the family jewels.  If that piston comes out there  :o


Fanie

I assume that since Bobby is not replying that he is still out trying to find a friend  ;D

RGV250

Just no point arguing with a straight line merchant.

top204

#35
Please keep your comments civil and not as rude as some have been lately Fanie.

This type of behaviour will not be tolerated on this friendly forum, and I will suspend, or even ban any users who "go over the top".

Always remember, some types of humour do not work well in the written language, and can be taken as insulting, even when they are not intended to be, with sarcasm and piss taking as two of the types that do not transfer to written texts well.

Regards
Les

Fanie

Please explain my rude comments so I can correct in future.  Thank you.

charliecoutas

Talking about hardware speed and software efficiency brings back a wonderful memory from about 1965: I was working in the maths dept of a Hawker Siddley company, working on the beautiful Elliott 803. It ran at around 2000 instructions per second. The tape reader could go at 500 chars/sec. One of the mathematicians challenged us to write a program that could check the parity of 8 track paper tape in the fastest possible way. We struggled with clumsy checks but then one guy, John D, wrote code that would drive the reader at full speed!

We were all so impressed. How did he do it? With a simple lookup table of 256 values. Read a character from tape, then jump to that value in the table, three instructions. All the odd entries were parity fails. I think that was a valuable lesson for me and I hope it has stuck. Make it simple.

I buy a newspaper every day at a Co-Op in town. I wonder how much code the self-service machine has, I'll bet it's many megs. The care that has gone into its design seems minimal: 15 seconds after it has accepted your credit card (and you have left the shop), it announces "Thank you for shopping at the Co-Op".

Hey-ho, keep doing your fabulous work Les.

Charlie


Wimax

Just to rember a masterpiece of coding: the Luminary for the AGC of the LEM of Apollo program, only 36 KB for a real-time computer interfaced with sensors and actuators...Just to land on our natural satellite more that 50 years ago !