Hi!
i would like if possible an explanation( how to use in the code) on timers in vex with mplab and\or
a table that explanis how values are converted from volts to analog values I can use in mplab.
Thanks :)
This info is found in the data sheet. The Microchip data sheet, located at http://ww1.microchip.com/downloads/en/DeviceDoc/39609b.pdf, describes the analog to digital converter functions of the PIC18F8520 microcontroller. Look at section 19. For input voltages of 0, 1, 2, 3, 4 and 5 volts you will get digital values of approximately 0, 204, 409, 613, 818 and 1023. Additional A/D information can be found in the Microchip Mid-Range Reference Manual.
To write your own C-code for VEX, there is a subset of the default code in the vex-startup-code.zip file found at [http://www.vexlabs.com/vex-robotics-downloads.shtml. It contains file ifi_picdefs.h which defines ADCON2 as using the internal RC clock (32 kHz). It contains routine user_routines.c to tell the PIC18F8520 which Analog/Digital I/O lines are analog inputs and which are digital inputs or outputs. The routine ifi_utilities.c has a sample program to configure the A/D, delay the required conversion time, allow the A/D to convert and read the result.
Take small steps at a time when modifying this code to suit your own application. If you want to use a faster conversion clock than the internal RC clock, the user processor is running at 40 MHz, so you can change ADCON2βs ADCS2:ADCS0 from 111 to 110. But you will get more accurate results with the internal RC clock.](http://www.vexlabs.com/vex-robotics-downloads.shtml. It contains file ifi_picdefs.h which defines ADCON2 as using the internal RC clock (32 kHz). It contains routine user_routines.c to tell the PIC18F8520 which Analog/Digital I/O lines are analog inputs and which are digital inputs or outputs. The routine ifi_utilities.c has a sample program to configure the A/D, delay the required conversion time, allow the A/D to convert and read the result. )
Thanks, i was going to measure my sensors but i wanted a reference how the values should be.
That will help meβ¦