It looks like pretty much exactly what I'm trying to do. I'm surprised you needed the fastwrite macros, I didn't realize arduino was slow to do digital IO.
Also, I'm a bit confused by your analog read:
"freq = analogRead(0) * 10 ;"
Don't you have to normalize the number? It looks like this line will give you a number from 0 to 10230 in steps of 10, when what you really need is a number from 10-2000 in steps of 1 (which you can't do with a 10-bit ADC, but that's another issue).
Also, when I said 5ms wasn't enough time, I my problems on the PIC were mostly waiting for the LCD to update.
Do you think Ardunio will add native support for timer interrupts in the future?
> I'm surprised you needed the fastwrite macros, I didn't realize arduino was slow to do digital IO.
The Arduino takes under 5 microseconds so its plenty fast enough for your app but I wanted the minimum overhead because the pulses were triggering timing measurements on a logic analyzer to see exactly how long it took to do the math and analogRead
> Also, I'm a bit confused by your analog read: "freq = analogRead(0) * 10 ;"
Yes, it does need to be normalized. I just wanted to get any old reading for timing purposes.
>I really need a number from 10-2000 in steps of 1 (which you can't do with a 10-bit ADC?
Could you have the steps change from .1 to 1 for frequencies above 90hz?
If not, you could use the pot value to control incrementing and decrementing the frequency, with the rate of change proportional to how far the pot is moved CW or CCW off center.
I would recommend the latter with a bit of dead band in the center if you need it to be stable to .1hz because there can be jitter in the pot value.
>Also, when I said 5ms wasn't enough time, I my problems on the PIC were mostly waiting for the LCD to update.
Yes, as cheater pointed out, the LCD can be a bottleneck but there are ways to overcome this.
>Do you think Ardunio will add native support for timer interrupts in the future?
Perhaps one of the Arduino development team members could comment on this?