[SOLVED] ENCE361-Lab 4 ADC

30.99 $

Category:

Description

5/5 - (1 vote)
  • Compile, link and load ADCdemo1.c (needs access to circBufT.c and circBufT.h)

Run the program and operate the potentiometer on the Orbit board to alter the analogue input voltage between 0 and 3 V.  Observe the 12-bit integer that results.  Study the source code for ADCdemo1 in detail to understand how it works.

 

                

  • Prepare a new version of the program (say, c  or  miles1_v1.c) to change to the analogue input AIN9, PE4 (J1-05).  Set up the bench power supply to provide a voltage between 0 and +3 V and set the current limit to 0.01 A.  Use two banana-to-alligator cables and two of the mini cables that came with your Tiva to connect the input voltage and ground to the board.   Take care to check the voltage & polarity of the applied voltage  BEFORE  you turn on the supply output.

Check the operation of the program.  The relationship between the displayed value and the voltage should be perfectly linear.

 

 

  • Work out a suitable size for the circular buffer for two different applications:
    • For reading the position of the potentiometer if it is to be used as an input to the fitness monitor UI.
    • For sampling data from the accelerometer, which will respond to the wearer’s footsteps. Also work out suitable sampling rates for both peripherals (refer to the Milestone 1 and 2 specifications for the project). Present a case in your lab book for the values you determine.  It is reasonable to assume that the motion of a person running is limited to < 3 Hz.  Test your sampling/buffering/averaging system by means of the function generator.

Again, check the voltage of the function generator output with the scope  BEFORE  you connect to the ADC input.

 

  • Use code from c to send the same data that is on the OLED display to the Tiva board’s host PC. Rather than sending every ADC reading, data should only be sent at predefined intervals of about 2 Hz. To view the serial data in CCS you will need to create a new terminal connection:
    • First, open the Terminal pane by clicking View > Terminal. (You may prefer to use a separate application, TeraTerm for this.)
    • With the Terminal pane open, click the “Open a Terminal” button , or Ctrl+Alt+Shift+T.
    • In the window that opens choose Serial Terminal, with 9600 baud, 8 data bits, 0 parity bits, 1 stop bit, no flow control and 5 seconds’ timeout.
    • The Port will vary from USB port to USB port and PC to PC. Open the Windows Control Panel, select Device Manager and expand the Ports (COM & LPT) group. The name in brackets next to the entry Stellaris Virtual Serial Port is the name that should be used for the serial terminal port.

NB: The topic of serial communication will be covered in lectures in Week 7.

 

  • Carefully read the Milestone spec and make sure you understand exactly what is required. Carry on developing your code.  Remember that the compliance of your program for Milestone 1 will be checked during your lab session in Week 5.  Don’t leave your preparation to the last minute.

 

 

  1. Guidance:
  • Prepare the new programs one step-at-a-time.

 

  • Make new code as modular as possible, using appropriately designed and named functions. This will pay off when you come to build a much bigger program to drive your fitness monitor.

 

  • Test, test, and test once more. Make sure your tests cover the specification fully.  A lot of problems with software occur because the developer has not been thorough in testing their code.  Record how you have tested your code and save any special programs you may have used for testing.