CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

AI, Claude Code and CCS PIC-C

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
guy



Joined: 21 Oct 2005
Posts: 300

View user's profile Send private message Visit poster's website

AI, Claude Code and CCS PIC-C
PostPosted: Mon Aug 24, 2026 4:43 am     Reply with quote

What's the current status of using Claude AI to write PIC-C code? please share your experience as I am about to start a big dev. project and I want to know if AI can take some of the load off.
PLEASE no extreme comments in favor/against AI, just real world experience with Claude (other chats give really poor results AFAIK)

Thanks!
Ttelmah



Joined: 11 Mar 2010
Posts: 20125

View user's profile Send private message

PostPosted: Tue Aug 25, 2026 3:35 am     Reply with quote

Artificial Intelligence == Real Stupidity

They can write some bits of reasonable code. However I set several tests
to write PIC-C code, and all resulted in common faults in the chip setup,
detail configurations, and peripheral setup.
If you setup the peripherals in advance, and just get them to write the
main code, and are very careful to specify the task carefully, and the actual
connections and peripherals carefully, then you may get reasonable results.
A few users here have had success with several of the AI engines.
Claude is better than most, provided you define the problem with care.
temtronic



Joined: 01 Jul 2010
Posts: 9656
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Tue Aug 25, 2026 5:36 am     Reply with quote

AI == Absolute Idiot

I trust them as much as I do Proteus and other 'simulators'.

As Mr.T points out ,it's the 'setup' AND verification where AI has problems.

You also lose control over how code is cut. Pretty sure AI has never read 'Tips & Tricks'.
Kinda curious now, IF it could handle the 'Out of ROM, program too big for a segment' error code.

I looked at Claude,but it wanted by email and such.....so didn't actually get any further.
guy



Joined: 21 Oct 2005
Posts: 300

View user's profile Send private message Visit poster's website

PostPosted: Fri Aug 28, 2026 5:03 am     Reply with quote

Generally I agree with both of you, and thank you for bringing up the weak points. It's very appealing to use it, assuming I supervise the process and give the AI specific tasks, treating it as a rookie.

Assuming I am letting AI handle algorithms with 99% pure C code, are there tools for it to test the code, run QA and find the bugs itself?

Thanks
temtronic



Joined: 01 Jul 2010
Posts: 9656
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Fri Aug 28, 2026 5:33 am     Reply with quote

No 'simulator' or 'computer testing computer' is the REAL WORLD.
It's in the details.....

Say your program has a keypad. How does an AI generated test program handle 'wrong key' presses, two keys pressed at once ? Something a human can and will do.

If the program reads a temperature sensor, can the AI test program handle a bad reading or see a disconnected sensor ?

Can any AI test program deal with a power supply drop or a 'glitch' from the toaster int he other room popping up ?
Ttelmah



Joined: 11 Mar 2010
Posts: 20125

View user's profile Send private message

PostPosted: Fri Aug 28, 2026 1:01 pm     Reply with quote

I think that is the key distinction. Years ago, I used a smart system to perform
optimising on a FPGA. Using a real FPGA, with a 'learning' algorithm, to run
all the combinations. It came up with a solution, that theoretically would
not work, by 'cheating' using the internal propogation delays to allow it
to save a gate, and get a solution that ran faster than should be possible.
So set the problem carefully, and sometimes smart systems can perform
surprising answers, but you need to be sure that you are testing on real
world values not just theoretical combinations.....
elcrcp



Joined: 11 Mar 2016
Posts: 66
Location: izmir / Turkey

View user's profile Send private message

PostPosted: Fri Aug 28, 2026 4:03 pm     Reply with quote

I can't say for PIC-C but I made it make a good work with mplab-x. Used claude code to prepare a project with my custom design hobby card with dsPIC33CH512MP508 which is a confusing microcontroller. ADC, DAC, SPI, IIC, UART, DMA, double core for different tasks, message passing between cores, oled screen menu, keypad inputs, messaging with an esp and a browser page coded in that project. That was coded for mplab-x But I'm sure it can write a good code for ccs-c for too. Key points are supplying with documentation, a good project explanation, hardware explanation and so. After supplying these, manual tests and feedbacks makes you reach to goal.

But of course you need to know what you are doing and have to have knowledge to check the code written by ai.

As a reminder, since you have to make ai learn coding with ccs-c, you need to feed detailed PIC-C documentation for functions and microcontroller files to ai and it may be really costly. I don't know since I haven't tried it but claude or gemini might already know ccs-c functions and might write a decent code for PIC-C.
_________________
There is nothing you can't do if you try
guy



Joined: 21 Oct 2005
Posts: 300

View user's profile Send private message Visit poster's website

PostPosted: Sat Aug 29, 2026 2:59 pm     Reply with quote

elcrcp, it sounds like a big project! Although (if I understand correctly) you didn't use the CCS compiler, please share some more details about the process of working with AI ?
I tried using simple AI models, they consumed more time than it would have taken me to write or copy-paste-edit the code myself. Sometimes they could never even follow my instructions through and I had to finish the job myself. Did you also experience this?
temtronic



Joined: 01 Jul 2010
Posts: 9656
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Sat Aug 29, 2026 8:23 pm     Reply with quote

curious, it'd be interesting to see if AI can take a working PIC program from another C compiler and successfully convert into PIC C.
elcrcp



Joined: 11 Mar 2016
Posts: 66
Location: izmir / Turkey

View user's profile Send private message

PostPosted: Sun Aug 30, 2026 6:23 pm     Reply with quote

guy wrote:
elcrcp, it sounds like a big project! Although (if I understand correctly) you didn't use the CCS compiler, please share some more details about the process of working with AI ?
I tried using simple AI models, they consumed more time than it would have taken me to write or copy-paste-edit the code myself. Sometimes they could never even follow my instructions through and I had to finish the job myself. Did you also experience this?


Yes I experienced that as well. When you work on browser (using ai directly on it's website) project size may exceed context size, may disregard previous instructions or even may change the code it wrote half an hour ago. If you are trying to write a simple code part it is efficient to use ai on browser, explain what you need and just copy paste the result and then test. But if you are trying to create a project from zero with thousands of lines then it will fail. You need to use an agentic ai which will keep logs for progress, changes, requirements, memory, working history etc. That way it can keep itself and project frame under check while making progress.

I don't think I can explain coworking with AI clearly, you need hands on experience for yourself but as I mentioned on previous post, you need to explain everything clearly to ai so it won't make assumptions.
My way to do things is preparing a document for ai to read, a very detailed explanation, what is needed, how it is needed, what are restricted, what to aim what to keep out etc. Supply it with technical documents and make it depend on these documents (it tends to assume things and use general data on it's database).

Learning to guide AI is not that hard, you will learn it fast but keep yourself up with the job always. I'm feeling that my coding skills are degenerating after starting getting help from AI .
_________________
There is nothing you can't do if you try
elcrcp



Joined: 11 Mar 2016
Posts: 66
Location: izmir / Turkey

View user's profile Send private message

PostPosted: Sun Aug 30, 2026 6:34 pm     Reply with quote

temtronic wrote:
curious, it'd be interesting to see if AI can take a working PIC program from another C compiler and successfully convert into PIC C.


I'm pretty sure it is among the most simple tasks for an AI. I actually got curious and checked it on claude while writing this post. And yes, it actually can convert a xc8 code for PIC-C.
_________________
There is nothing you can't do if you try
Ttelmah



Joined: 11 Mar 2010
Posts: 20125

View user's profile Send private message

PostPosted: Tue Sep 01, 2026 5:59 am     Reply with quote

The big question then is "does it work"?.....
Again as others have posted, I have found even the best AI's, can do
many things but as yet, building a complete program, or converting
working code, usually results in little bits that don't quite work.
elcrcp



Joined: 11 Mar 2016
Posts: 66
Location: izmir / Turkey

View user's profile Send private message

PostPosted: Tue Sep 01, 2026 3:54 pm     Reply with quote

Ttelmah wrote:
The big question then is "does it work"?.....
Again as others have posted, I have found even the best AI's, can do
many things but as yet, building a complete program, or converting
working code, usually results in little bits that don't quite work.


That's true, they make many errors no matter how famous AI it is, never expect a perfect result on first try. But after giving feedback with compiler errors or things you catch with live test, they cover these errors. It may take random number of try&fail and it also may take more time than your coding. there are no guaranteed results and speed but in the end, they can and will write the right code. That is my experience with the ai as for now.

I make ai write code for esp32, stm32, dsPIC, xmc and even for VNC-II. And all worked as they should in the end. But almost (almost!) non of them worked fine right after first try. They use wrong register names or SFR names, miss some conditions to do something etc. But they correct them in the end (or you point out what to correct sometime).
_________________
There is nothing you can't do if you try
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group