You are here: Home FORUM Support Viewing pin outputs

nqBASIC

  :: Support
Welcome Guest   [Register]  [Login]
 Subject :Viewing pin outputs.. 19-04-2010 18:32:18 
csmstudent
Joined: 19-04-2010 22:26:52
Posts: 1
Location

I would like to see what voltages are being read at my analog ports without outputting to my LCD screen. Any command similar to cout that just lets me see it on my monitor?

 

~H

IP Logged
 Subject :Re:Viewing pin outputs.. 20-04-2010 07:00:49 
carl
Joined: 27-05-2009 10:51:54
Posts: 17
Location: Toronto

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/

IP Logged
Last Edited On: 28-04-2010 17:15:28 By carl for the Reason to provide explicit URL
Page # 


Powered by ccBoard