finally, I understand!!!
Ivancho,
Thankyou so much for your advice, after re-reading your last post about 10 times it finally sunk in what you were suggesting :idea: , you see, I'm not very good at explaining/understanding ideas from words, i'm much more of a diagram person.
So, lets assume the ADC has no aquisition time, just for convenience.
The PIC sends one clock pulse to the ADC, then moves the data from the input (ADC), to the output (or a register, then the output). And this process is repeated for all 16 bits. correct? It seems like it the simplest way, didn't think of it before
With the above process I could send the data 'on the fly' as opposed to storing all 16 bits in a 'buffer', reducing the delay tremendously.
When you first mentioned clocking the adc from the PIC I assumed that the data would be aquired from the ADC ...and
then sent to the serial-out.
How fast do you really have to have your analog data converted and transmited?
Well the minimum samplle rate is about 25khz. The minimum resolution is 16 bits. And the delay bewteen the time the sample is taken (at the transmitter) to the time when the DAC at the reciever outputs the analogue voltage must be less than 10ms. So I want the delay from the sample to the last bit transmitted to be as small as possible, hence my hesitation to 'buffer' the data. However, there is room for some delay, about 2ms.
With the 'on the fly' the speed of the data coming out of the PIC will be the same as the data coming from the ADC, this is the most efficient way, bandwidth wise, because outputing the data very quickly leaves a BIG gap between frames in the bit stream. Meaning that the highest frequncy in the bit stream is higher than the baud. - sorry, I'm babling
Now I just need to learn the basic instructions for the PIC, I'm well versed in assembly (8051) I assume it can't be that different.
Now I just need to find a crystal to give me a decent sample rate. 20MHz/4= 5MHz, for every bit retrieved from the ADC reqires 3/4 instructions (2 for clock, and 1/2 to move data). I was hoping that the chip would have a timer or something thats independent of the program but I don' think they work that way. Anyway, for 16 bits that 16*4 = 64. 16 more are need to clock the ADC during the aquisition time and 3 more for start,stop and 'return to zero' giving 83 minimum.
That takes: 0.2 * 83 = 16.6us. For a sample rate of 25khz, the total time allowed for the program to run is 1/25k = 40us, nice! enough room to make things easier. Sorry for all the maths, I'm just typing what I'm thinking.
Thanks again man, you've been a lot more help than my lecturers, who told me that going digital was too much hard work. :!:
Regards.
Scott