News:

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

Main Menu

C Language Support ?

Started by Fanie, Today at 01:38 PM

Previous topic - Next topic

Fanie

The PDS support the Positron Basic of course,
As well as assembler with the ASM ENDASM commands

Is the C language supported in any way ?

If this was possible then perhaps an existing code for something existing in C... C++ may be included to perform that function ?

If you write code for a processor, then you can include a C-file that performs a function.  The author then offers commands you use in your program, that uses his code to perform the function.
In C there exist a huge verity of such includes created for all sorts of things.

For the ESP32-S3 I used EEPROM.h, OneWire.h, LiquidCrystal.h and uTimerLib.h as includes, each have a set of commands that does that function.
For example, to write to EEPROM - EEPROM.writeInt(10, Set_Temperature);             // Save temp set value
                                                        EEPROM.commit();  // save it !

It means the timing and other issues which may exist is handled by the include, you just use the commands.

The off side is that some of these includes exist for only specific processors and cannot not be used universally...

JonW

It's pretty much the same as procedures in Positron, where you can easily produce custom standalone include files, thus the same as functions and a .h file.

I have many libraries written in Positron that are just like you describe, here is a basic example of a Flashwrite include file.  All declarations and procedures exist in the include file, enabling easy reuse.


Include PXXXFlash_ROUTINES.inc

Var = FlashRead(MEMLOC)
Flashwrite(VAL,MEMLOC)
EraseFlash(MEMLOC)



I code in both CCS C and Positron and find both are excellent. CCS has some extremely powerful functions and libraries but I still prefer the basic syntax as I was brought up on the C64.