Skip to content

wang-hsiu-cheng/mbed

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Description for Each Lab Demo Problems

lab01 Mbed Introduction

  1. Please create a new program in Mbed Studio to write a program. The program will turn on LED3 for a fixed number of times (of your choice) and print a counter with the resolution of 0.1 (i.e, printing 0.1, 0.2, 0.3, etc.).

lab02 Digital Input and Output

  1. Please write a mbed program. The program should monitor the state of the push-button switch. When the switch's state is zero, the 7-segment display should cycle through the digits 0 through 9 in ascending order. Conversely, when the switch's state is one, the 7-segment display should cycle through the digits 9 through 0 in descending order.

lab03 Analog Output

  1. Please revise 3_2_Sawtooth_Waveform Program. Please use integer index "i" and write_u16() API for AnalogOut.

  2. Please change the duty cycle of 3_4_PWM_Ouput and show the changed PWM waveform.

lab04 Analog Input

  1. Please change the number of samples to 256 for 4_4_FFT_analysis and demo the Python plot.

HW1 Digital and DAC Interface

  1. Please write a mbed program to show Braille codes (3 rows of 2 dots; 6-bit binary codes) with a seven-segment display. The LEDs used in the seven-segment display for the 6 Braille bits are shown in the following figure. Note that numbers are prepended by a # symbol. Please try and demo a few characters with both capital letters (A-Z) and numbers (0-9), e.g., "A12".

  2. Please write a mbed game to use the user button on the board and seven-segment display. (1) Push once to randomly display a number (1-9) on seven-segment display (2) Push another time to start counting down for the above number of seconds. (3) Push to stop the counting down to make it as close to 0 as possible. Of course, you should not be watching the display when guessing the count down. If the number passes 0 without being stopped, the count down will stop at 0 with "." flashing. You may start the guessing game again by pushing the user button.

  3. Please write the following waveform generator. The function of first half period is 3(1 + 1/(1 - exp(x))), and the function of second half period is 3(1 + 1/(1 - exp(2*pi - x))). As in the sinewave example in lab3, please use write_u16(unsigned short) in AnalogOut API. Also generate the waveform with at least 360 samples per period. Please use Picoscope the verify the output waveform.

    What is the fastest (shortest) period generated by an mbed program?

    Please use wait_us() to control the period of the waveform. How do you set the wait time in wait_us() to generate an waveform of exact 100Hz?

lab05 Interrupts, timers, tasks and RTOS

  1. Please measure the run times of computing the exp() function for multiple iterations (N) using a timer. When you select a measurable N, please also try 2N, 3N, etc to demonstrate that the measured time is linearly proportional to N.
  2. Please use an EventQueue to schedule a call of printf() every 30ms. The printf() will print a continuously running timer's ms values with elapsed_time()

lab06 Liquid Crystal Displays

  1. Show your student ID number and "Hello" alternatively on QC1602A with display_to_LCD() in LCD.cpp and LCD.h.

HW2 LCD, Serial Port and RTOS

  1. Please write a mbed program to capture waveforms generated by Picoscope.

    • Use AWG function of Picoscope to generate a periodic Gaussian waveform with a base frequency of 1Hz and 1V amplitude at 1V offset. Use Scope function of Picoscope to verify the waveform.
    • The mbed program will capture the waveform with ADC input with 256 samples at 8-bit per sample. The 8-bit data are converted from the 12-bit values by mbed AnalogIn read_u16(). The mbed program wait for 2ms for each ADC sample.
    • Please send the ADC data to Python and draw the timing and frequency diagram with Matplotlib.
  2. Please write a mbed program to use interrupts to measure the timings of a periodic square waveform.

    • Setup a Picoscope to generate a square waveform
    • The rise of the waveform will trigger an interrupt. The rise ISR will start a timer A and stop timer B.
    • The fall of the waveform will trigger an interrupt. The fall ISR will stop timer A and start timer B.
    • Use timer A and B to calculate the on and off duration (and hence the total period).
  3. Please write a mbed program as a timer with a minute:second format.

    • When the user button is pushed, an ISR is triggered. The ISR function will setup a Ticker with a 1000ms period (attach) if the Ticker is not running. Otherwise, the ISR function will stop (detach) the Ticker.
    • The Ticker ISR will setup a callback function, update(), at an EventQueue (to be called immediately).
    • The update() function will update the minutes and seconds and display the minute:second information at the textLCD. Please use display_to_LCD() functions for the display.

lab07 Serial Communication

  1. Please simplify the example of SPI and UART loopback threads to read one byte from slave thread and print the value at master thread.
  2. For I2C textLCD, after LCD_init(), please write a for-loop to iterate multiple times by send the same character to LCD. Use the Picoscope to observe and verify the I2C waveform when sending the char to LCD.

lab08 Touchscreen

  1. Please write a mbed program for 4.0-in TFT-LCD. When the screen is touched, a rectangle box will be drawn around the center of the touched point with lcd.h and UTouch.h.
  2. Please write a mbed program with lvgl library. The program will count the number clicks of a on-screen button and show the number in a message box.

lab09 Audio Synthesis

  1. For the 3-Note Player, please replace C, E, G notes with another sets of 3 notes.
  2. For the TFT-LCD Keyboard, please change the note playing duration from 1s to continuous mode without stopping until touch is released from the panel.

HW3

About

No description or website provided.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published