Bracer
New Member
In PICBasic, we have this:
PWM PortB.0,127,1000 '127 = 50%, 1000 = 1 Sec.
Now all is well, I assume that PICBASIC knows somehow [which is pretty incredible which I will explain later] how to PWM the LED so that it is at 50%.
So that line basically say PWN the LED so that it reaches 50% brightness and keep it that way for 1 second.
That is all fine...until I start thinking about it and start asking this.
Why can't PICBASIC allows for this ?
PWM PortB.0, 127
Yes, why don't they allow this ?
This would allow other operation to continue if it's not for the original command that entails a need to put a time behind it hereby stopping everything else in its track.
And Since PICBASIC don't allow:
PWM PortB.0, 127
and instead make it like this:
PWM PortB.0,127,1000 '127 = 50%, 1000 = 1 Sec.
I have to assume there is some "magic" going on here.
Like....how the hell could PICBASIC knows what many time to turn on and off in a sec for it to "look" like it's at 50% ?
Is there a chart that says if you turn on and off LEDs at a specified amount of times a sec it will be at 25% brightness ? 50% ? 70% ? etc...
Where is that "chart" ?
Or is that "chart" a secret ? he he he
PWM PortB.0,127,1000 '127 = 50%, 1000 = 1 Sec.
Now all is well, I assume that PICBASIC knows somehow [which is pretty incredible which I will explain later] how to PWM the LED so that it is at 50%.
So that line basically say PWN the LED so that it reaches 50% brightness and keep it that way for 1 second.
That is all fine...until I start thinking about it and start asking this.
Why can't PICBASIC allows for this ?
PWM PortB.0, 127
Yes, why don't they allow this ?
This would allow other operation to continue if it's not for the original command that entails a need to put a time behind it hereby stopping everything else in its track.
And Since PICBASIC don't allow:
PWM PortB.0, 127
and instead make it like this:
PWM PortB.0,127,1000 '127 = 50%, 1000 = 1 Sec.
I have to assume there is some "magic" going on here.
Like....how the hell could PICBASIC knows what many time to turn on and off in a sec for it to "look" like it's at 50% ?
Is there a chart that says if you turn on and off LEDs at a specified amount of times a sec it will be at 25% brightness ? 50% ? 70% ? etc...
Where is that "chart" ?
Or is that "chart" a secret ? he he he
Last edited: