S215   10 0908     

Lab JI07-37 Send Pot to Display
15 points

OEES 215

Back to Main Page



//******************************************************************************
// JI07-37 Send Pot Output to the Display                      S215  10 0907
// *****************************************************************************
#include "s215-header16-f45.h"

#pragma code
//||||||||||||| Main Program ||||||||||||||||||||||
void main (void)
{
    float x;
    InitPorts();
    ADCinit(0);                    //Initialize analog to digital converter

    while(1)
    {
    //|||||||||||||||||| Primary Loop |||||||||||||||||||||||
    x = ADC10bit();
    DispFP(x, 0);
  
    Delay10ms(20);
    //||||||||||||||||| End of Primary Loop ||||||||||||||||||||
    }
}



  1. Try out the above program.
  2. Modify the program so that it displays half the value of the numbers coming from the pot.
  3. Modify the program so that it displays numbers between 0 and 100 when the pot is turned from fully counterclockwise to fully clockwise.
  4. Modify the program so that it displays numbers between 20 and 100.


Back to Main Page