Search The Blog

Mar 29, 2021

MICRO-CONTROLLER AND APPLICATIONS -3

 

 Embedded Lab Course with PIC18F4550

                                                              Course by IIT, Bombay

                                                                            
----------------------------------------------------------------------------------------------------------------------------------

Overview: Below course was conducted as an outreach initiative of Wadhwani Electronics Lab, IITB under the Virtual Labs Project by the Ministry of Human Resource and Development (MHRD), GOI. The controller used in this course is a PIC18F4550 based development board we designed and manufactured at WEL. This course will help you in adapting any other μController platform, design & develop an embedded system, interface variety of peripherals & implementing various communication protocols.

Prerequisites: Knowledge of μC, embedded-C programming, MPLAB IDE, debugging, comm. Protocols

Getting things done: Installing MPLAB and Introduction to PIC board  Kindly go through this video tutorial. This board is powered by USB. For programming the device, USB bootloader mode is used as it's much faster and economical to program than PIC emulator by Microchip. Linker file provided is necessary to build program with this controller.

Device top-view with labeled features

Check FAQs section incase of any queries or comments below. Do not get confused with header files used in code. It's just a means to shorten the length of the program. The syntax might change as per controller used but the algorithm remains the same. The below course is strictly performed on PIC18F4550 board. If you are using any other μC, study it's datasheet thoroughly. 
---------------------------------------------------------------------------------------------------------------

  1. Revision of basics of C- programming:

    • Store 10 different numbers in 10 consecutive memory locations. Then clear these memory locations (Use array to store numbers in memory and its pointer to clear content)
    • Find the sum of N numbers starting from 1 and store the partial sum values in N consecutive memory locations. Your program should result in having 1, 3, and 6 in initial memory locations. The value of N should be taken between 10-20.
    • C-program to read 10 numbers from one set of location and copy these numbers to a different set of location.
    • C-program to sort 5 numbers (stored in memory location) in an increasing order using any sorting algorithm. Store the sorted numbers in some other memory location. (contents of the original array should not be destroyed or re-ordered.)
      

      2. Port reading and LCD interfacing:

    • To read the switch status and accordingly display the status on the corresponding LED.
    • Write a program that will display two lines of text on the 16x2 LCD display so that they are left-aligned. The lines are stored in the form of null-terminated strings.
    • Modify the program to display a single line of text which has more than 16 characters, as a scrolling display. Use the string “My first lab program works! ” as the string to display.
    • Write a program to interface the same LCD in 4bit mode.
      

      3. ADC interfacing: 

    • To sample the voltage on the analog input line and display the value on the LCD. Use a 1KΩ pot whose fixed terminals will be connected to the VDD (3.3V) and VSS (0V) of the board and the variable terminal shall be connected to the AnalogIn. Verify voltage manually on DMM.
      

      4. Timers and Interrupts:

    • Write a function that generates PWM, a square wave of given duty cycles as an output on one of the port pins using one of the timers of the PIC18F4550 MCU.(The frequency of the signals remains constant & can be between 1-10 kHz) 
                20 % [when switch RB5 is ON]
                40 % [when switch RB6 is ON]
                60 % [when switch RB7 is ON]
    • Interface 16x2 LCD
    • Write a program to measure and display the amplitude of a sine wave with a DC offset which is applied externally to onboard ADC (use Function Generator to generate a sine wave of 100 Hz, with an offset of peak value of the signal. Make sure that the input sine wave is always positive, the amplitude of the signal never goes beyond 3V.)
    • Using part-A, write a function that generates a square signal whose duty cycle depends on the peak voltage of the sine wave measured by the ADC in part-C.
                20% DC if the peak voltage is between 0V to 1V.
                40% DC if the peak voltage is between 1V to 2V.
                60% DC if the peak voltage is between 2V to 3V.

      5. Serial Communication using USART:

    • Write a program to send a string to computer from a microcontroller using USART. Capture data in the terminal and record it.

      6. DAC Interfacing:

    • Write a program to generate Sawtooth wave of 3.3v & 1kHz at the output of DAC 0808.


      7. SPI Protocol:

    • Write a program to interface MCP4921 DAC with PIC18F4550 using SPI protocol.
Setup for SPI with MCP4921

 


Data ="1000-0000-0000" with gain 1. Expected output is 2.5v when the VREF is 5v





      8. RTC using I2C Protocol:

    • Write a program to send Date & Time to RTC- DS1307, Read from IC continuously, and Display this information on 16x2 LCD using PIC18F4550.
Specifications
R=10kOhm
















---------------------------------------------------------------------------------------------------------------
FAQs- Click Here

1 comment:

  1. Harrah's Resort And Casino - KTM Hub
    Harrah's Resort And 구미 출장안마 Casino 양산 출장마사지 is located in the heart of Las 김포 출장마사지 Vegas. Guests can check-in, check out the nightclub, 사천 출장안마 and request 순천 출장마사지 a proposal. The resort's hotel is

    ReplyDelete