I guess I should explain it different then.
I'm already familiar with how the PWM in the 628 works, I've used it and everything.
What I'm trying to do actually has nothing to do with it, it's more about percentages.
I'll try with a little example, maybe it's better.
Lets say a take a reading which I store at my first variable, the one I called MAX. It could be the time a button is pressed, it doesn't matter. So MAX is initialized at the beginning of my program (that's what would make it a constant for the rest, since I set it's value only once) with a value of, lets say, 200.
MAX = 200 (decimal)
Later on, during the main program, I have another variable, DCycle, which is updated regularly, and con go from 0 up to the value of MAX.
So, it could be DCycle = 0, = 23, anything until DCycle = MAX.
Now, I want to convert that value.
Being 100% (DCycle = MAX) a 255 decimal and 0% a 0, stored in some other variable, lets say RESULT (to make it simple).
So it'd be like, if DCycle = MAX then RESULT = 255
if DCycle = MAX/2 then RESULT = 127
Of course, I can't write all those ifs. Not the best solution, wouldn't you agree?
If I had to do it in C (at least the one I'm used to, which isn't for Microcontrollers) it would be as simple as:
RESULT = (255/MAX)*DCycle
However, it doesn't look that simple in Assembler. That's where I need help.