You are welcome ;-)
Type: Posts; User: HankMcSpank; Keyword(s):
You are welcome ;-)
Hi, that worked a treat, here's the output after modifying with your snippets...
Gamma array size: 255
Total PWM steps: 1023
Gamma correction: 2
DW 0, 0, 0, 0, 0, 0, 0, 1, 1, ...
Hiya,
Long time no code!
I'm wanting to use Mike, K8LH 'Just Basic' code to generate values towards linerarizing an LED for PWM ...what Mike has done is great & & more or less ideal for my...
Keep coming back to this. (I I like a breather in between!)
Is there any electronic sensor that mimics the eye's 'response' curve out there that I can buy & put a scope on its output? What I'm...
Thanks guys (& sorry for the delay in coming back here)
But current doesn't flow without voltage, so in a roundabout way by controlling the mean voltage you are controlling the current.
...
Hi All,
I'm trying to linearize LEDs for use with 1024 PWM (lots of different types of LEDs), but I'm finding it really troublesome ...I'm using a lookup table & using a 'hit & hope' method...
It doesn't matter whether the resistor is 'in line' with the 12V supply wire ....or inline with return to ground wire....the same current will be present (the current leaves the charger, goes through...
It is kind of correct..... 10mA through a 0.47R resistor = 0.0047V drop across it (which, if you look back above the above posts, with a 5V ADC reference & 1024 bits, you can resolve 0.0048828125V...
It's pretty simple...let me try & explain.
If your PIC is running at 5V, then you're ADC resolution becomes 5V/1024 (the 1024 being 10 bits)...this results in a resolution of 0.0048828125V...
Whilst that higher resistor will give you 4x the ADC reading vs a 0.1R resistor, that's still only an ADC variance of about 60 steps between 1000mA & 300mA for a PIC supply of 5V....like I say, if...
300ma x 0.1R = 30mV
1000ma x 0.1R = 100mV
Your PIC is on a 5V regulator, so assuming 10 bit ADC = 5V/1024 = 0.0048828125V per ADC 'bit'.
30mV divided 0.0048828125V = ADC reading of 6 for...
Which isn't a whole lot of resolution.
I'm not sure which PIC you're using, but I use the latest range of PIC16f182x ....certainly with that suite of PICs (& mybe others...dunno), you can tie the...
I'm no expert, but you've created a
CCP1_INT interrupt, then done this...
@ INT_ENABLE INT_INT ; enable external (INT) interrupts
Ok, it looks like interrupts are a big no-no here so I've established a way of doing this without an interrupt...
T1GCON.4 = 1
Loop1:
pause 500
T1GCON.3 = 1
TMR1=0
while T1GCON.3 = 1
Also if you're increasing the PWM duty cycle & expecting the ADC'ed voltage to rise until a target is met, then I think you'd want it arranged like this...
while feedback<153 (in other words,...
Firstly, I spoke to soon. Whilst this latest method mentioned in my last post has allowed me to detect higher frequencies....I'm still getting erratic results in & around the 450-700Hz audio...
Thanks guys...I'm now approaching this in a slightly different way & getting reasonable results (I think!)
I'm using timer1 gate & comparator2
Here's the sequence....
Comparator2 goes...
Just thinking out loud here...if all the overhead comes from entering & exiting the interrupt routine ...if I dedicate my main loop solely to measuring high/low transitions on a pin (ie feed the PICs...
Just as an experiment, I would like to see how high in audio frequency I can go with something like the ASM interrupt method discussed in this thread...
...
Hi Bert,
I re-enabled hserout out in the ISR again, and these are the TMR1 counts I'm getting for successive comparator2 interrupts with an audio input of 82.4Hz (the lowest note/frequency on a...
Thanks for the input Bert, I changed the interrupt to ASM...
ASM
INT_LIST macro ; IntSource, Label, Type, ResetFlag?
INT_Handler CMP2_INT, _CMP2_Interrupt, ASM, YES
...
Ok, so I took the HSEROUT command out of the ISR ...... & then my ISR 'toggle pin' frequency scoped correct up to around 900hz audio input ....however, above that 900Hz audio input, even with just a...
No...I hadn't so put a toggle in my ISR (top tip - tks!)
I've scoped the ISR 'toggled' pin & I'm seeing 250hz on there?!! (therefore 2 x 250hz = an interrupt rate of 500Hz ....this for a 1kHz...
I don't think that's the issue, here's a scope screenshot of what the PIC's internal comparator is seeing internally...
http://www.hostmyjpg.com/images/4c8331896e_comp.jpg
The white...
Good spot!
Here's approx the Timer counts I'm seeing for different frequencies...
82.4Hz (lowest note on a guitar) - 42,900 (ish)
330Hz (top E) - 7,300(ish)
600Hz - 1800 (ish)
650Hz...