Thats interesting. Idealy i would like to get it down as far as possible. In this case the multiple if statements are required. It checks each pin's PWM value against the current PWM position. If it matches then that pin gets turned on. In my actual code i dont compare against a constant (1). Sorry for the confusion.
How would i go about doing the ASM macro thing?
Is there any other way to turn a pin on when a certain condition is met? I think this would probably work "pin = (pinValue=PWMPos)" but i wonder if that would get compiled to the same kind of code as an if statement.
Thinking about it, something like that would be an ideal solution. Whenever PWMPos overflows to 0 i have a seperate set of if statements that turn off any outputs whos values are less than 255. Both blocks of if statements are inside another if-then-else statement. If this method works then it should be able to do the whole thing with just 1 or 2 instructions
Bookmarks