This is my first post. I have a problem and I need some help to resolve it. I have a very big C code with lots of subroutines developed for collecting data in an experiment.
One of the subroutines in this code is for controlling the linear motion of a stepper motor which I have to modify this subroutine to be compatible with the newly bought motor controller and an Arduino Uno.
The stepper motor is controlled with a stepper motor controller which is connected to an Arduino Uno.
Since everything should be in pure C language I skipped the Arduino IDE and functions and I'm directly talking to the Atmega328p using AVR-GCC compiler and AVRDUDE to upload the code to the microcontroller.
I wrote a small piece of code (separate from the big C code) to send signals and make the motor move. Now I have to figure out a way to make this small piece of code part of the big C code.
My question is that how can I accomplish the task of running the C code and whenever the motor is need to be moved the Atmega328p do his job. I mean I can't upload the whole code to the microcontroller. I just need to upload those lines of code which sets the pins of the microcontroller as outputs, sending high and low signals and delay between the signals. Any help would be appreciated.