Hello,
I'm trying to have a C function called when the tick timer 0 is interrupted. in the manual it has this macro where i'm supposed to write the macro but the problem is my code is in C and I don't know how i'm supposed to implement a function call here
HW_TIMER_CODE MACRO RETI //how to call function ? ENDM
Your subject line is misleading almost to the point of being a flat-out lie.
Your problem is not that you're to write "a macro"; it is that it's to be an assembly language macro. And no, you really should not be trying to call a C function from inside that macro. If calling C functions had been considered safe to do from that place, the callback would surely have been made a C function.
Either way: whatever it is you actually want to do here should almost certainly be done in an entirely different way. So take a few steps back, to what your actual goal was, and re-start thinking about methods from there.
Thank you for the response,
You are right the subject is kind of misleading.
Since i posted the subject i've been trying to rethink the method i'm going to write the code and now there's another problem.
The code that i'm trying to write has already been writen by someone else years ago using a round robin psuedo multitasking sort of a way, the guy had a timer setup and defined timeslots for tasks and set the run flag in it and in the main loop he just checked for the flag and execeted the task function. He kept the data as static variables so on each function call he still had the data.
The main problem with this method is that implementing delays inside those tasks is very hard and requires a lot of switch statements, the code is hard to maintain and understand.
To put it in a nutshell what i need is the os_wait function and the attach task to interrupt function in RTX 51 but i found out the rtx51 full is discontinued so i don't have access to the attach task to interrupt function.
Is there any way i can get it back from previous releases? Uvision still has the option to select it as OS but the libraries are missing.