0
\$\begingroup\$

I have very little microcontroller knowledge so please bear with me. I am trying to figure out how to use all of the inputs on the dsPICDEM MCLV-2 Dev Board. Specifically, how do I read the potentiometer input in C code using MPLAB X IDE. I want to set the potentiometer from 0-100 and be able to turn it and see an output of the value it is at. All reference material I have read for this board does not contain the actual function used to read/write to the potentiometer. If someone can point me to the right reference material or knows how to use the potentiometer and can help I would greatly appreciate it.

Not asking for anyone to write code for me, just want to know how to access the potentiometer on dev board.

Thanks!

\$\endgroup\$
0
\$\begingroup\$

To read a potentiometer, you have to use the ADC peripheral in your micro-controller. Read the application notes available for using the ADC in the micro-controller.

You can only read a potentiometer. Writing to it is not possible, a potentiometer is variable resistor. You have to set/adjust the resistor provided by the potentiometer by varying the knob on the pot manually.

\$\endgroup\$
  • \$\begingroup\$ Thank you for the response! Is this the right resource I should be using? ww1.microchip.com/downloads/en/devicedoc/51456b.pdf \$\endgroup\$ – KP123 Oct 17 '16 at 15:54
  • \$\begingroup\$ So I have to use the analog to digital converter function, but how do access the actual potentiometer/ \$\endgroup\$ – KP123 Oct 17 '16 at 16:05
  • \$\begingroup\$ For example, if I want to read the potentiometer on the board, do I call a "POT1" function? Or some pin on the development board? \$\endgroup\$ – KP123 Oct 17 '16 at 16:09
  • \$\begingroup\$ You have to read the documentation on your development board to see how and where (which ADC channel) the pot is connected, then read the appropriate ADC channel in your program. The development software may have some #defines or functions to help with reading the ADC. \$\endgroup\$ – Peter Bennett Oct 17 '16 at 16:49
  • \$\begingroup\$ Can you please direct me to the right documentation? I have read this doc, but it doesn't seem to have any information on how to program and use these functions? ww1.microchip.com/downloads/en/DeviceDoc/DS-52080a.pdf \$\endgroup\$ – KP123 Oct 19 '16 at 21:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.