Oops - just realised was running the 18F4550 at 20 MHz - so all the timings are out by a factor of 2'ish. ie my code example is actually sampling at 2 KHz. Same principles apply though.
The Xtal frequency is 20 MHz - what with pre and post scalers etc it gets difficult to track what the Oscillator frequency is on the 18F4550 which has two potentially different clocks speeds in it.
Also my ADC manipulation comments had an error, but the code was correct - should have been:
Code:
'10 bit to 16 bit and swap LSB/MSB because
'STR sends LSB,MSB and DAC expects MSB,LSB, ie:
'xxxxxx9876543210 > 10xxxxxx,xxxxxxxx + xxxxxxxx,98765432
Buffer[pBuff] = (value<<13) + (Value>>2)
Peter
Bookmarks