- Home
- Help and Support
- Support Forum
- ADC Pi
- Question on the read_voltage() function
Question on the read_voltage() function
1739 Views - Created 25/07/2018
25/07/2018
Posted by:
WayneA
We want to use the ADC Pi to read a varying voltage, send it out as a serial 16/17 bit number and then store it
in the R-Pi's memory as a parallel number.
Any examples of C code to do this would be greatly appreciated.
Regards,
Wayne
You can find a demo application using the read_voltage() function in our GitHub repository at https://github.com/abelectronicsuk/ABElectronics_C_Libraries/blob/master/ADCPi/demos/demo-adcread.c
read_voltage() takes 5 parameters:
address - I2C address for the target device e.g. 0x68
channel - 1 to 4
bitrate - 12, 14, 16 or 18
pga - 1, 2, 4 or 8
conversionmode - 0 = one-shot conversion, 1 = continuous conversion
The function returns a double-typed voltage from the ADC.
Note: documents in Portable Document Format (PDF) require Adobe Acrobat Reader 5.0 or higher to view, download Adobe Acrobat Reader or other PDF reading software for your computer or mobile device.
Formatting your Forum Post
This forum uses BBCode, short for Bulletin Board Code, which is a lightweight markup language used primarily in online forums and message boards to format and structure posts. It provides a simple way for users to add formatting and styling to their text without requiring knowledge of HTML or other complex programming languages. With BBCode, users can enhance their messages by applying formatting tags such as bold or italic. Additionally, BBCode allows users to insert images, create clickable links, quote other users, and more.
Type | Syntax | Purpose |
---|---|---|
Bold | [b]{text}[/b] | Makes {text} bold |
Italic | [i]{text}[/i] | Makes {text} italic |
Quote | [quote]{text}[/quote] | Creates a quotation box saying {text} |
Image | [img]{url}[/img] | Shows the image indicated by {url} |
Link | [url]{url}[/url] | Makes a link to {url} |