Custom programming language for microcontroller?

Thread Starter

AverageMoss

Joined Apr 24, 2021
34
Is it possible to create a custom IDE for a Microchip microcontroller that could compile and upload a custom programming language? Or at least something along those lines?

I had the idea of developing my own PLC with a much more flexible and easy-to-understand text-based programming language.

This is just an idea for now but I've started looking into it recently and I'm not sure how I would go about designing custom software to interface with custom hardware.

If anyone knows how to explain this it would be greatly appreciated!
 

WBahn

Joined Mar 31, 2012
29,481
Of course it's possible, but it would be akin to someone asking if it is possible to create a jet engine that runs on gasoline and then saying that they have just started looking into what a jet engine is.

You have a LOT of work to do to place yourself into a position to do what you are talking about. You need to learn how each step of the process works, in depth.
 

BobTPH

Joined Jun 5, 2013
8,069
I have done it twice. But I have 52 years experience, all in compilers, text editors, IDEs, assemblers, linkers, basically every programming tool there is.

Edited: bad math on the years. corrected
 

Thread Starter

AverageMoss

Joined Apr 24, 2021
34
My career is not in computer programming, actually, I'm an industrial robotics programmer/controls tech currently in college. I have a strong background in C#, Java, and a little in C++. I think it would be interesting to deepen my programming knowledge by exploring a project like this.

I understand that it's not as simple as watching a couple of youtube videos, but I am definitely prepared to immerse myself into something like this.

What's the most important thing to consider when going about a project like this?
 

Papabravo

Joined Feb 24, 2006
20,589
My career is not in computer programming, actually, I'm an industrial robotics programmer/controls tech currently in college. I have a strong background in C#, Java, and a little in C++. I think it would be interesting to deepen my programming knowledge by exploring a project like this.

I understand that it's not as simple as watching a couple of youtube videos, but I am definitely prepared to immerse myself into something like this.

What's the most important thing to consider when going about a project like this?
Pulling together a set of requirements for what you want the language to be able to accomplish. That way if you need to recruit help you will have a plan to share.
 

WBahn

Joined Mar 31, 2012
29,481
My career is not in computer programming, actually, I'm an industrial robotics programmer/controls tech currently in college. I have a strong background in C#, Java, and a little in C++. I think it would be interesting to deepen my programming knowledge by exploring a project like this.

I understand that it's not as simple as watching a couple of youtube videos, but I am definitely prepared to immerse myself into something like this.

What's the most important thing to consider when going about a project like this?
I would recommend, as the first thing, getting a decent view of what the various parts are and how they fit together.

One thing you might consider is the Nand-to-Tetris project. In that you will walk through, in emulation, building an entire computer starting with just 2-input NAND gates and you'll write the entire software stack, including the assembler, a stack-based virtual machine, a compiler for an object-oriented language, and an operating system library.
 

nsaspook

Joined Aug 27, 2009
12,261
My career is not in computer programming, actually, I'm an industrial robotics programmer/controls tech currently in college. I have a strong background in C#, Java, and a little in C++. I think it would be interesting to deepen my programming knowledge by exploring a project like this.

I understand that it's not as simple as watching a couple of youtube videos, but I am definitely prepared to immerse myself into something like this.

What's the most important thing to consider when going about a project like this?
Personally I'd recommend gaining expertise in embedded C if you want to design basic building block type devices using controllers. The problems you will see won't be language issues or directly 'coding' related, they will be basic design, hardware interaction, timing and memory issues at the lowest bit to byte level, so stick to something that's simple, with very little abstraction at the language level and very well vendor supported, like C on controllers.
 
Last edited:

Ian0

Joined Aug 7, 2020
8,938
Personally I'd recommend gaining expertise in embedded C if you want to design basic building block type devices using controllers. The problems you will see won't be language issues or directly 'coding' related, they will be basic design, hardware interaction, timing and memory issues at the lowest bit to byte level, so stick to something that's simple, with very little abstraction at the language level and very well vendor supported, like C on controllers.
Agreed - embedded C compilers are pretty good. If you think you can beat the compiler write it in assembler. Most C compilers interact very easily with assembler, with the assembler able to load and save C variables and arrays.
With some expertise in assembler you can write code that runs faster than it would if written in C and compiled. Avoid the libraries of code that the manufacturer provides to interact with peripherals - it is usually cumbersome, badly documented and sometimes doesn't work at all. You can do much better just looking in the processor manual and writing to the relevant registers, either in assembler or C.
For microcontroller use, I can't imagine that it would be possible to create a new language that would have significant advantages over what is available from the combination of C compiler and assembler, considering the time and effort it would take to create it.
 

djsfantasi

Joined Apr 11, 2010
9,125
I also have done it twice in 55 years. It’s the little details that will hang you up, like translating array indices to memory locations. Or keeping track of where the code will resume executing after a jump, subroutine call or function call.
 
Top