recently i have decided to give one of my projects a major code overhaul to reduce the 92% used program memory on a pic12f1840.
i have spent a little time creating a total of about 130 or so binary values of a "control status" word variable to go into several lookup tables to go that route and get rid of a lot of "if..then" statements to hopefully free up a good amount of space.
the part im stuck constantly thinking about is how to direct my program flow to the right sub procedure depending on the value of the control status word, i did do some searching and reading of various posts but im still none the wiser on an understandable method of getting that all important data pointer to my individual sub procedures after comparing the variables value to the lookup table.
i did consider using a "select case" route but that would still need just over 40 entries for one of the larger sections that needs to be redirected to appropriate subs when used, im just curious if there is an alternative way to go about redirecting and data pointers in general.
tony
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Pointers are on the development path. But, not there today.
I can send you, privately, the code for SD Card this does have a really good use of IndCall.
IndCall provides a basic implementation of function pointers. Address is the program memory location of the subroutine that is to be called. There are two ways to specify this - either by providing a direct reference to the subroutine using the @ operator, or by specifying a word variable that contains the address. Then, you may be able to use IndCall for callbacks.
Ping me a PM. I do not want to release this code publically yet.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
recently i have decided to give one of my projects a major code overhaul to reduce the 92% used program memory on a pic12f1840.
i have spent a little time creating a total of about 130 or so binary values of a "control status" word variable to go into several lookup tables to go that route and get rid of a lot of "if..then" statements to hopefully free up a good amount of space.
the part im stuck constantly thinking about is how to direct my program flow to the right sub procedure depending on the value of the control status word, i did do some searching and reading of various posts but im still none the wiser on an understandable method of getting that all important data pointer to my individual sub procedures after comparing the variables value to the lookup table.
i did consider using a "select case" route but that would still need just over 40 entries for one of the larger sections that needs to be redirected to appropriate subs when used, im just curious if there is an alternative way to go about redirecting and data pointers in general.
tony
Pointers are on the development path. But, not there today.
I can send you, privately, the code for SD Card this does have a really good use of IndCall.
IndCall provides a basic implementation of function pointers. Address is the program memory location of the subroutine that is to be called. There are two ways to specify this - either by providing a direct reference to the subroutine using the @ operator, or by specifying a word variable that contains the address. Then, you may be able to use IndCall for callbacks.
Ping me a PM. I do not want to release this code publically yet.
thanks evan, i'll send you a pm with my email adress.