You are here: Home FORUM Support analog data acq. at fixed rate

nqBASIC

  :: Support
Welcome Guest   [Register]  [Login]
 Subject :analog data acq. at fixed rate.. 01-06-2010 09:22:16 
Daniel
Joined: 01-06-2010 13:00:45
Posts: 4
Location

Hello all,

I am evaluating a nanoCore12 (40 pin) with docking module.  I would like to measure at a fixed rate 6 analog values.  The A/D example available, show how 1 channel is measured, however the sampling rate is not considered.  I must sample the 6 channels, at or faster than 600sample/s; it is important for the sampling rate to be consistent.

Any hints / examples?

I have tried timing the board and have questions.  If I set up the A/D to take 1 measurement (A.ADC_Start (WAIT, ADC_MODE_8ONCE)), start it and then read, for every sample, a conversion takes about 9 microseconds.  If I set up the A/D for A.ADC_Start (WAIT, ADC_MODE_8CONTINUOUS), I can get A/D values in less than 2microseconds; it seems too fast...  How do I know if I get a new converted value, or if I just keep many times the last converted value, until it gets overwritten by a new conversion?  The documentation talks about a Done function for the A/D (A.ADC_Done (status)), however the compiler does not like it (ie the function does not seem to be in the library)?

 

Daniel

 

IP Logged
 Subject :Re:analog data acq. at fixed rate.. 01-06-2010 09:25:21 
Daniel
Joined: 01-06-2010 13:00:45
Posts: 4
Location
by the way, here is the code I am using to do the timing measurements: /* Target hardware: any size of NanoCore12 module Description: This example demonstrates how to use the Analog-to-Digital Converter object (ADC) and the Serial Communications Interface (SCI) object. Each analog value is transmitted over serial port. */ dim value as new byte //for received characters dim A as new ADC(PAD07) //define an ADC object on pin PAD07 dim status as new byte dim ACK_PIN as new DIO(PT2) dim ACK_PINcopy as new byte main ACK_PIN.PIN_Dir(PT2,DIR_OUTPUT) ACK_PINcopy = OFF ACK_PIN.PIN_Out(PT2,ACK_PINcopy) A.ADC_Start (WAIT, ADC_MODE_8CONTINUOUS) while (FOREVER) //wait for a single 8-bit conversion to complete // A.ADC_Done (status) // if (status == 1) // A.ADC_Start (WAIT, ADC_MODE_8ONCE) A.ADC_Read (PAD07, value) if (ACK_PINcopy == OFF) ACK_PINcopy = ON else ACK_PINcopy = OFF end if ACK_PIN.PIN_Out(PT2, ACK_PINcopy) end while end main
IP Logged
 Subject :Re:analog data acq. at fixed rate.. 01-06-2010 21:47:53 
Daniel
Joined: 01-06-2010 13:00:45
Posts: 4
Location

I have done some timing measurements, have nice plots in a docx word file, or a pdf file; for some reason, when I tried uploading these files, the board returned "This file type not allowed".

Anyway, the bottom line is, a A/D takes about 50 usec; can start the A/D for every conversion, or set it up to continuously convert.  If it continuously converta, an ADC_Read will return a value in about 0.5 usec, but that value is NOT necessarily the latest conversion value; to obtain a read for each conversion, do reads less often than once every 50 usec.

 

Daniel

 

IP Logged
Page # 


Powered by ccBoard