REPORT MICROCHIP CONTROLLER UNITS AND DIGITAL TECHNICS PRACTICING. Student : Đỗ Thành Trung Student Number : Class : 14146CL2 CONTENT :

Size: px
Start display at page:

Download "REPORT MICROCHIP CONTROLLER UNITS AND DIGITAL TECHNICS PRACTICING. Student : Đỗ Thành Trung Student Number : Class : 14146CL2 CONTENT :"

Transcription

1 REPORT CONTENT : MICROCHIP CONTROLLER UNITS AND DIGITAL TECHNICS PRACTICING Lecturer : Student : Mst. Bùi Hà Đức Đỗ Thành Trung Student Number : Class : 14146CL2 Ho Chi Minh city, 26 th October

2 Preface : icrocontroller Units (MCUs) are being used in daily life and industry as a need of more productivity, more modernizing and more profits. So it is important for students who are now studying to be Engineers, especially those who are going to be Automation Engineers, to master this century-technology as fast as possible. By mastering it, we will have contributed great pieces for developments of society and the world. There are lots of MCUs manufacturers in the world such as : ATMel ( Arduino series ), Microchip( Pic 16F877, Dspic30F family,. ) but I am using 2 products of Microchip are dspic30f4011 for real-life exercises and dspic33fj12gp202 for virtual exercises on Proteus. They are Microchip's 16-bit, PIC24 MCUs and dspic Digital Signal Controllers provide designers with an easy upgrade path from 8-bit PIC microcontrollers and a cost effective option to 32-bit MCUs. The broad product line includes everything from extreme Low Power microcontrollers to high performance digital signal controllers. With single cycle execution, deterministic interrupt response, zero overhead looping, and fast DMA, the dspic family also adds a single cycle 16x16 MAC and 40-bit accumulators, ideal for math intensive applications like motor control and digital power. Combined with hardware and free software, these 16-bit products are ideal for designs including high efficiency Motor Control, platinum-rated Digital Power Supplies, and Low Power for longer battery life in portable applications. Integrated touch and display features help lower costs and simplify designs for user interfaces including mtouch Sensing, Graphics, and Segmented Display drivers. Also specialized peripherals and software for Connectivity such as USB, CAN and wireless protocols make it easy to communicate with other systems. 2

3 I am using Proteus v8.3 sp2 to create virtual environment for exercises, Xc16 as compiler and MPLAB X IDE v3.40 to configure Bits of PIC Memory View and PICKIT 3 to load the data into MCUs. 3

4 Chapters list : I. Introduction to Microcontroller and MPLB X IDE v3.40 II. III. Lab 1 : Interacting with LEDs Lab 2 : Timer IV. Lab 3 : LCD and ADC ( Analog to Digital Conversion ) V. Lab 4 : PWM ( Pulse Width Modulation ) VI. Homeworks and tests. 4

5 INTRODUCTION TO MICROCHIPS AND MPLAB X IDE v Microchip Technology Inc. The Embedded Control Solutions Company - Microchip Technology Inc. is a leading provider of microcontroller and analog semiconductors, providing low-risk product development, lower total system cost and faster time to market for thousands of diverse customer applications worldwide. Headquartered in Chandler, Arizona, Microchip offers outstanding technical support along with dependable delivery and quality. - MPLAB X Integrated Development Environment (IDE) MPLAB X IDE is a software program that runs on a PC (Windows, Mac OS, Linux ) to develop applications for Microchip microcontrollers and digital signal controllers. It is called an Integrated Development Environment (IDE), because it provides a single integrated "environment" to develop code for embedded microcontrollers. 5

6 MPLAB XC16 PRO Compiler Subscription License MPLAB XC Compilers produce highly optimized code. Subscription licenses unlock PRO-level optimizations, which produce the best execution speed and code size for all PIC microcontrollers (MCUs) and dspic Digital Signal Controllers (DSCs) along with the best in compiler features. The MPLAB XC16 PRO Subscription License is charged on a monthly basis, providing 16-bit designers the ability to make use of the most features and best code optimization only when needed in the design cycle. Subscribers will also have the ability to use any version MPLAB XC16 Microchip compiler at any time, without the need for an active Microchip MPLAB XC High Priority Access (HPA) maintenance subscription. Unlike most software subscription solutions, the license is not cloudbased, providing designers the additional flexibility of using the license offline. Some example layouts : 6

7 . This is Proteus : Note : In my report, I will describe most of my projects and exercises by Proteus. We can apply the code from dspic33 into dspic30 with some changes in Configuration Bits and Registers. 7

8 And let s move on to our main projects! 8

9 Lab 1 : Basic Inputs and Outputs, Interacting with LEDs. 2.1 Objectives : - Get familiar with basic interfacing techniques and learn how to use the various microcontroller peripheral registers. - Improve skills in programming C language. 2.2 Common Registers : - TRISx : Data direction register, all port pins are defined as inputs after a reset. x : pins (B, A, ) TRISx = 0 ; define pin is an output TRISx = 0 ; define pin is an input - LATx : supply data to the outputs - PORTx : state of the input pins - ADPCFG : control the analog/digital assignment of each pin. o 1 will set that pin in Digital mode o 0 will set that pin in Analog mode 2.3 Experiments : Project 1 : Blinking LEDs. 8 LEDs are connected to PORTB[0-7] of the microcontroller. Blink the LEDs continuously with 1 sec on, 1 sec off. #Setting : Resistor value = 290 Ohm. Capacitor value = 22pF XTAL = 10MHz This is the schematic: 9

10 /* * File: blinking_led.c * Author: TrungChua * * Created on October 1, 2016, 9:54 AM */ #include <xc.h> #pragma config FNOSC = PRI #pragma config POSCMD = XT #pragma config FWDTEN = OFF // Oscillator Mode (Primary Oscillator (XT, HS, EC)) // Primary Oscillator Source (XT Oscillator Mode) // Watchdog Timer Enable (Watchdog timer enabled/disabled by user software) #define XTFREQ #define PLLMODE 1 #define FCY XTFREQ*PLLMODE/2 #include <libpic30.h> 10

11 void main(void) // IOs ADPCFG = 0xFFF ; //Define TRISB = 0; //cac chan B la output //Vars int i,j; int dem ; dem=0; int A[8] = 0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80; while(1) LATB = A[i]; delay_ms(1000); LATB = 0 ; delay_ms(1000); Project 2 : Chasing LEDs. 8 LEDs are connected to PORTB[0-7] of the microcontroller. The LEDs turn on alternately in clockwise manner where only one LED is ON at any time. #Setting : Resistor value = 290 Ohm. Capacitor value = 22pF XTAL = 10MHz Delay = 100ms This is the schematic: 11

12 /* * File: blinking_led.c * Author: TrungChua * * Created on October 1, 2016, 9:54 AM */ #include <xc.h> #pragma config FNOSC = PRI #pragma config POSCMD = XT #pragma config FWDTEN = OFF // Oscillator Mode (Primary Oscillator (XT, HS, EC)) // Primary Oscillator Source (XT Oscillator Mode) // Watchdog Timer Enable (Watchdog timer enabled/disabled by user software) #define XTFREQ #define PLLMODE 1 #define FCY XTFREQ*PLLMODE/2 #include <libpic30.h> 12

13 void main(void) // IOs ADPCFG = 0xFFF ; //Define TRISB = 0; //cac chan B la output //Vars int i,j; int dem ; dem=0; i=0; int A[8] = 0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80; while(1) LATB = A[i]; delay_ms(100); LATB = 0 ; delay_ms(100); i++; if(i>7) i=0; Project 3: Chasing LEDs with Button Like Project 2 but If the button is pressed, the Leds will run in anticlockwise manner. #Setting : Resistor value = 290 Ohm. Capacitor value = 22pF XTAL = 10MHz Delay time depends on users. This is the schematic : 13

14 /* * File: blinking_led_with_button.c * Author: TrungChua * * Created on October 1, 2016, 9:54 AM */ #include <xc.h> #pragma config FNOSC = PRI #pragma config POSCMD = XT #pragma config FWDTEN = OFF // Oscillator Mode (Primary Oscillator (XT, HS, EC)) // Primary Oscillator Source (XT Oscillator Mode) // Watchdog Timer Enable (Watchdog timer enabled/disabled by user software) #define XTFREQ #define PLLMODE 1 #define FCY XTFREQ*PLLMODE/2 #include <libpic30.h> void main(void) //IOs 14

15 ADPCFG = 0xFFF ; TRISB = 0; TRISBbits.TRISB15 = 1; //Vars int i ; int dem ; dem=0; i=0; int A[8] = 0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80; while(portbbits.rb15 == 1 ) X: delay_ms(50); LATB=A[i]; delay_ms(50); LATB = 0; i++; if(i>7) i=0; if(portbbits.rb15 == 0) delay_ms(50); while (i>=0) if(portbbits.rb15 == 1) Z: dem++; delay_ms(50); while(dem%2!=0) delay_ms(50); LATB=A[i]; delay_ms(50); LATB = 0; i--; 15

16 if(i==-1) i=7; if(portbbits.rb15 == 0) delay_ms(50); goto Z; if(dem%2==0) goto X; Project 4 : Random LEDs. 8 LEDs are connected to PORTB[0-7] of the microcontroller. the LEDs light one LED at a time but in random positions. #Setting : Resistor value = 290 Ohm. Capacitor value = 22pF XTAL = 10MHz Delay = 100ms #include <xc.h> #include <stdio.h> #include <stdlib.h> #define XTFREQ #define PLLMODE 1 #define FCY XTFREQ*PLLMODE/2 16

17 #include <libpic30.h> #pragma config FNOSC = PRI #pragma config FWDTEN = OFF #pragma config POSCMD = XT void main() ADPCFG=0xFF; TRISB=0; int c, k,n; char s=""; n=rand()%(256); for (c = 7; c >= 0; c--) k = n >> c; if (k & 1) s=s+"1"; else s=s+"0"; n= atoi(s); while (1) LATB=0b n; delay_ms(100); LATB=0; delay_ms(100); Project 5 : 7-Segment LED Interfacing. Write a program to display a 2-digit number on the 7-segment LEDs. #Setting : Resistor value = 290 Ohm. 17

18 Capacitor value = 22pF XTAL = 10MHz Delay = 50ms This is the schematic: /* * File: 7seg_16.c * Author: TrungChua * * Created on October 1, 2016, 9:54 AM */ #include <xc.h> #pragma config FNOSC = PRI #pragma config POSCMD = XT #pragma config FWDTEN = OFF // Oscillator Mode (Primary Oscillator (XT, HS, EC)) // Primary Oscillator Source (XT Oscillator Mode) // Watchdog Timer Enable (Watchdog timer enabled/disabled by user software) #define XTFREQ #define PLLMODE 1 #define FCY XTFREQ*PLLMODE/2 18

19 #include <libpic30.h> void main(void) //Led array unsigned char A[] = 0x3F,0x06,0x5B,0x4F,0x66,0x6D,0x7D,0x07,0xFf,0x6f; //IOs ADPCFG = 0xFFF ; //cac chan vo input la analog TRISB = 0; //cac chan B la output while(1) LATBbits.LATB10 = 0 ; LATB = 0xFB00 A[1]; delay_ms(50); LATBbits.LATB10 = 1 ; LATBbits.LATB11 = 0; LATB = 0xF700 A[6] ; delay_ms(50); LATBbits.LATB11 = 1; Project 6 : Write a program to display number 2016 using 7-segment LEDs. #Setting : Resistor value = 290 Ohm. Capacitor value = 22pF XTAL = 10MHz Delay = 50ms This is the schematic: 19

20 /* * File: 2016.c * Author: TrungChua * * Created on Ngày 01 tháng 10 năm 2016, 16:28 */ #include<xc.h> #define XTFREQ #define PLLMODE 1 #define FCY XTFREQ*PLLMODE/2 #include<libpic30.h> unsigned char a=0b ; unsigned char flag=0; int main(void) 20

21 //IOs ADPCFG=0xFFF; TRISB=0; LATB=0x3F; //Led array int a[]=0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f; while(1) TRISBbits.TRISB11=0; LATB=0xF000 a[2]; delay_ms(5); TRISBbits.TRISB11=1; TRISBbits.TRISB12=0; LATB= 0xEF00 a[0]; delay_ms(5); TRISBbits.TRISB12=1; TRISBbits.TRISB13=0; LATB=0xDF00 a[1]; delay_ms(5); TRISBbits.TRISB13=1; TRISBbits.TRISB14=0; LATB=0xBF00 a[6]; delay_ms(5); TRISBbits.TRISB14=1; return 0; 21

22 Lab 2 : Timer. 3.1 Objectives : - Get familiar with basic interfacing techniques and learn how to work with TIMER and its registers. - Improve skills in programming C language. - Combine skills in connecting various peripheral devices. 3.2 Common Registers : Timer register (16bits) T1CON - control register PR1 - Period TMR1 - counter T1CONbits.TON Enable timer register o = 1 Enable o = 0 Disable Timer interrupt Bit IFS0bits.T1IF - interrupt flag status bit Bit IEC0bits.T1IE - interrupt enable bit Bit IPC0bits.T1IP<2:0> - interrupt priority Timer ISR : int num; void _ISR _T1Interrupt(void) 22

23 num++; IFS0bits.T1IF = 0; 3.3 Experiments : Project 1 : 0 to 99 Write a program to display number from 0 to 99 using 7-segment LEDs and Timer. #Setting : Resistor value = 290 Ohm. Capacitor value = 22pF XTAL = 10MHz Delay = 10ms This is the schematic: /* 23

24 * File: 7seg_Timer.c * Author: TrungChua * * Created on Ngày 01 tháng 10 năm 2016, 16:28 */ #include "xc.h" #include <p33fj12gp202.h> #include <stdio.h> #pragma config FNOSC = PRI #pragma config POSCMD = XT // Oscillator Mode (Primary Oscillator (XT, HS, EC)) // Primary Oscillator Source (XT Oscillator Mode) #pragma config FWDTEN = OFF #define XTFREQ // Crystal frequency #define PLLMODE 1 // On-chip PLL setting #define FCY XTFREQ*PLLMODE/2 // Instruction Cycle Frequency #include <libpic30.h> // library for delay function int num; void _ISR _T1Interrupt(void) num++; IFS0bits.T1IF=0; If(t==100) t =0; void main(void) //Led array unsigned char Led[] = 0x3F,0x06,0x5B,0x4F,0x66,0x6D,0x7D,0x07,0x7f,0x6f; //IOs ADPCFG = 0xFFFF ; //input la digital TRISB = 0; //B output //Timer 24

25 TMR1 = 0 ; IFS0bits.T1IF =0; IEC0bits.T1IE = 1; PR1 = 0x4C4b; //tao delay 1s T1CON = 0x8030; //chon prescaler 1:256 while(1) int a,b; a = num/10; b = num%10; delay_ms(10); LATBbits.LATB15=1; LATB=0x8000 Led[a]; LATBbits.LATB15=0; delay_ms(10); LATBbits.LATB14=1; LATB=0x4000 Led[b]; LATBbits.LATB14=0; Project 2 : You DRUNK or WHAT? Write a program to inspect people after a party whether they had drunk too much or not, using 7-segment LEDs and Timer. + The time is indicated by the LEDs after the button is pressed + TIMER is activated ONLY when the LED-BLUE lights on. LED-BLUE on 1 sec and off 1 sec. #Setting : Resistor value = 290 Ohm. Capacitor value = 22pF 25

26 XTAL = 10MHz Delay = 10ms This is the schematic: /* * File: Drunk.c * Author: TrungChua * * Created on Ngày 17 tháng 10 năm 2016, 16:28 */ #include <xc.h> #pragma config FNOSC = PRI #pragma config POSCMD = XT #pragma config FWDTEN = OFF // Oscillator Mode (Primary Oscillator (XT, HS, EC)) // Primary Oscillator Source (HS Oscillator Mode) // Watchdog Timer Enable (Watchdog timer enabled/disabled by user software) #define XTFREQ #define PLLMODE 1 26

27 #define FCY XTFREQ*PLLMODE/2 #include <libpic30.h> // khai bao bien chung int r,k; // ngat timer void _ISR _T1Interrupt (void) k++; r=0; if (k%2==0) LATAbits.LATA0 = 0; else if (k%2==1) LATAbits.LATA0 = 1; IFS0bits.T1IF = 0; int hienso(int q) int a[10]=0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f; LATBbits.LATB10=0; LATB=0x7B00 a[q/1000] ; delay_ms(10); LATBbits.LATB10=1; LATBbits.LATB11=0; LATB= 0x7700 a[q%1000/100]; delay_ms(10); LATBbits.LATB11=1; LATBbits.LATB12=0; LATB= 0x6F00 a[q%100/10]; delay_ms(10); 27

28 LATBbits.LATB12=1; LATBbits.LATB13=0; LATB= 0x5F00 a[q%10]; delay_ms(10); LATBbits.LATB13=1; return(0); int main(void) // khai bao IO ADPCFG = 0xFFFF; TRISB=0; TRISBbits.TRISB14 = 1; TRISAbits.TRISA0 = 0; TRISAbits.TRISA1 = 1; // khai bao timer TMR1 = 0; PR1 = 0x4C4C; IFS0bits.T1IF = 0; IEC0bits.T1IE = 1; T1CON = 0x8030; //khai bao bien long tt=0; // loop while (1) if(portabits.ra1==0) T1CONbits.TON = 0; 28

29 if (k%2==1 && r==0) tt = TMR1*0.0512;r=1; //tt = ((TMR1*256*2)/ )*1000; delay_ms(50); while(portabits.ra1==0) ; T1CONbits.TON = 1; hienso(tt); return (0); Lab 3 : LCD and ADC ( Analog to Digital Conversion ). 4.1 Objectives : - Get familiar with basic interfacing techniques and learn how to work with TIMER, LCD, ADC and their registers. - Improve skills in programming C language. - Combine skills in connecting various peripheral devices. 4.2 Common Registers : LCD : - #include <lcd.h> - Lcd_Init(); - Activate LCD - Lcd_Clear() Clear screen for next cycle. 29

30 - Lcd_Set_Cursor(x,y) set cursor. o x, y : coordinate of cursor on the screen, x<2 and y < Lcd_Write_String(<string>); - show strings on screen. - sprintf(<char array >,"%u",<int numbers>) - %f with float numbers. => use this function to convert from num to string. ADC : *Attention : these below registers are used for dspic33 MCUs but not for dspic30f MCUs. You may want to look up for the Datasheet of dspic30f Family if you are working with dspic30f Configure port pins as analog inputs ( register ADPCFG ). - Select input chanel AD1CHS0. - Select conversion clock ( AD1CON3 ) - Select conversion trigger (AD1CON1 ) - Turn on module ( AD1CON1.ADON ) - Start sampling : SAMP for manual sampling or ASAMP for automatic sampling. - DONE bit to finish SAMP process. - Data is returned to ADCBUF Experiments : Project 1 : Show Time. Write a program to show time using LCD and Timer. #Setting : Capacitor value = 22pF XTAL = 10MHz Delay = 1s This is the schematic: 30

31 /* * File: LCD_Timer.c * Author: TrungChua * * Created on Ngày 20 tháng 10 năm 2016, 16:28 */ #include <xc.h> #include <stdio.h> #include <stdlib.h> #pragma config FNOSC = PRI #pragma config POSCMD = XT #pragma config FWDTEN = OFF // Oscillator Mode (Primary Oscillator (XT, HS, EC)) // Primary Oscillator Source (HS Oscillator Mode) // Watchdog Timer Enable (Watchdog timer enabled/disabled by user software) #define XTFREQ #define PLLMODE 1 31

32 #define FCY XTFREQ*PLLMODE/2 #include <libpic30.h> #define RS LATBbits.LATB14 #define EN LATBbits.LATB15 #define D4 LATBbits.LATB0 #define D5 LATBbits.LATB1 #define D6 LATBbits.LATB2 #define D7 LATBbits.LATB3 #include "lcd.h" #include <p33fj12gp202.h> int s; void _ISR _T1Interrupt(void) s++; IFS0bits.T1IF = 0 ; int main (void) // IO ADPCFG = 1; TRISB = 0 ; //TIMER TMR1 = 0 ; IFS0bits.T1IF = 0 ; IEC0bits.T1IE =1 ; PR1 = 0X1E85 ; T1CON = 0X0030; //LCD Lcd_Init(); unsigned char b[8]; unsigned int a ; while (1) 32

33 delay_ms(100); T1CON = 0x8030; delay_ms(100); sprintf(b,"%u",s); Lcd_Clear(); Lcd_Set_Cursor(1,1); Lcd_Write_String("TMR = "); Lcd_Set_Cursor(2,1); Lcd_Write_String(b); T1CON = 0X0030; return 0; Project 2 : Which temperature is it? Write a program to show room s temperature using LCD and LM35. #Setting : Capacitor value = 22pF XTAL = 10MHz This is the schematic: 33

34 /* * File: ADC_LM35.c * Author: TrungChua * * Created on Ngày 20 tháng 10 năm 2016, 16:28 */ #include <xc.h> #include <stdio.h> #include <stdlib.h> #pragma config FNOSC = PRI #pragma config POSCMD = XT #pragma config FWDTEN = OFF // Oscillator Mode (Primary Oscillator (XT, HS, EC)) // Primary Oscillator Source (HS Oscillator Mode) // Watchdog Timer Enable (Watchdog timer enabled/disabled by user software) #define XTFREQ #define PLLMODE 1 #define FCY XTFREQ*PLLMODE/2 34

35 #include <libpic30.h> #define RS LATBbits.LATB14 #define EN LATBbits.LATB15 #define D4 LATBbits.LATB0 #define D5 LATBbits.LATB1 #define D6 LATBbits.LATB2 #define D7 LATBbits.LATB3 #include "lcd.h" #include <p33fj12gp202.h> int main (void) //IOs ADPCFG = 0xFFF0; TRISB = 0; //ADC AD1CON1bits.ADON =1 ;//ADC on AD1CHS0=1;//Connect AN1 as CH0 input AD1CSSL = 0; //No scan AD1CON3 = 0x000F; //LCD Lcd_Init(); double t ; unsigned char a[10]; while (1) AD1CON1bits.SAMP = 1 ; delay_us(10); AD1CON1bits.SAMP = 0; while(ad1con1bits.done == 0); t = ADCBUF0 ; t = (t*5000/1024)/10; //max ADC la 1023, LM35 chi hoat dong o 10mV/1 do C sprintf(a,"%f",t); Lcd_Clear(); 35

36 Lcd_Set_Cursor(1,1); Lcd_Write_String("Temp = "); Lcd_Set_Cursor(2,1); Lcd_Write_String(a); delay_ms(500); return 0; Project 3 : Adjust variable resistor Write a program to show temperature in room using LCD and LM35. #Setting : Capacitor value = 22pF XTAL = 10MHz This is the schematic: /* * File: ADC_POT.c * Author: TrungChua 36

37 * * Created on Ngày 22 tháng 10 năm 2016, 16:28 */ #include <xc.h> #include <stdio.h> #include <stdlib.h> #pragma config FNOSC = PRI #pragma config POSCMD = XT #pragma config FWDTEN = OFF // Oscillator Mode (Primary Oscillator (XT, HS, EC)) // Primary Oscillator Source (HS Oscillator Mode) // Watchdog Timer Enable (Watchdog timer enabled/disabled by user software) #define XTFREQ #define PLLMODE 1 #define FCY XTFREQ*PLLMODE/2 #include <libpic30.h> #define RS LATBbits.LATB14 #define EN LATBbits.LATB15 #define D4 LATBbits.LATB0 #define D5 LATBbits.LATB1 #define D6 LATBbits.LATB2 #define D7 LATBbits.LATB3 #include "lcd.h" #include <p33fj12gp202.h> int main (void) // IO ADPCFG = 0xFFF0; TRISB = 0; AD1CON1bits.ADON =1 ;//ADC on AD1CHS0=1;//Connect AN2 as CH0 input AD1CSSL = 0; //No scan AD1CON3 = 0x000F; //ADCS=3 (min TAD for 10Mhz is 3*TCY = 300ns ) Lcd_Init(); 37

38 //Vars int adcvalue; unsigned char a[10]; while (1) AD1CON1bits.SAMP = 1 ; //Start sampling (SAMP = 1 ) delay_us(10); AD1CON1bits.SAMP = 0 ; //Clear SAMP bit ( trigger conversion ) while (AD1CON1bits.DONE == 0 ); //Wait for Done bit in ADCON1 adcvalue = ADCBUF0 ; //assign value to variable adcvalue //adcvalue = 800; adcvalue = (adcvalue*0.098); sprintf(a,"%u",adcvalue); Lcd_Clear(); Lcd_Set_Cursor(1,1); Lcd_Write_String(a); delay_ms(500); return 0; 38

39 Lab 4 : PWM ( Pulse Width Modulation ). *In this part, all of my experiments are real-life experiments so there will be no schematic or virtual environtments by Proteus. 5.1 Objectives : - Get familiar with basic interfacing techniques and learn how to work PWM and its registers. - Improve skills in programming C language. - Experience in real-life projects. - Combine skills in connecting various peripheral devices. 5.2 Common Registers : PTMR:PWM Time Base Register PTPER : PWM Time Base Period Register PWMCON1 : PWM Control Register #1 PWMCON2 : PWM Control Register #2 PDC1 : PWM Duty Cycle register #1 PDC2 : PWM Duty Cycle register #2 PDC3 : PWM Duty Cycle register #3 PDC4 : PWM Duty Cycle register #4 Refer to the dspic30f family manual, section 15 for more detail of these registers above. T PWM = T CY * ( PTPER +1 ) * PTPMR Prescaler Value Or PTMR is configured for one of the Continuous Up/Down Count modes : T PWM = T CY * 2 * ( PTPER +1 ) * PTPMR Prescaler Value 5.3 Experiments : 39

40 Project 1 : Control the brightness of light by pot /* * File: PWM1.c * Author: TrungChua * * Created on Ngày 22 tháng 10 năm 2016, 16:28 */ #pragma config FPR = HS // Primary Oscillator Mode (HS) #pragma config FOS = PRI // Oscillator Source (Primary Oscillator) #pragma config WDT = WDT_OFF // Watchdog Timer (Disabled) #include <stdio.h> #include <stdlib.h> #include <xc.h> #include <math.h> #define XTFREQ #define PLLMODE 1 #define FCY XTFREQ*PLLMODE/4 #include <libpic30.h> int k=3; double e; int main() //IOs TRISE = 0; LATE = 0xFF; ADPCFG = 0xFFF0; //ADC ADCHS = 2; ADCON1bits.ADON = 1; //ADC on PTCON = 0x800C; //prescaler 64 PTPER = 0x00FF; PWMCON1 = 0x0007; while(1) AD1CON1bits.SAMP = 1 ; //start sampling (SAMP = 1) delay_us(10); AD1CON1bits.SAMP = 0; // clear SAMP bit_trigger conversion) while (AD1CON1bits.DONE == 0); e = ADCBUF0; // assign value to e PDC1 = e * 255*500 / 1023 ; 40

41 return (0); Project 2 : Control the brightness of a tricolor LED /* * File: PWM2.c * Author: TrungChua * * Created on Ngày 22 tháng 10 năm 2016, 16:28 */ #pragma config FPR = HS // Primary Oscillator Mode (HS) #pragma config FOS = PRI // Oscillator Source (Primary Oscillator) #pragma config WDT = WDT_OFF // Watchdog Timer (Disabled) #include <stdio.h> #include <stdlib.h> #include <xc.h> #include <math.h> #define XTFREQ #define PLLMODE 1 #define FCY XTFREQ*PLLMODE/4 #include <libpic30.h> int k=3; double e; int main() TRISE = 0; LATE = 0xFF; ADPCFG = 0xFFF0; ADCHS = 2; ADCON1bits.ADON = 1; //ADC on PTCON = 0x800C; //prescaler 64 PTPER = 0x00FF; PWMCON1 = 0x0007; PDC1=255; PDC2=0; PDC3=0; while(1) while ( (PDC1 > 0)&&(PDC2<=255) ) PDC1 = PDC1-3; PDC2=PDC2+6; PDC3=PDC3+3; delay_ms(20); 41

42 return (0); while (PDC1 >0 ) PDC1 = PDC1-3; PDC2=PDC2-6; if (PDC2<=0) PDC2=0; PDC3=PDC3+3; delay_ms(20); while ( (PDC1 > 0)&&(PDC2<=255) ) PDC1 = PDC1+3; PDC2=PDC2+6; PDC3=PDC3-3; delay_ms(20); while (PDC1 <255 ) PDC1 = PDC1+3; PDC2=PDC2-6; if (PDC2<=0) PDC2=0; PDC3=PDC3-3; delay_ms(20); 42

43 HomeWorks and Tests. 6.1 Counter the button & turn on the led. #pragma config FNOSC = PRI // Oscillator Mode (Primary Oscillator (XT, HS, EC)) #pragma config POSCMD = HS // Primary Oscillator Source (HS Oscillator Mode) #pragma config FWDTEN = OFF // Watchdog Timer Enable (Watchdog timer enabled/disabled by user software) #include<xc.h> #define XTFREQ #define PLLMODE 1 #define FCY XTFREQ*PLLMODE/4 #include <libpic30.h> int main(void) ADPCFG = 0xFFFF; // analog to digital 43

44 TRISB = 0; // B output TRISE = 1; // E input int led4=0; int k; while (1) if (PORTEbits.RE0 == 0 ) delay_ms(50); while(portebits.re0 == 0) led4=~led4; LATBbits.LATB7 = led4; if (led4 == 1) A: if (PORTEbits.RE1 == 0 ) delay_ms(50); while(portebits.re1 == 0) k++; delay_ms(80); if (PORTEbits.RE1 == 0 ) goto A; LATB=0b k; LATBbits.LATB7=led4; return (0); 44

45 6.2 Use LCD & button to show the percent and control the speed. #pragma config FNOSC = PRI // Oscillator Mode (Primary Oscillator (XT, HS, EC)) #pragma config POSCMD = HS // Primary Oscillator Source (HS Oscillator Mode) #pragma config FWDTEN = OFF // Watchdog Timer Enable (Watchdog timer enabled/disabled by user software) #include <xc.h> #define xtfreq #define pllmode 1 #define FCY xtfreq*pllmode/2 #include "libpic30.h" #define RS LATBbits.LATB14 #define EN LATBbits.LATB15 #define D4 LATBbits.LATB0 #define D5 LATBbits.LATB1 #define D6 LATBbits.LATB2 #define D7 LATBbits.LATB3 #include <lcd.h> #include <p33fj12gp202.h> #include <stdio.h> #include <stdlib.h> 45

46 int s=0; int k ; void _ISR _T1Interrupt(void) s = s + k ; IFS0bits.T1IF = 0 ; if(s>1000) s = 0; int main (void) // IO ADPCFG = 0xFFFF; TRISB = 0 ; TRISBbits.TRISB12 = 1; TRISBbits.TRISB13 = 1 ; //TIMER TMR1 = 0 ; IFS0bits.T1IF = 0 ; IEC0bits.T1IE =1 ; PR1 = 0X5b8d ; T1CON = 0X8020; //LCD Lcd_Init(); unsigned char b[8]; k=20; while (1) if(portbbits.rb12 == 0) delay_ms(50); k=(k+20*0.2); 46

47 if(portbbits.rb13 == 0) delay_ms(50); k=( k-20*0.2); if (k<s) k=2; sprintf(b,"%u",s/10); Lcd_Clear(); Lcd_Set_Cursor(1,1); Lcd_Write_String("Level = "); Lcd_Set_Cursor(2,1); Lcd_Write_String(b); Lcd_Set_Cursor(2,5); Lcd_Write_String("%"); delay_ms(50); return 0; Use LM35 & POT( variable resistor) to control fan speed. 47

48 #include <p33fj32gp202.h> #include <xc.h> #include <stdio.h> #pragma config FNOSC = PRI // Oscillator Mode (Primary Oscillator (XT, HS, EC)) #pragma config POSCMD = XT // Primary Oscillator Source (XT Oscillator Mode) #pragma config FWDTEN = OFF #define XTFREQ #define PLLMODE 1 #define FCY XTFREQ*PLLMODE/4 #include <libpic30.h> #define RS LATBbits.LATB13 #define EN LATBbits.LATB14 #define D4 LATBbits.LATB1 #define D5 LATBbits.LATB2 #define D6 LATBbits.LATB3 #define D7 LATBbits.LATB4 #include <lcd.h> int k; double e; double i; double sp; void _ISR _T1Interrupt (void) e=0; for (k=0;k<=7;k++) AD1CHS0 = 1; // connect AN1 as CH0 input AD1CON1bits.SAMP = 1 ; //start sampling (SAMP = 1) delay_us(10); AD1CON1bits.SAMP = 0; // clear SAMP bit_trigger conversion) while (AD1CON1bits.DONE == 0); e = e + ADCBUF0; // assign value to e IFS0bits.T1IF = 0; e = e / 8 ; e = e * 500 / 1023 ; AD1CHS0 = 0; AD1CON1bits.SAMP = 1 ; //start sampling (SAMP = 1) delay_us(10); AD1CON1bits.SAMP = 0; // clear SAMP bit_trigger conversion) while (AD1CON1bits.DONE == 0); i = ADCBUF0; // assign value to e int main(void) //IOs TRISB=0; ADPCFG = 0xFFFF; //ADC AD1CHS0 = 1; // connect AN1 as CH0 input AD1CSSL = 0; //No scan 48

49 AD1CON1bits.ADON = 1; //ADC on //TIMER TMR1 = 0; PR1 = 0x4C4B; IFS0bits.T1IF = 0; // CLR INTERRUPT FLAG IEC0bits.T1IE = 1; // SET INTERRUPT ENABLE BIT T1CON = 0x8030; //LCD Lcd_Init(); unsigned char b[16]; while(1) if(e<40.0) sp = 0; else if (e>=40.0 && e < 65.0) sp = i; else if (e>=65.0) sp = 2200; sprintf(b,"%f",sp); Lcd_Clear(); Lcd_Set_Cursor(1,1); Lcd_Write_String("Fan speed "); Lcd_Set_Cursor(2,1); Lcd_Write_String(b); delay_ms(500); return (0); 6.4 TRAFFIC LIGHTS : 49

50 /* * HomeWork : Traffic Lights. * Created: Thu Oct * Processor: dspic33fj12gp202 * Compiler: MPLAB XC16 Den do : 15s Den xanh : 12s Den vang : 3s */ #include <xc.h> #pragma config FNOSC = PRI #pragma config POSCMD = XT #pragma config FWDTEN = OFF #define XTFREQ #define PLLMODE 1 #define FCY XTFREQ*PLLMODE/2 #include <libpic30.h> #include <p33fj12gp202.h> //Global Vars int t1,t2; int t; int k =0; int dd = 15; int dx = 12; int dv = 3 ; unsigned int den1=0, den2=0,den=0; void _ISR _T1Interrupt(void) t1--; t2--; if(t1<0 ) t1 = dd; if(t2 < 0 ) t2 =dx; IFS0bits.T1IF = 0; // Oscillator Mode (Primary Oscillator (XT, HS, EC)) // Primary Oscillator Source (XT Oscillator Mode) // Watchdog Timer Enable (Watchdog timer enabled/disabled by user software) int main (void) // IO ADPCFG = 0xFFFF ; TRISB = 0; //Timer TMR1 = 0 ; PR1 = 0x4C4B; IFS0bits.T1IF = 0 ; IEC0bits.T1IE = 1 ; T1CON = 0x8030; //Var unsigned int dendo1 = 0x0040; unsigned int denvang1 = 0x0080; unsigned int denxanh1 = 0x0100 ; unsigned int dendo2 = 0x0200; 50

51 unsigned int denvang2 = 0x0400; unsigned int denxanh2 = 0x0800 ; unsigned char mabit[10] = 0,0b0001,0b0010,0b0011,0b0100,0b0101,0b0110,0b0111,0b1000,0b1001; t1 = dd; t2 = dx; den1=dendo1; den2=denxanh2; t=dv; while (1) if(t2==0 && k == 0 ) t2 = t; den2=denvang2; k++; if(t1==0 && k == 1) t1 = dx ; den1=denxanh1; t2 = dd; den2=dendo2; k++; if(t1 ==0 && k == 2 ) t1 =t; den1=denvang1; k++; if(t2==0 && k == 3 &&t1==0 ) t1=dd; den1=dendo1; t2=dx; den2=denxanh2; k=0; int a,b,c,d; a=t1/10; b=t1%10; c=t2/10; d=t2%10; LATBbits.LATB12 = 0; LATB = 0X8000 mabit[a] den2 den1; delay_ms(10); LATBbits.LATB12 = 1; LATBbits.LATB13=0; LATB = 0x4000 mabit[b] den2 den1; delay_ms(10); LATBbits.LATB13=1; 51

52 LATBbits.LATB14 = 0; LATB = 0X2000 mabit[c] den2 den1; delay_ms(10); LATBbits.LATB14 = 1; LATBbits.LATB15=0; LATB = 0x1000 mabit[d] den2 den1; delay_ms(10); LATBbits.LATB15=1; return 0; 6.5 Final Test : /* Main.c file generated by New Project wizard * * Created: Sat Oct * Processor: dspic33fj12gp202 * Compiler: MPLAB XC16 */ #pragma config POSCMD = XT #pragma config FNOSC = PRI #pragma config FWDTEN = OFF // Primary Oscillator Source (XT Oscillator Mode) // Oscillator Mode (Primary Oscillator (XT, HS, EC)) // Watchdog Timer Enable (Watchdog timer enabled/disabled by user software) #include <xc.h> 52

53 #include <p33fj12gp202.h> #define xtfreq #define pllmode 1 #define FCY xtfreq*pllmode/2 #include "libpic30.h" #define RS LATBbits.LATB14 #define EN LATBbits.LATB15 #define D4 LATBbits.LATB4 #define D5 LATBbits.LATB5 #define D6 LATBbits.LATB6 #define D7 LATBbits.LATB7 #include "lcd.h" int t1=0; int t2=0; void _ISR _T1Interrupt(void) t1++; IFS0bits.T1IF =0 ; void _ISR _T2Interrupt(void) t2++; IFS0bits.T2IF =0 ; int main (void) // IOs ADPCFG = 0xfff; TRISB =0; TRISBbits.TRISB12 = 1; TRISBbits.TRISB13=1; //Timer TMR1=0; 53

54 PR1=0x4C4D; IFS0bits.T1IF = 0; IEC0bits.T1IE = 1 ; T1CON=0X0020; TMR2=0; PR2=0x4C4D; IFS0bits.T2IF = 0; IEC0bits.T2IE = 1 ; T2CON=0X0020; //Lcd Lcd_Init(); unsigned char s[10]; double V=0; while (1) if(portbbits.rb12==0) T2CONbits.TON=1; t1=0; delay_ms(50); while(portbbits.rb12==0); T2CONbits.TON=0; if(t2<1) Lcd_Clear(); Lcd_Set_Cursor(1,1); Lcd_Write_String("Wrong Item "); else if(t2>=1) T1CONbits.TON=1; delay_ms(50); t2=0; 54

55 if(portbbits.rb13==0) T1CON=0X0020; delay_ms(50); V=200/t1; while(portbbits.rb13==0) ; sprintf(s,"%f",v); Lcd_Clear(); Lcd_Set_Cursor(1,1); Lcd_Write_String("True Item(s) "); Lcd_Set_Cursor(2,1); Lcd_Write_String(s); Lcd_Set_Cursor(2,1); Lcd_Write_String("V = "); Lcd_Set_Cursor(2,5); Lcd_Write_String(s); Lcd_Set_Cursor(2,8); Lcd_Write_String("m/s "); delay_ms(50); return 0; END OF REPORT THANKS FOR YOUR ATTENTIONS! Great things come to those who hustle 55

dspic Interrupts The Interrupt Control and Staus Registers are :- ENG721-S2 Mixed Signal Processing : Hassan Parchizadeh Page 1

dspic Interrupts The Interrupt Control and Staus Registers are :- ENG721-S2 Mixed Signal Processing : Hassan Parchizadeh Page 1 dspic Interrupts The dspic30f4012 has 30 interrupt sources which 3 are external interrupts and 4 processor exception traps. There are 8 user selectable priority levels for each interrupt source. These

More information

Microprocessors B (17.384) Spring Lecture Outline

Microprocessors B (17.384) Spring Lecture Outline Microprocessors B (17.384) Spring 2013 Lecture Outline Class # 04 February 12, 2013 Dohn Bowden 1 Today s Lecture Administrative Microcontroller Hardware and/or Interface Programming/Software Lab Homework

More information

Remote Controlled KitchenAid Mixer for the Clients at ADEC. Appendices. Arnaud Bacye Karina Dubé Justin Erman Matthew Martin

Remote Controlled KitchenAid Mixer for the Clients at ADEC. Appendices. Arnaud Bacye Karina Dubé Justin Erman Matthew Martin Mix Masters Remote Controlled KitchenAid Mixer for the Clients at ADEC Appendices Arnaud Bacye Karina Dubé Justin Erman Matthew Martin Table of Contents A Hardware Schematics and Boards 2 A.1 Current Schematics

More information

Embedded systems. Exercise session 3. Microcontroller Programming Lab Preparation

Embedded systems. Exercise session 3. Microcontroller Programming Lab Preparation Embedded systems Exercise session 3 Microcontroller Programming Lab Preparation Communications Contact Mail : michael.fonder@ulg.ac.be Office : 1.82a, Montefiore Website for the exercise sessions and the

More information

EEE394 Microprocessor and Microcontroller Laboratory Lab #6

EEE394 Microprocessor and Microcontroller Laboratory Lab #6 Exp. No #6 Date: INTERRUPTS AND ADC IN PIC MICROCONTROLLER OBJECTIVE The purpose of the experiment is to configure external interrupt and the ADC in PIC microcontrollers. (i) To flip the LED connected

More information

Interrupts. Embedded Systems Interfacing. 08 September 2011

Interrupts. Embedded Systems Interfacing. 08 September 2011 08 September 2011 An iterrupt is an internal or external event that forces a hardware call to a specified function called an interrupt service routine Interrupt enable must be set (initialization) The

More information

By the end of Class. Outline. Homework 5. C8051F020 Block Diagram (pg 18) Pseudo-code for Lab 1-2 due as part of prelab

By the end of Class. Outline. Homework 5. C8051F020 Block Diagram (pg 18) Pseudo-code for Lab 1-2 due as part of prelab By the end of Class Pseudo-code for Lab 1-2 due as part of prelab Homework #5 on website due before next class Outline Introduce Lab 1-2 Counting Timers on C8051 Interrupts Laboratory Worksheet #05 Copy

More information

/*Algorithm: This code display a centrifuge with five variable speed RPM by increaseing */

/*Algorithm: This code display a centrifuge with five variable speed RPM by increaseing */ /*Algorithm: This code display a centrifuge with five variable speed RPM by increaseing */ /*the speed the cell which are less dense can float and the cell that are denser can sink*/ /*the user has five

More information

Lecture (09) PIC16F84A LCD interface LCD. Dr. Ahmed M. ElShafee

Lecture (09) PIC16F84A LCD interface LCD. Dr. Ahmed M. ElShafee Lecture (09) PIC16F84A LCD interface PIC16F84A LCD interface Assignment 01, 4 Zones fire controller board Assignment 02, automatic water tank controller Dr. Ahmed M. ElShafee ١ ٢ LCD LCD (Liquid Crystal

More information

Embedded Systems Module. 6EJ505. C Tutorial 3: using the ICD3 rev tjw

Embedded Systems Module. 6EJ505. C Tutorial 3: using the ICD3 rev tjw Embedded Systems Module. 6EJ505 C Tutorial 3: using the ICD3 rev. 27.9.16 tjw Images are reproduced from Reference 1. Microchip permits the use of its images for educational purposes. Main Learning Points

More information

Introduction to Microcontroller Apps for Amateur Radio Projects Using the HamStack Platform.

Introduction to Microcontroller Apps for Amateur Radio Projects Using the HamStack Platform. Introduction to Microcontroller Apps for Amateur Radio Projects Using the HamStack Platform www.sierraradio.net www.hamstack.com Topics Introduction Hardware options Software development HamStack project

More information

Timer0..Timer3. Interrupt Description Input Conditions Enable Flag

Timer0..Timer3. Interrupt Description Input Conditions Enable Flag Timer0..Timer3 Timers are pretty useful: likewise, Microchip provides four different timers for you to use. Like all interrupts, you have to Enable the interrupt, Set the conditions of the interrupt, and

More information

Copyright mikroelektronika, January All rights reserved.

Copyright mikroelektronika, January All rights reserved. Copyright mikroelektronika, January 22. All rights reserved. TO OUR VALUED CUSTOMERS I want to express my thanks to you for being interested in our products and for having confidence in MikroElektronika.

More information

Speed Control of a DC Motor using Digital Control

Speed Control of a DC Motor using Digital Control Speed Control of a DC Motor using Digital Control The scope of this project is threefold. The first part of the project is to control an LCD display and use it as part of a digital tachometer. Secondly,

More information

Laboratory: Introduction to Mechatronics

Laboratory: Introduction to Mechatronics Laboratory: Introduction to Mechatronics Instructor TA: Edgar Martinez Soberanes (eem370@mail.usask.ca) 2017-02-9 Lab 3. LED Control and Interruptions. Lab Sessions Lab 1. Introduction to the equipment

More information

8051 Microcontroller

8051 Microcontroller 8051 Microcontroller The 8051, Motorola and PIC families are the 3 leading sellers in the microcontroller market. The 8051 microcontroller was originally developed by Intel in the late 1970 s. Today many

More information

Using Timers of Microchip PIC18F Microcontrollers

Using Timers of Microchip PIC18F Microcontrollers Using Timers of Microchip PIC18F Microcontrollers ARSLAB - Autonomous and Robotic Systems Laboratory Dipartimento di Matematica e Informatica - Università di Catania, Italy santoro@dmi.unict.it L.A.P.

More information

Section 33. Device Configuration (Part II)

Section 33. Device Configuration (Part II) Section 33. Device Configuration (Part II) HIGHLIGHTS This section of the manual contains the following major topics: 33.1 Introduction... 33-2 33.2 Device Configuration Registers... 33-2 33.3 Configuration

More information

Section 16. Analog-to-Digital Converter (ADC)

Section 16. Analog-to-Digital Converter (ADC) 16 HIGHLIGHTS Section 16. Analog-to-Digital er (ADC) This section of the manual contains the following major topics: Analog-to-Digital er (ADC) 16.1 Introduction... 16-2 16.2 Control Registers... 16-6

More information

ECE Homework #10

ECE Homework #10 Timer 0/1/2/3 ECE 376 - Homework #10 Timer 0/1/2/3, INT Interrupts. Due Wednesday, November 14th, 2018 1) Write a program which uses INT and Timer 0/1/2/3 interrupts to play the cord C#major for 1.000

More information

Analog Output with a Digital to Analog Converter

Analog Output with a Digital to Analog Converter Analog Output with a Digital to Analog Converter Matthew Beckler beck0778@umn.edu EE2361 Lab 007 April 5, 2006 Abstract Without help, microcontrollers can have great trouble creating analog signals. Approximations

More information

DEV-1 HamStack Development Board

DEV-1 HamStack Development Board Sierra Radio Systems DEV-1 HamStack Development Board Reference Manual Version 1.0 Contents Introduction Hardware Compiler overview Program structure Code examples Sample projects For more information,

More information

BME 4900 Page 1 of 2. Meeting 2: Personal Progress Report 12/2/09 Team 12 with Drew Seils. Semester One Week Two

BME 4900 Page 1 of 2. Meeting 2: Personal Progress Report 12/2/09 Team 12 with Drew Seils. Semester One Week Two BME 4900 Page 1 of 2 Semester One Week Two These past two saw a lot of progress with the Revo stationary bike project. During Thanksgiving break Shane spent most of his time doing research for the power

More information

ELCT708 MicroLab Session #1 Introduction to Embedded Systems and Microcontrollers. Eng. Salma Hesham

ELCT708 MicroLab Session #1 Introduction to Embedded Systems and Microcontrollers. Eng. Salma Hesham ELCT708 MicroLab Session #1 Introduction to Embedded Systems and Microcontrollers What is common between these systems? What is common between these systems? Each consists of an internal smart computer

More information

EE6008-Microcontroller Based System Design Department Of EEE/ DCE

EE6008-Microcontroller Based System Design Department Of EEE/ DCE UNIT- II INTERRUPTS AND TIMERS PART A 1. What are the interrupts available in PIC? (Jan 14) Interrupt Source Enabled by Completion Status External interrupt from INT INTE = 1 INTF = 1 TMR0 interrupt T0IE

More information

Interrupts on PIC18F252 Part 2. Interrupts Programming in C Language

Interrupts on PIC18F252 Part 2. Interrupts Programming in C Language Interrupts on PIC18F252 Part 2 Interrupts Programming in C Language Programming interrupts in C language using XC8 compiler is significantly simplified compared to C18 compiler. This note explains the

More information

EE 308 Spring A software delay. To enter a software delay, put in a nested loop, just like in assembly.

EE 308 Spring A software delay. To enter a software delay, put in a nested loop, just like in assembly. More on Programming the 9S12 in C Huang Sections 5.2 through 5.4 Introduction to the MC9S12 Hardware Subsystems Huang Sections 8.2-8.6 ECT_16B8C Block User Guide A summary of MC9S12 hardware subsystems

More information

The MCU s Pulse. Internal clock or oscillator to synchronize operation. One clock cycle = 1 TOSC = 1/fOSC. t TOSC

The MCU s Pulse. Internal clock or oscillator to synchronize operation. One clock cycle = 1 TOSC = 1/fOSC. t TOSC The MCU s Pulse Internal clock or oscillator to synchronize operation V 0 t TOSC One clock cycle = 1 TOSC = 1/fOSC Clock Cycle The minimum time to perform any operation is one instruction cycle TCY 1 TCY

More information

Capture Mode of Pic18F252

Capture Mode of Pic18F252 Capture Mode of Pic18F252 PIC18F253 has two Capture/Compare/Pulse Width Modulation modules. Some devices such as ADCs, Sensors (position, velocity, accelearstion, temperature [MAX6577 converts the ambient

More information

SquareWear Programming Reference 1.0 Oct 10, 2012

SquareWear Programming Reference 1.0 Oct 10, 2012 Content: 1. Overview 2. Basic Data Types 3. Pin Functions 4. main() and initsquarewear() 5. Digital Input/Output 6. Analog Input/PWM Output 7. Timing, Delay, Reset, and Sleep 8. USB Serial Functions 9.

More information

MPLAB SIM. MPLAB IDE Software Simulation Engine Microchip Technology Incorporated MPLAB SIM Software Simulation Engine

MPLAB SIM. MPLAB IDE Software Simulation Engine Microchip Technology Incorporated MPLAB SIM Software Simulation Engine MPLAB SIM MPLAB IDE Software Simulation Engine 2004 Microchip Technology Incorporated MPLAB SIM Software Simulation Engine Slide 1 Welcome to this web seminar on MPLAB SIM, the software simulator that

More information

PIC 28 Pin Board Documentation. Update Version 5.0

PIC 28 Pin Board Documentation. Update Version 5.0 PIC 28 Pin Board Documentation Update 2009.10 Version 5.0 Table of Contents PIC 28 Pin Board Documentation... 1 Table of Contents... 2 Introduction... 3 Circuit Schematic... 4 The following is the Circuit

More information

Hong Kong Institute of Vocational Education Digital Electronics & Microcontroller. 8. Microcontroller

Hong Kong Institute of Vocational Education Digital Electronics & Microcontroller. 8. Microcontroller 8. Microcontroller Textbook Programming Robot Controllers, Myke Predko, McGraw Hill. Reference PIC Robotics: A Beginner's Guide to Robotics Projects Using the PIC Micro, John Iovine, McGraw Hill. Embedded

More information

Using a Temperature Sensor

Using a Temperature Sensor Using a Temperature Sensor Add a temperature sensor to the ATmega Board. Site: icode Course: Machine Science Guides (Arduino Version) Book: Using a Temperature Sensor Printed by: Ivan Rudnicki Date: Wednesday,

More information

Section 10. Watchdog Timer and Power Saving Modes

Section 10. Watchdog Timer and Power Saving Modes Section 10. Watchdog Timer and Power Saving Modes HIGHLIGHTS This section of the manual contains the following topics: 10.1 Introduction... 10-2 10.2 Power Saving Modes... 10-2 10.3 Sleep Mode...10-2 10.4

More information

11010 SBC 16-bit Architecture, C30 & Standard Peripherals Hand Out

11010 SBC 16-bit Architecture, C30 & Standard Peripherals Hand Out 11010 SBC 16-bit Architecture, C30 & Standard Peripherals Hand Out 2005 Microchip Technology Incorporated. All Rights Reserved Page 1 MPLAB Navigation Quick ways to find functions or variables in MPLAB

More information

C:\Users\cunningh\StaysOnPC\ME430 Downloads & Projects\exam2_problem1\problem1Cunningham.c

C:\Users\cunningh\StaysOnPC\ME430 Downloads & Projects\exam2_problem1\problem1Cunningham.c C:\Users\cunningh\StaysOnPC\ME430 Downloads & Projects\exam2_problem1\problem1Cunningham.c / FileName: problem1cunningham.c Processor: PIC18F4520 Compiler: MPLAB C18 v.3.06 This file does the following...

More information

Development Hardware. Target Board and In-circuit Debugger

Development Hardware. Target Board and In-circuit Debugger Development Hardware Target Board and In-circuit Debugger Development Hardware :: Slide 1 of 32 Microchip PICDEM 2 Plus Target Board Development Hardware :: Slide 2 of 32 PICDEM 2 Plus Demo Board Development

More information

Chapter 11: Interrupt On Change

Chapter 11: Interrupt On Change Chapter 11: Interrupt On Change The last two chapters included examples that used the external interrupt on Port C, pin 1 to determine when a button had been pressed. This approach works very well on most

More information

Lecture (03) PIC16F84 (2)

Lecture (03) PIC16F84 (2) Lecture (03) PIC16F84 (2) By: Dr. Ahmed ElShafee ١ PIC16F84 has a RISC architecture, or Harvard architecture in another word ٢ PIC16F84 belongs to a class of 8 bit microcontrollers of RISC architecture.

More information

University of Texas at El Paso Electrical and Computer Engineering Department. EE 3176 Laboratory for Microprocessors I.

University of Texas at El Paso Electrical and Computer Engineering Department. EE 3176 Laboratory for Microprocessors I. University of Texas at El Paso Electrical and Computer Engineering Department EE 3176 Laboratory for Microprocessors I Fall 2016 LAB 04 Timer Interrupts Goals: Learn about Timer Interrupts. Learn how to

More information

Embedded System Design

Embedded System Design ĐẠI HỌC QUỐC GIA TP.HỒ CHÍ MINH TRƯỜNG ĐẠI HỌC BÁCH KHOA KHOA ĐIỆN-ĐIỆN TỬ BỘ MÔN KỸ THUẬT ĐIỆN TỬ Embedded System Design : Microcontroller 1. Introduction to PIC microcontroller 2. PIC16F84 3. PIC16F877

More information

// sets the position of cursor in row and column

// sets the position of cursor in row and column CODE: 1] // YES_LCD_SKETCH_10_14_12 #include //lcd(rs, E, D4, D5, D6, D7) LiquidCrystal lcd(8, 9, 4, 5, 6, 7); int numrows = 2; int numcols = 16; void setup() Serial.begin(9600); lcd.begin(numrows,

More information

Team 8: Robert Blake Craig Goliber Alanna Ocampo

Team 8: Robert Blake Craig Goliber Alanna Ocampo Team 8: Robert Blake Craig Goliber Alanna Ocampo Objective of the design CAD Presentation Microcontroller Implementation PCB Design Design Limitations Conclusion Problem: Design a centrifuge which was

More information

Introducing: New Low-Cost & Low Pin Count PIC Microcontrollers for the 8-, 16- & 32-bit Markets

Introducing: New Low-Cost & Low Pin Count PIC Microcontrollers for the 8-, 16- & 32-bit Markets Introducing: New Low-Cost & Low Pin Count PIC Microcontrollers for the 8-, 16- & 32-bit Markets PIC MCU and dspic DSC Family Portfolio 2 New Low Cost, Low Pin-Count 8-, 16-, 32-bit Offerings 3 What Are

More information

Lecture (04) PIC 16F84A programming I

Lecture (04) PIC 16F84A programming I Lecture (04) PIC 16F84A programming I Dr. Ahmed M. ElShafee ١ Agenda Introduction to PIC16F84A programming using C language Preprocessors and, Compiler directives Constants Variables and data types Pointers

More information

University of Jordan Faculty of Engineering and Technology Department of Computer Engineering Embedded Systems Laboratory

University of Jordan Faculty of Engineering and Technology Department of Computer Engineering Embedded Systems Laboratory University of Jordan Faculty of Engineering and Technology Department of Computer Engineering Embedded Systems Laboratory 0907334 6 Experiment 6:Timers Objectives To become familiar with hardware timing

More information

UNCA CSCI 255 Exam 3 Fall 2011

UNCA CSCI 255 Exam 3 Fall 2011 UNCA CSCI 255 Exam 3 Fall 2011 This is a closed book and closed notes exam. Laptops, cell phones, and any other electronic storage or communication devices may not be used during this exam. Name: KEY If

More information

Accurate Time and Interrupts

Accurate Time and Interrupts Accurate Time and Interrupts Matthew Beckler beck0778@umn.edu EE2361 Lab Section 007 March 7, 2006 Abstract In this lab, we create a very accurate digital clock using one of the microcontroller s timers.

More information

An Introduction to Designing Ham Radio Projects with PIC Microcontrollers. George Zafiropoulos KJ6VU

An Introduction to Designing Ham Radio Projects with PIC Microcontrollers. George Zafiropoulos KJ6VU An Introduction to Designing Ham Radio Projects with PIC Microcontrollers George Zafiropoulos KJ6VU Topics Ham radio applications Microcontroller basics Hardware design examples Implementing your design

More information

Microprocessors B Lab 1 Spring The PIC24HJ32GP202

Microprocessors B Lab 1 Spring The PIC24HJ32GP202 The PIC24HJ32GP202 Lab Report Objectives Materials See separate report form located on the course webpage. This form should be completed during the performance of this lab. 1) To familiarize the student

More information

Table of Contents COMPANY PROFILE 1-1 SECTION 1. INTRODUCTION 1-1

Table of Contents COMPANY PROFILE 1-1 SECTION 1. INTRODUCTION 1-1 COMPANY PROFILE 1-1 SECTION 1. INTRODUCTION 1-1 Introduction... 1-2 Manual Objective... 1-3 Device Structure... 1-4 Development Support... 1-6 Device Varieties... 1-7 Style and Symbol Conventions... 1-12

More information

Experiment 9: Using HI-TECH C Compiler in MPLAB

Experiment 9: Using HI-TECH C Compiler in MPLAB University of Jordan Faculty of Engineering and Technology Department of Computer Engineering Embedded Systems Laboratory 0907334 9 Experiment 9: Using HI-TECH C Compiler in MPLAB Objectives The main objectives

More information

LCD. Configuration and Programming

LCD. Configuration and Programming LCD Configuration and Programming Interfacing and Programming with Input/Output Device: LCD LCD (liquid crystal display) is specifically manufactured to be used with microcontrollers, which means that

More information

The modules in this lab room are 4 line by 16 character display modules. The data sheet/users manual for the module is posted on My.Seneca.

The modules in this lab room are 4 line by 16 character display modules. The data sheet/users manual for the module is posted on My.Seneca. LCD Modules A common output display device used with low cost embedded systems is a character LCD display. The displays are available as complete modules with a standard microprocessor parallel interface.

More information

PIC32MX150F128 Breakout Board

PIC32MX150F128 Breakout Board PIC32MX150F128 Breakout Board This is a description of a 32 Bit PIC32MX breakout board to be used for fast prototyping. It could also be used for conventional circuit boards to avoid the fine pitch of

More information

Programmable Device Interface PDI-1 A Versatile Hardware Controller with USB interface

Programmable Device Interface PDI-1 A Versatile Hardware Controller with USB interface Programmable Device Interface PDI-1 A Versatile Hardware Controller with USB interface Features and Specifications Arduino compatible for simple USB Programming 126 x 64 Graphic LCD 12x Digital IO ports*

More information

Pic24f Family Reference Manual Section 14. Timers

Pic24f Family Reference Manual Section 14. Timers Pic24f Family Reference Manual Section 14. Timers Get Started Here 8-bit Peripheral Summary, Timers. Timers, Timer 0 (TMR0). Timer 0 For more information about the oscillator failure trap, refer to "Section

More information

Timer1 Capture Mode:

Timer1 Capture Mode: Timer1 Capture Mode: Interrupt Description Input Conditions Enable Flag Timer 1 Trigger after N events N = 1.. 2 19 100ns to 0.52 sec RC0 TMR1CS = 1 TMR1IF Timer 1 Capture Mode 1 Timer 1 Capture Mode 2

More information

ET-PIC 24 WEB-V1. o Central Processing Unit (CPU) o System. o nanowatt Power Managed Modes. o Analog Features

ET-PIC 24 WEB-V1. o Central Processing Unit (CPU) o System. o nanowatt Power Managed Modes. o Analog Features ET-PIC 24 WEB-V1 ET-PIC 24 WEB-V1 is PIC Board Microcontroller from Microchip that uses 16 Bit No.PIC24FJ128GA008 Microcontroller for processing data and develops board. The remarkable specification of

More information

The University of Texas at Arlington Lecture 5

The University of Texas at Arlington Lecture 5 The University of Texas at Arlington Lecture 5 CSE 3442/5442 LCD Discussed in Chapter 12 RS, R/W, E Signals Are Used to Send/Receive Data on D0-D7 2 PIC PROGRAMMING IN C CHAPTER 7 Chapter 7 discusses the

More information

Microcontroller Basics

Microcontroller Basics Microcontroller Basics Gabe Cohn CSE 599U February 6, 2012 www.gabeacohn.com/teaching/micro Outline Overview of Embedded Systems What is a Microcontroller? Microcontroller Features Common Microcontrollers

More information

MPLAB XC16 USER S GUIDE FOR EMBEDDED ENGINEERS. MPLAB XC16 User s Guide for Embedded Engineers INTRODUCTION

MPLAB XC16 USER S GUIDE FOR EMBEDDED ENGINEERS. MPLAB XC16 User s Guide for Embedded Engineers INTRODUCTION MPLAB XC16 USER S GUIDE FOR EMBEDDED ENGINEERS MPLAB XC16 User s Guide for Embedded Engineers INTRODUCTION This document presents five code examples for 16-bit devices and the MPLAB XC16 C compiler. Some

More information

Figure 1.1: Some embedded device. In this course we shall learn microcontroller and FPGA based embedded system.

Figure 1.1: Some embedded device. In this course we shall learn microcontroller and FPGA based embedded system. Course Code: EEE 4846 International Islamic University Chittagong (IIUC) Department of Electrical and Electronic Engineering (EEE) Course Title: Embedded System Sessional Exp. 1: Familiarization with necessary

More information

MICROPROCESSORS B (17.384) Spring Lecture Outline

MICROPROCESSORS B (17.384) Spring Lecture Outline MICROPROCESSORS B (17.384) Spring 2012 Lecture Outline Class # 01 January 24, 2012 Dohn Bowden 1 Today s Lecture Administrative General Course Overview Microcontroller Hardware and/or Interface Programming/Software

More information

The University of Texas at Arlington Lecture 21_Review

The University of Texas at Arlington Lecture 21_Review The University of Texas at Arlington Lecture 21_Review CSE 5442/3442 Agenda Tuesday December 1st Hand back Homework 7,8 and 9. Go over questions and answers Exam 3 Review Note: There will be a take home

More information

SANKALCHAND PATEL COLLEGE OF ENGINEERING, VISNAGAR. ELECTRONICS & COMMUNICATION DEPARTMENT Question Bank- 1

SANKALCHAND PATEL COLLEGE OF ENGINEERING, VISNAGAR. ELECTRONICS & COMMUNICATION DEPARTMENT Question Bank- 1 SANKALCHAND PATEL COLLEGE OF ENGINEERING, VISNAGAR ELECTRONICS & COMMUNICATION DEPARTMENT Question Bank- 1 Subject: Microcontroller and Interfacing (151001) Class: B.E.Sem V (EC-I & II) Q-1 Explain RISC

More information

Interrupts on PIC18F252 Part 2

Interrupts on PIC18F252 Part 2 Interrupts on PIC18F252 Part 2 Following pages list Special Function Registers (SFRs) involved in interrupt configuration and operation on PIC18F252 microcontroller. (Copied from Microchip s PIC18Fxx2

More information

More Fun with Timer Interrupts

More Fun with Timer Interrupts More Fun with Timer Interrupts Chords Objective: Play a musical chord each time you press a button: Button RC0 RC1 RC2 Timer Timer0 Timer1 Timer3 RB0 A3 C4 E4 RB1 B3 D4 F4 RB2 C4 E4 G4 Calculations: Assume

More information

EE 361L Digital Systems and Computer Design Laboratory

EE 361L Digital Systems and Computer Design Laboratory EE 361L Digital Systems and Computer Design Laboratory University of Hawaii Department of Electrical Engineering by Galen Sasaki and Ashok Balusubramaniam Quick Overview of PIC16F8X Version 1.0 Date: 9/4/01

More information

The following article introduces and shows an example of how to set up and use the watchdog timer on the M16C/26 microcontroller (MCU).

The following article introduces and shows an example of how to set up and use the watchdog timer on the M16C/26 microcontroller (MCU). APPLICATION NOTE M16C/26 1.0 Abstract The following article introduces and shows an example of how to set up and use the watchdog timer on the M16C/26 microcontroller (MCU). 2.0 Introduction The Renesas

More information

MICROCONTROLLER BASED SMART FAN SYSTEM

MICROCONTROLLER BASED SMART FAN SYSTEM MUHAMMAD KHAIRI BACHELOR OF ELECTRICAL ENGINEERING (HONS.) (ELECTRONICS) 2007 UMP MICROCONTROLLER BASED SMART FAN SYSTEM MUHAMMAD KHAIRI BIN ABD. GHANI UNIVERSITI MALAYSIA PAHANG v ABSTRACT This project

More information

Arduino Uno R3 INTRODUCTION

Arduino Uno R3 INTRODUCTION Arduino Uno R3 INTRODUCTION Arduino is used for building different types of electronic circuits easily using of both a physical programmable circuit board usually microcontroller and piece of code running

More information

Microcontroller & Interfacing

Microcontroller & Interfacing Course Title Course Code Microcontroller & Interfacing EC406 Lecture : 3 Course Credit Practical : 1 Tutorial : 0 Total : 4 Course Objective At the end of the course the students will be able to Understand

More information

dspic Elmer 166 An introduction to using the dspic John J. McDonough, WB8RCR

dspic Elmer 166 An introduction to using the dspic John J. McDonough, WB8RCR dspic Elmer 166 An introduction to using the dspic John J. McDonough, WB8RCR Elmer 166 dspic Elmer 166 An introduction to using the dspic Edition 1 Author John J. McDonough, WB8RCR wb8rcr@arrl.net The

More information

PIC Microcontroller Introduction

PIC Microcontroller Introduction PIC Microcontroller Introduction The real name of this microcontroller is PICmicro (Peripheral Interface Controller), but it is better known as PIC. Its first ancestor was designed in 1975 by General Instruments.

More information

C and Embedded Systems. So Why Learn Assembly Language? C Compilation. PICC Lite C Compiler. PICC Lite C Optimization Results (Lab #13)

C and Embedded Systems. So Why Learn Assembly Language? C Compilation. PICC Lite C Compiler. PICC Lite C Optimization Results (Lab #13) C and Embedded Systems A µp-based system used in a device (i.e, a car engine) performing control and monitoring functions is referred to as an embedded system. The embedded system is invisible to the user

More information

Appendix A: Rack Specification Sheet

Appendix A: Rack Specification Sheet Appendices Appendix A: Rack Specification Sheet A-1 Appendix B: Pinion Specification Sheet B-1 Appendix C: Specification Sheets for Motors One and Two Motor One Specification Sheet C-1 C-2 Motor Two Specification

More information

Introduction to the MC9S12 Hardware Subsystems

Introduction to the MC9S12 Hardware Subsystems Setting and clearing bits in C Using pointers in C o Program to count the number of negative numbers in an area of memory Introduction to the MC9S12 Hardware Subsystems o The MC9S12 timer subsystem Operators

More information

UBC104 Embedded Systems. Review: Introduction to Microcontrollers

UBC104 Embedded Systems. Review: Introduction to Microcontrollers UBC104 Embedded Systems Review: Introduction to Microcontrollers Processors General purpose processors: 80386 Pentium Core Duo Large number of pins External memory External peripherals * Figure from Intel

More information

2.996/6.971 Biomedical Devices Design Laboratory Lecture 6: Microprocessors II

2.996/6.971 Biomedical Devices Design Laboratory Lecture 6: Microprocessors II 2.996/6.971 Biomedical Devices Design Laboratory Lecture 6: Microprocessors II Instructor: Dr. Hong Ma Oct. 1, 2007 Structure of MSP430 Program 1. Declarations 2. main() 1. Watch-dog timer servicing 2.

More information

8051 Peripherals. On-Chip Memory Timers Serial Port Interrupts. Computer Engineering Timers

8051 Peripherals. On-Chip Memory Timers Serial Port Interrupts. Computer Engineering Timers 8051 Peripherals On-Chip Memory Timers Serial Port Interrupts Computer Engineering 2 2-1 8051 Timers 8051 Timers The 8051 has 2 internal 16-bit timers named Timer 0 and Timer 1 Each timer is a 16-bit counter

More information

Embedded Systems Lab Lab 1 Introduction to Microcontrollers Eng. Dalia A. Awad

Embedded Systems Lab Lab 1 Introduction to Microcontrollers Eng. Dalia A. Awad Embedded Systems Lab Lab 1 Introduction to Microcontrollers Eng. Dalia A. Awad Objectives To be familiar with microcontrollers, PIC18F4550 microcontroller. Tools PIC18F4550 Microcontroller, MPLAB software,

More information

acret Ameya Centre for Robotics & Embedded Technology Syllabus for Diploma in Embedded Systems (Total Eight Modules-4 Months -320 Hrs.

acret Ameya Centre for Robotics & Embedded Technology Syllabus for Diploma in Embedded Systems (Total Eight Modules-4 Months -320 Hrs. acret Ameya Centre for Robotics & Embedded Technology Syllabus for Diploma in Embedded Systems (Total Eight Modules-4 Months -320 Hrs.) Module 0 Introduction Introduction to Embedded Systems, Real Time

More information

CHAPTER 1 - World of microcontrollers

CHAPTER 1 - World of microcontrollers CHAPTER 1 - World of microcontrollers One Time Programmable ROM (OTP ROM) One time programmable ROM enables you to download a program into it, but, as its name states, one time only. If an error is detected

More information

ECE383: Microcomputers Lab 6 Basic and Finite State Machine LED and Switch I/O Programming

ECE383: Microcomputers Lab 6 Basic and Finite State Machine LED and Switch I/O Programming ECE383: Microcomputers Lab 6 Basic and Finite State Machine LED and Switch I/O Programming Goals: The goals of this lab are to continue to instruct students in a PIC24-based hardware system using PIO ports

More information

ME 515 Mechatronics. A microprocessor

ME 515 Mechatronics. A microprocessor ME 515 Mechatronics Microcontroller Based Control of Mechanical Systems Asanga Ratnaweera Department of Faculty of Engineering University of Peradeniya Tel: 081239 (3627) Email: asangar@pdn.ac.lk A microprocessor

More information

Basic Embedded Software C Review Using MPLAB SIM. Loops. Embedded Systems Interfacing. 25 August 2011

Basic Embedded Software C Review Using MPLAB SIM. Loops. Embedded Systems Interfacing. 25 August 2011 25 August 2011 Basic Embedded Software Structure No Operating System to Return to Could Let Program Execute and Reset, But That s Not Efficient Main Function Initialization Code Endless Loop The while

More information

Microcontroller Overview

Microcontroller Overview Microcontroller Overview Microprocessors/Microcontrollers/DSP Microcontroller components Bus Memory CPU Peripherals Programming Microcontrollers vs. µproc. and DSP Microprocessors High-speed information

More information

Section 1. Introduction

Section 1. Introduction 1 Section 1. Introduction Introduction HIGHLIGHTS This section of the manual contains the following topics: 1.1 Introduction... 1-2 1.2 Device Structure...1-3 1.3 Development Support... 1-4 1.4 Style and

More information

CN310 Microprocessor Systems Design

CN310 Microprocessor Systems Design CN310 Microprocessor Systems Design Microcontroller Nawin Somyat Department of Electrical and Computer Engineering Thammasat University Outline Course Contents 1 Introduction 2 Simple Computer 3 Microprocessor

More information

CHAPTER 6 CONCLUSION AND SCOPE FOR FUTURE WORK

CHAPTER 6 CONCLUSION AND SCOPE FOR FUTURE WORK 134 CHAPTER 6 CONCLUSION AND SCOPE FOR FUTURE WORK 6.1 CONCLUSION Many industrial processes such as assembly lines have to operate at different speeds for different products. Process control may demand

More information

#include "p30f3011.h" #include "svm3011 v1.2.h"

#include p30f3011.h #include svm3011 v1.2.h //--------------------------------------------------------------------- // File: sinusoidal BLDC v1.2.c // // Written By: Jorge Zambada, Microchip Technology // // The following files should be included

More information

Microcontrollers for Ham Radio

Microcontrollers for Ham Radio Microcontrollers for Ham Radio MARTIN BUEHRING - KB4MG MAT T PESCH KK4NLK TOM PERRY KN4LSE What is a Microcontroller? A micro-controller is a small computer on a single integrated circuit containing a

More information

Department of Electronics and Instrumentation Engineering Question Bank

Department of Electronics and Instrumentation Engineering Question Bank www.examquestionpaper.in Department of Electronics and Instrumentation Engineering Question Bank SUBJECT CODE / NAME: ET7102 / MICROCONTROLLER BASED SYSTEM DESIGN BRANCH : M.E. (C&I) YEAR / SEM : I / I

More information

ECE 3740 SEP1: MPLAB Introduction and LED Blinking. An Introduction to Microchip's MPLAB IDE and

ECE 3740 SEP1: MPLAB Introduction and LED Blinking. An Introduction to Microchip's MPLAB IDE and ECE 3740 SEP1: MPLAB Introduction and LED Blinking An Introduction to Microchip's MPLAB IDE and an Example Application: LED Blinking 1 Objective Rotate LEDs 2 Port Functions Library Help >Help Contents

More information

UNIVERSITY OF BOLTON SCHOOL OF ENGINEERING. BEng(Hons) Electrical and Electronics Engineering SEMESTER 1 EXAMINATION 2016/2017

UNIVERSITY OF BOLTON SCHOOL OF ENGINEERING. BEng(Hons) Electrical and Electronics Engineering SEMESTER 1 EXAMINATION 2016/2017 TW34 UNIVERSITY OF BOLTON SCHOOL OF ENGINEERING BEng(Hons) Electrical and Electronics Engineering SEMESTER 1 EXAMINATION 2016/2017 INTERMEDIATE EMBEDDED SYSTEMS MODULE NO: EEE5004 Date: Thursday 12 January

More information

Hardware Interfacing. EE25M Introduction to microprocessors. Part V. 15 Interfacing methods. original author: Feisal Mohammed

Hardware Interfacing. EE25M Introduction to microprocessors. Part V. 15 Interfacing methods. original author: Feisal Mohammed EE25M Introduction to microprocessors original author: Feisal Mohammed updated: 18th February 2002 CLR Part V Hardware Interfacing There are several features of computers/microcontrollers which have not

More information

Microcomputers. Polled IO versus Interrupt Driven IO

Microcomputers. Polled IO versus Interrupt Driven IO Microcomputers PIC24 Interrupts Lecture 6-1 Polled IO versus Interrupt Driven IO Polled Input/Output (IO) processor continually checks IO device to see if it is ready for data transfer Inefficient, processor

More information

Embedded programming, AVR intro

Embedded programming, AVR intro Applied mechatronics, Lab project Embedded programming, AVR intro Sven Gestegård Robertz Department of Computer Science, Lund University 2017 Outline 1 Low-level programming Bitwise operators Masking and

More information