|
If you look in the Examples folder of nqBASIC, you'll find an example project called ADC1 which does this (i.e. sends the analog values over the serial port to the PC so that you can view them with any terminal program). Here's what it looks like:
main S.SER_Setup (SER_BUFFER_2, BAUD9600) //Setup SCI with a 1-character buffer while (FOREVER) //wait for a single 8-bit conversion to complete A.ADC_Start (WAIT, ADC_MODE_8ONCE) A.ADC_Read (PAD07, Result) S.SER_Put_char ('\n') //send CR-character (newline) S.SER_Put_char ('\r') //send CR-character (newline)
S.SER_Put_decimal (Result, FILLUP_ZERO) //send conversion as decimal number-string //Delay 1 second DelayMsec (1000) end while
end main
The Example projects can also be found online, in the Support Library at: http://www.technologicalarts.ca/support/docs/nqBASIC/ProjectExamples/ |