C to Arduino

Hello guys

I have a problem
I would like to convert a C program to Arduino but I know nothing about it...
I give you my program for you to take a look :wink:

Btw, this is a class project and I will be noted on it, THANK YOU :kissing:

I just want to move this program in Arduino, how?

Programm C Projet.txt (14.1 KB)

There are a number of items:

  • You have a lot of macro definitions that i believe originate from the PIC world. You have probably have to change or adapt these
  • Arduino program do NOT have a main() function. Instead they have a setup() function that is called after startup and a loop() function that is called continuously thereafter. In you code, put the (adapted) contents of you main() function up to the while(1) statement and put them into the setup() function. Put the contents of the while(1) loop and put them inte the loop() function

That looks horribly like a PIC project.

It's going to take some translating - you need to start by picking the program apart and documenting what it does.

void setup()
{
	//Initialisation
	ansel = 0;
	cmcon = 0x07;


	//Code Initialisation Interruption
	option_reg = 0xC0;
}

void loop()
{
		//Appel d'une Macro
		//Appel d'une Macro: AjoutDe61sec()
		FCM_AjoutDe61sec();

		//Appel d'une Macro
		//Appel d'une Macro: Pas()
		FCM_Pas();
}

that would be your starting point.

however, you have to rework a lot of the code specific to the LCD, you first would need to figure out what it is doing and how to make the mapping.. there seems to be a significant amount of code in the file "C:\Program Files (x86)\Flowcode\v5\FCD\internals.c" - which isn't even provided here.. just take it one line of code at a time.. add functions as needed.. start with FCM_AjoutDe61sec and FCM_Pas - not all the code may be used.

Your program uses a lot of non standard datatypes like MX_UINT8 these have to be replaced.