Lab Report for Sensor Calibration using a PIC16F84 GROUP MEMBERS ALFRED MAZHINDU SIMBARASHE CHIWESHE

Size: px
Start display at page:

Download "Lab Report for Sensor Calibration using a PIC16F84 GROUP MEMBERS ALFRED MAZHINDU SIMBARASHE CHIWESHE"

Transcription

1 CY-0205M Sensor and Actuators Lab Report for Sensor Calibration using a PIC16F84 GROUP MEMBERS ALFRED MAZHINDU SIMBARASHE CHIWESHE Alfred Mazhindu & Simbarashe Chiweshe Page 1

2 CONTENTS Table of Figures and Tables... 2 INTRODUCTION... 3 The Temperature Sensor... 3 Comments on test5.c... 3 Exercise 1: Measuring and displaying temperature... 3 C Code for Continuous Temperature Display in Centigrade and Fahrenheit... 3 Comments on Ex Exercise 2: Display a periodically changing pattern of lights... 5 C Code for timing the successive-approximation ADC... 5 Comments on Ex Exercise 3: Asses the LDR light measurement system... 6 C Code for Exercise Responses for Ex Exercise 4: Measuring the ambient light Ex5: Adding an out-of-range indicator C Code for Exercise Ideas for improving the the accuracy of the system CONCLUSION REFERENCE Table of Figures and Tables Figure 1: The temperature sensor circuit for measuring positive temperatures Table 1: Table of results of exercise Alfred Mazhindu & Simbarashe Chiweshe Page 2

3 INTRODUCTION The Laboratory session builds from the previous laboratory sessions. It focused on a linear and non linear sensor. It also involved writing a C program for output the temperature in Centigrade or Fahrenheit depending on the switch. The look up table approach is used for calibrating the sensor. The Temperature Sensor The sensor is a linear sensor which covers a range 40 C to +110 C. Vs 5 V (Red) LM35 V out to ADC (Orange) GND 0 V (Brown) Figure 1: The temperature sensor circuit for measuring positive temperatures. Comments on test5.c The temperature reading would increase when it was held in the human hand. The lowest reading that could be seen on the seven-segment display was a decimal 1 and the largest value was 255. Without the sensor connected when the voltage knob was adjusted the digital output would also change accordingly. Exercise 1: Measuring and displaying temperature The code below is a modification of test5.c, it continuously show the temperature reading on the seven segment display and outputs the temperature in Centigrade or Fahrenheit s depending whether the switch is pressed or not. C Code for Continuous Temperature Display in Centigrade and Fahrenheit Sensors and Actuators lab3 Data acquisition from an optical sensor Please type your name and your partner's name below Simbarashe Chiweshe & Alfred Mazhindu const char pattern[] = /* */ 0xc0, 0xf9, 0xa4, 0xb0, 0x99, 0x92, 0x82, 0xf8, /* 8 9 A b C d E F */ 0x80, 0x98, 0x88, 0x83, 0xc6, 0xa1, 0x86, 0x8e ; Alfred Mazhindu & Simbarashe Chiweshe Page 3

4 unsigned char segments[4] ; /* storage for values to display in led segments */ void delay(unsigned int) ; void DecNumber(unsigned char) ; void refresh_segments (unsigned char) ; unsigned char adc(void) ; void main( void) unsigned char i, j ; set_bit (STATUS, RP0) ; TRISB = 0x00 ; /* all o/p */ TRISA = 10001b ; clear_bit (STATUS, RP0) ; while(1) endless loop i = adc() ; if(porta&16==16); i = 32+(9*i)/5; for (j = 0 ; j < 30 ; j++) DecNumber (i) ; refresh_segments (i) ; end of main void delay(unsigned int n) unsigned int i ; for (i = 0 ; i < n ; i++) ; void DecNumber(unsigned char value) unsigned int temp ; put values to display in array segment segments[2] = value / 100 ; temp = value % 100 ; segments[1] = temp / 10 ; segments[0] = temp % 10 ; void refresh_segments (unsigned char i) PORTA = 0 ; if (i < 100) goto miss1 ; PORTB = pattern[segments[2]] ; PORTA = 2 ; delay(100) ; PORTA = 0 ; miss1: if (i < 10) goto miss2 ; Alfred Mazhindu & Simbarashe Chiweshe Page 4

5 PORTB = pattern[segments[1]] ; PORTA = 4 ; delay(100) ; PORTA = 0 ; miss2: PORTB = pattern[segments[0]] ; PORTA = 8 ; delay(100) ; PORTA = 0 ; end of refresh_segments unsigned char adc(void) successive approximation adc unsigned char i, bitn0, bitn1, value=0; /* local variables */ bitn1 = b ; set bit mask bitn0 = ~bitn1 ; clear bit mask value = 0 ; for (i = 1 ; i <= 8 ; i++) value = (value bitn1) ; PORTB = value ; nop () ; nop () ; delay necessary for reliable adc operation if (PORTA & 1 == 0) value=(value & bitn0) ; Input voltage exceeded so clear bit bitn1 = (bitn1 >> 1); right shift set bit bitn0 = ~bitn1; clear bit gets right shifted return value; end of adc subroutine Comments on Ex 1 The maximum temperature reached with the human thumb on in Centigrade was 30 The maximum temperature reached with the human thumb on in Fahrenheit was 86 The ambient temperature was about 22 in Centigrade and in Fahrenheit was 72 Exercise 2: Display a periodically changing pattern of lights The code below is the modified code of test6.c but it displays a periodical changing pattern of our choice. The program was tested and proved to be working and it was also approved by a demonstrator. C Code for timing the successive-approximation ADC Sensors and Actuators lab3 Data acquisition from an optical sensor Please type your name and your partner's name below Simbarashe Chiweshe & Alfred Mazhindu void delay (void) int n; for (n=0;n< 0x3000;n++) ; Alfred Mazhindu & Simbarashe Chiweshe Page 5

6 char lut(char n) Declaring a look-up-table like this stores the data in code memory If the array is not declared const it is stored in RAM and there is not enough! const char a[] = 1,8,4,2,128,32,64,16 ; return a[n] ; void main( void) char i, z ; set_bit (STATUS, RP0) ; TRISB = 0 ; /* Port B all o/p */ TRISA = 255 ; /* Port A all i/p */ clear_bit (STATUS, RP0) ; while(1) endless loop for (i = 0 ; i < 8 ; i++) PORTB = lut(i) ; delay() ; end of main Comments on Ex 2 It is observed that the sequence of the light changed according to the patter one would have put. Only powers of two are recognised to make a readable pattern. Exercise 3: Asses the LDR light measurement system Exercise 3 required modification of test7.c so that it only operated when the switch SA4 was pressed. C Code for Exercise 3 This program uses LCD functions from the Matrix Multimedia C for PICmicros tutorial Sensors and Actuators lab3 Data acquisition from an optical sensor Simbarashe Chiweshe & Alfred Mazhindu void lcd_delay (int) ; Alfred Mazhindu & Simbarashe Chiweshe Page 6

7 char lcd_start ( void ) ; char lcd_clear ( void ) ; char lcd_print_ch ( char ) ; char lcd_cursor ( char, char ) ; void lcd_command ( unsigned char ) ; /* You will have to change these bits */ /* if the hardware changes */ /* You will also need to change: */ /* setup_lcd and lcd_raw_send */ /* masks for control bits */ #define RSMASK 0x10 #define EBIT 0x05 /* defined values for delays */ /* tested up to 20Mhz PIC */ /* standard write delay */ #define PUTCH_DELAY 250 /* clear and cursor home take longer */ /* special delay for them */ #define CLEAR_DELAY 5000 /* power up delay to let the LCD settle */ #define POWER_UP_DELAY /* bit delay to let the ports settle */ #define BIT_DELAY 4 const unsigned char lcd_init [5] = /* LCD initialise */ 0x33, /* Set for 4 bit operation */ 0x32, /* Set for 2 line LCD */ 0x2c, /* Select move after write */ 0x06, /* disp. on cursor off blink off */ 0x0c ; /* function prototypes */ char adc (void) ; void DecNumber(int) ; void refresh_segments (int) ; char FindX (int) ; void LinInterp (void) ; int x1, x2, x ; ****** globals to transfer data *********** int y1, y2, y ; ****** between main and LinInterp ********* char segments[4] ; /* storage for decimal digits to display*/ Alfred Mazhindu & Simbarashe Chiweshe Page 7

8 char subx (char n) Look-up-table values of ADC output const char a[] = 5,7,10,15,20,25,30,35,40,45,50,60,70, 80,90,100,125,150,175,200,250,256 ; return a[n] ; int suby (char n) Look-up-table values of illumination corresponging to ADC values in subx char i ; const char b[] = 9, 80, , 160, , 76, , 200, , 38, , 208, 25 0, 156, 30 0, 122, 35 0, 99, 40 0, 82, 45 0, 69, 50 0, 51, 60 0, 39, 70 0, 31, 80 0, 25, 90 0, 21, 100 0, 14, 125 0, 9, 150 0, 7, 175 0, 5, 200 0, 3, 250 0, 2 ; 256 i = 2*n ; return b[i]*256+b[i+1] ; void main( void) unsigned char i, j ; set_bit (STATUS, RP0) ; TRISB = 0x00 ; /* all o/p */ TRISA = 11111b ; clear_bit (STATUS, RP0) ; while(1) if(porta &16==16) i = adc() ; x = i ; convert LDR voltage to number lcd_start () ; initialise the LCD display, ADC operation may have sent spurious signal to LCD Alfred Mazhindu & Simbarashe Chiweshe Page 8

9 j = FindX (x) ; find which segment in the look-up-tables the voltage is in x2 = subx (j) ; y2 = suby (j) ; get x1, x2 and y1, y2 which j-- ; bracket i for interpolation x1 = subx (j) ; y1 = suby (j) ; to find the corresponding lux LinInterp ( ) ; interpolate to find y for given x input x and output y are global variables display ADC output (mv) DecNumber (x) ; split the number into decimal digits stored in array segments[] lcd_cursor ( 5, 0 ) ; lcd_print_ch (segments[1]) ; lcd_print_ch (segments[2]) ; lcd_print_ch (segments[3]) ; lcd_print_ch (segments[0]) ; lcd_print_ch ( ' ' ) ; lcd_print_ch ( 'm' ) ; lcd_print_ch ( 'V' ) ; DecNumber (y) ; display illumination (lux) lcd_cursor ( 5, 1 ) ; lcd_print_ch (segments[0]) ; lcd_print_ch (segments[1]) ; lcd_print_ch (segments[2]) ; lcd_print_ch (segments[3]) ; lcd_print_ch ( ' ' ) ; lcd_print_ch ( 'L' ) ; lcd_print_ch ( 'u' ) ; lcd_print_ch ( 'x' ) ; lcd_delay(10000) ; end of main char FindX (int j) returns upper index of x segment that j belongs to char i,k ; for (i = 1 ; i <= 21 ; i++) k = subx (i) ; if (j <= k) break ; if ( i == 22) i = 21 ; return i ; void LinInterp (void) unsigned int x2t, y2t ; unsigned char xt ; xt = x2 - x ; x2t = x2 - x1 ; y2t = y1 - y2 ; y = y2+y2t*xt/x2t ; Alfred Mazhindu & Simbarashe Chiweshe Page 9

10 void DecNumber(int value) unsigned int temp1, temp2 ; put values to display in array segment segments[0] = value / ; temp1 = value % 1000 ; segments[1] = temp1 / ; temp2 = temp1 % 100 ; segments[2] = temp2 / ; segments[3] = temp2 % ; unsigned char adc(void) successive approximation adc unsigned char bitn0, bitn1, value=0; /* local variables */ char i ; bitn1 = b ; set bit mask bitn0 = ~bitn1 ; clear bit mask value = 0 ; for (i = 1 ; i <= 8 ; i++) value = (value bitn1) ; PORTB = value ; nop () ; nop () ; delay necessary for reliable adc operation if (PORTA & 1 == 0) value=(value & bitn0) ; V exceeded so clear bit bitn1 = (bitn1 >> 1); right shift set bit bitn0 = ~bitn1; clear bit gets right shifted return value; end of adc subroutine void lcd_delay ( unsigned int size ) unsigned int i ; for ( i = 0 ; i < size ; i++ ) ; /* sends a byte out to the LCD */ /* the byte is given by in, the */ /* mask is used to allow the */ /* state of RS to be set as well */ void lcd_raw_send ( unsigned char in, unsigned char mask ) unsigned char pb ; /* use a PIC assembler */ /* to swap the nibbles in the */ /* input */ Alfred Mazhindu & Simbarashe Chiweshe Page 10

11 /* puts high nibble at the */ /* bottom of the byte */ asm swapf param00_lcd_raw_send,f /* OR in the mask */ pb = (in & 0x0f ) mask ; /* OR in the other bits */ /* PORTB */ pb = pb (PORTB & 0xc0) ; /* send the data */ /* send the data */ /* don't disturb the other */ /* bits in PORTB */ PORTB = pb ; /* let the bits settle */ lcd_delay ( BIT_DELAY ) ; /* now clock the bit out */ /* by raising and lowering E */ set_bit ( PORTB, EBIT ) ; /* let the bits settle */ lcd_delay ( BIT_DELAY ) ; clear_bit ( PORTB, EBIT ) ; /* put the low nibble back */ /* into in */ asm swapf param00_lcd_raw_send,f /* OR in the mask */ pb = (in & 0x0f ) mask ; /* OR in the other bits */ /* PORTB */ pb = pb (PORTB & 0xc0) ; /* send the data */ /* send the data */ /* don't disturb the other */ /* bits in PORTB */ PORTB = pb ; /* let the bits settle */ lcd_delay ( BIT_DELAY ) ; /* now clock the bit out */ /* by raising and lowering E */ set_bit ( PORTB, EBIT ) ; Alfred Mazhindu & Simbarashe Chiweshe Page 11

12 /* let the bits settle */ lcd_delay ( BIT_DELAY ) ; clear_bit ( PORTB, EBIT ) ; /* do the delay here */ lcd_delay (PUTCH_DELAY) ; /* puts a character at the cursor */ /* position */ char lcd_print_ch ( unsigned char in ) /* use raw send with RS set */ lcd_raw_send ( in, RSMASK ) ; return 1 ; /* sends a command to the LCD */ void lcd_command ( unsigned char in ) lcd_raw_send ( in, 0 ) ; /* clear the display */ /* and home the cursor */ char lcd_clear ( void ) lcd_command ( 0x01 ) ; /* do extra delay here */ lcd_delay (CLEAR_DELAY) ; lcd_command ( 0x02 ) ; /* do extra delay here */ lcd_delay (CLEAR_DELAY) ; return 1 ; /* position the cursor */ char lcd_cursor ( unsigned char x, unsigned char y ) if ( y==0 ) /* position for line 0 */ y=0x80 ; else /* position for line 1 */ y=0xc0 ; lcd_command ( y+x ) ; return 1 ; char lcd_start (void) Alfred Mazhindu & Simbarashe Chiweshe Page 12

13 unsigned char i ; /* Select the Register bank 1 set_bit ( STATUS, RP0 ) ; */ */ */ */ */ /* set bits of PORTB for output /* change for different hardware /* clear bottom five bits for LCD /* don't change any other bits TRISB = (TRISB & 0xc0) ; /* Select the Register bank 0 clear_bit( STATUS, RP0 ); */ /* give the LCD time to settle /* from power up */ */ lcd_delay ( POWER_UP_DELAY ) ; for ( i=0 ; i < 5 ; i++ ) lcd_command ( lcd_init [i] ) ; lcd_clear () ; return 1 ; Responses for Ex 3 Lux(P) (Estimated value) Actual Value % Error Absolute Error Table 1: Table of results of exercise 3 Exercise 4: Measuring the ambient light Alfred Mazhindu & Simbarashe Chiweshe Page 13

14 The ambient illumination level falling on the LDR when it is facing upwards towards the ceiling is 176 lux and when it is facing downwards, 30cm above the bench its 29 lux Ex5: Adding an out-of-range indicator The accuracy of the system is very poor when the ADC output is less than 5.The code bellow is a modification that will display **** when the readings are less than 5V. C Code for Exercise 3 This program uses LCD functions from the Matrix Multimedia C for PICmicros tutorial Sensors and Actuators lab3 Data acquisition from an optical sensor Please type your name and your partner's name below Simbarashe Chiweshe & Alfred Mazhindu void lcd_delay (int) ; char lcd_start ( void ) ; char lcd_clear ( void ) ; char lcd_print_ch ( char ) ; char lcd_cursor ( char, char ) ; void lcd_command ( unsigned char ) ; /* You will have to change these bits */ /* if the hardware changes */ /* You will also need to change: */ /* setup_lcd and lcd_raw_send */ /* masks for control bits */ #define RSMASK 0x10 #define EBIT 0x05 /* defined values for delays */ /* tested up to 20Mhz PIC */ /* standard write delay */ #define PUTCH_DELAY 250 /* clear and cursor home take longer */ /* special delay for them */ #define CLEAR_DELAY 5000 /* power up delay to let the LCD settle */ #define POWER_UP_DELAY /* bit delay to let the ports settle */ #define BIT_DELAY 4 const unsigned char lcd_init [5] = /* LCD initialise */ 0x33, /* Set for 4 bit operation */ Alfred Mazhindu & Simbarashe Chiweshe Page 14

15 0x32, /* Set for 2 line LCD */ 0x2c, /* Select move after write */ 0x06, /* disp. on cursor off blink off */ 0x0c ; /* function prototypes */ char adc (void) ; void DecNumber(int) ; void refresh_segments (int) ; char FindX (int) ; void LinInterp (void) ; int x1, x2, x ; ****** globals to transfer data *********** int y1, y2, y ; ****** between main and LinInterp ********* char segments[4] ; /* storage for decimal digits to display*/ char subx (char n) Look-up-table values of ADC output const char a[] = 5,7,10,15,20,25,30,35,40,45,50,60,70, 80,90,100,125,150,175,200,250,256 ; return a[n] ; int suby (char n) Look-up-table values of illumination corresponging to ADC values in subx char i ; const char b[] = 9, 80, , 160, , 76, , 200, , 38, , 208, 25 0, 156, 30 0, 122, 35 0, 99, 40 0, 82, 45 0, 69, 50 0, 51, 60 0, 39, 70 0, 31, 80 0, 25, 90 0, 21, 100 0, 14, 125 0, 9, 150 0, 7, 175 0, 5, 200 0, 3, 250 0, 2 ; 256 i = 2*n ; return b[i]*256+b[i+1] ; Alfred Mazhindu & Simbarashe Chiweshe Page 15

16 void main( void) unsigned char i, j ; set_bit (STATUS, RP0) ; TRISB = 0x00 ; /* all o/p */ TRISA = 11111b ; clear_bit (STATUS, RP0) ; while(1) if(porta &16==16) i = adc() ; x = i ; convert LDR voltage to number operation lcd_start () ; initialise the LCD display, ADC may have sent spurious signal to LCD j = FindX (x) ; find which segment in the look-up-tables the voltage is in x2 = subx (j) ; y2 = suby (j) ; get x1, x2 and y1, y2 which j-- ; bracket i for interpolation x1 = subx (j) ; y1 = suby (j) ; to find the corresponding lux LinInterp ( ) ; interpolate to find y for given x input x and output y are global variables display ADC output (mv) DecNumber (x) ; split the number into decimal digits stored in array segments[] lcd_cursor ( 5, 0 ) ; lcd_print_ch (segments[1]) ; lcd_print_ch (segments[2]) ; lcd_print_ch (segments[3]) ; lcd_print_ch (segments[0]) ; lcd_print_ch ( ' ' ) ; lcd_print_ch ( 'm' ) ; lcd_print_ch ( 'V' ) ; DecNumber (y) ; display illumination (lux) lcd_cursor ( 5, 1 ) ; if(i < 5) lcd_print_ch ( '*' ) ; lcd_print_ch ( '*' ) ; lcd_print_ch ( '*' ) ; lcd_print_ch ( '*' ) ; Alfred Mazhindu & Simbarashe Chiweshe Page 16

17 else lcd_print_ch (segments[0]) ; lcd_print_ch (segments[1]) ; lcd_print_ch (segments[2]) ; lcd_print_ch (segments[3]) ; lcd_print_ch ( ' ' ) ; lcd_print_ch ( 'L' ) ; lcd_print_ch ( 'u' ) ; lcd_print_ch ( 'x' ) ; lcd_delay(10000) ; end of main char FindX (int j) returns upper index of x segment that j belongs to char i,k ; for (i = 1 ; i <= 21 ; i++) k = subx (i) ; if (j <= k) break ; if ( i == 22) i = 21 ; return i ; void LinInterp (void) unsigned int x2t, y2t ; unsigned char xt ; xt = x2 - x ; x2t = x2 - x1 ; y2t = y1 - y2 ; y = y2+y2t*xt/x2t ; void DecNumber(int value) unsigned int temp1, temp2 ; put values to display in array segment segments[0] = value / ; temp1 = value % 1000 ; segments[1] = temp1 / ; temp2 = temp1 % 100 ; segments[2] = temp2 / ; segments[3] = temp2 % ; unsigned char adc(void) successive approximation adc unsigned char bitn0, bitn1, value=0; /* local variables */ char i ; bitn1 = b ; set bit mask bitn0 = ~bitn1 ; clear bit mask value = 0 ; Alfred Mazhindu & Simbarashe Chiweshe Page 17

18 for (i = 1 ; i <= 8 ; i++) value = (value bitn1) ; PORTB = value ; nop () ; nop () ; delay necessary for reliable adc operation if (PORTA & 1 == 0) value=(value & bitn0) ; V exceeded so clear bit bitn1 = (bitn1 >> 1); right shift set bit bitn0 = ~bitn1; clear bit gets right shifted return value; end of adc subroutine void lcd_delay ( unsigned int size ) unsigned int i ; for ( i = 0 ; i < size ; i++ ) ; /* sends a byte out to the LCD */ /* the byte is given by in, the */ /* mask is used to allow the */ /* state of RS to be set as well */ void lcd_raw_send ( unsigned char in, unsigned char mask ) unsigned char pb ; /* use a PIC assembler */ /* to swap the nibbles in the */ /* input */ /* puts high nibble at the */ /* bottom of the byte */ asm swapf param00_lcd_raw_send,f /* OR in the mask */ pb = (in & 0x0f ) mask ; /* OR in the other bits */ /* PORTB */ pb = pb (PORTB & 0xc0) ; /* send the data */ /* send the data */ /* don't disturb the other */ /* bits in PORTB */ PORTB = pb ; /* let the bits settle */ lcd_delay ( BIT_DELAY ) ; /* now clock the bit out */ /* by raising and lowering E */ Alfred Mazhindu & Simbarashe Chiweshe Page 18

19 set_bit ( PORTB, EBIT ) ; /* let the bits settle */ lcd_delay ( BIT_DELAY ) ; clear_bit ( PORTB, EBIT ) ; /* put the low nibble back */ /* into in */ asm swapf param00_lcd_raw_send,f /* OR in the mask */ pb = (in & 0x0f ) mask ; /* OR in the other bits */ /* PORTB */ pb = pb (PORTB & 0xc0) ; /* send the data */ /* send the data */ /* don't disturb the other */ /* bits in PORTB */ PORTB = pb ; /* let the bits settle */ lcd_delay ( BIT_DELAY ) ; /* now clock the bit out */ /* by raising and lowering E */ set_bit ( PORTB, EBIT ) ; /* let the bits settle */ lcd_delay ( BIT_DELAY ) ; clear_bit ( PORTB, EBIT ) ; /* do the delay here */ lcd_delay (PUTCH_DELAY) ; /* puts a character at the cursor */ /* position */ char lcd_print_ch ( unsigned char in ) /* use raw send with RS set */ lcd_raw_send ( in, RSMASK ) ; return 1 ; /* sends a command to the LCD */ void lcd_command ( unsigned char in ) lcd_raw_send ( in, 0 ) ; Alfred Mazhindu & Simbarashe Chiweshe Page 19

20 /* clear the display */ /* and home the cursor */ char lcd_clear ( void ) lcd_command ( 0x01 ) ; /* do extra delay here */ lcd_delay (CLEAR_DELAY) ; lcd_command ( 0x02 ) ; /* do extra delay here */ lcd_delay (CLEAR_DELAY) ; return 1 ; /* position the cursor */ char lcd_cursor ( unsigned char x, unsigned char y ) if ( y==0 ) /* position for line 0 */ y=0x80 ; else /* position for line 1 */ y=0xc0 ; lcd_command ( y+x ) ; return 1 ; char lcd_start (void) unsigned char i ; /* Select the Register bank 1 */ set_bit ( STATUS, RP0 ) ; /* set bits of PORTB for output */ /* change for different hardware */ /* clear bottom five bits for LCD */ /* don't change any other bits */ TRISB = (TRISB & 0xc0) ; /* Select the Register bank 0 */ clear_bit( STATUS, RP0 ); /* give the LCD time to settle */ /* from power up */ lcd_delay ( POWER_UP_DELAY ) ; for ( i=0 ; i < 5 ; i++ ) lcd_command ( lcd_init [i] ) ; lcd_clear () ; return 1 ; Alfred Mazhindu & Simbarashe Chiweshe Page 20

21 Ideas for improving the the accuracy of the system The system can be made more accurately by increasing the number of illumination values stored i.e. small steps in the values so as to try and cater for all values possible. CONCLUSION The laboratory session has enhanced our programming skills and it has also shown us how practical the subject is. We have also learnt an application of a sensor, and seen how a sensor can gather outside data from the enviroment in analouge form and how the data is then converted to digital form before it is prosseced and then outputs a digital value. Moreover sensor calibrillation has also been a concept that has been grased in the lab session. Since this was the last lab session of the module an overall conclusion can be drawn that sensors are essential in data logging externall readings and PIC make the interfacing on the sensors and actuators possible and relatively easy. REFERENCE JIANG. P SEM1 SENSORS AND ACTUATORS (CY-0205M_2010-1_SEM1_A) > DOCUMENTS > RESOURCES - PING JIANG > LABORATORY EXPERIMENTS > C CODE > S&A_C_LAB3. Alfred Mazhindu & Simbarashe Chiweshe Page 21

ALFRED MAZHINDU

ALFRED MAZHINDU SENSORS AND ACTUATORS LAB_2 ALFRED MAZHINDU 09022270 DATA ACQUISITION FROM AN OPTICAL SENSOR LABORATORY STAGE 2_10/11 Contents Table of Figures... 2 Lab: Data acquisition from an optical sensor... 3 Introduction...

More information

Embedded Systems. PIC16F84A Sample Programs. Eng. Anis Nazer First Semester

Embedded Systems. PIC16F84A Sample Programs. Eng. Anis Nazer First Semester Embedded Systems PIC16F84A Sample Programs Eng. Anis Nazer First Semester 2017-2018 Development cycle (1) Write code (2) Assemble / compile (3) Simulate (4) Download to MCU (5) Test Inputs / Outputs PIC16F84A

More information

Dept. of Computer Engineering Final Exam, First Semester: 2016/2017

Dept. of Computer Engineering Final Exam, First Semester: 2016/2017 Philadelphia University Faculty of Engineering Course Title: Embedded Systems (630414) Instructor: Eng. Anis Nazer Dept. of Computer Engineering Final Exam, First Semester: 2016/2017 Student Name: Student

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

Lesson 14. Title of the Experiment: Introduction to Microcontroller (Activity number of the GCE Advanced Level practical Guide 27)

Lesson 14. Title of the Experiment: Introduction to Microcontroller (Activity number of the GCE Advanced Level practical Guide 27) Lesson 14 Title of the Experiment: Introduction to Microcontroller (Activity number of the GCE Advanced Level practical Guide 27) Name and affiliation of the author: N W K Jayatissa Department of Physics,

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

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

Graphical LCD Display Datasheet EB

Graphical LCD Display Datasheet EB Graphical LCD Display Datasheet EB043-00-1 Contents 1. About this document... 2 2. General information... 3 3. Board layout... 6 4. Testing this product... 7 5. Circuit description... 8 Appendix 1 Circuit

More information

6.1. EE 109 Unit 6. LCD Interfacing

6.1. EE 109 Unit 6. LCD Interfacing 6.1 EE 109 Unit 6 LCD Interfacing LCD BOARD 6.2 6.3 The EE 109 LCD Shield The LCD shield is a 16 character by 2 row LCD that mounts on top of the Arduino Uno. The shield also contains five buttons that

More information

16.317: Microprocessor Systems Design I Fall 2013 Exam 3 Solution

16.317: Microprocessor Systems Design I Fall 2013 Exam 3 Solution 16.317: Microprocessor Systems Design I Fall 2013 Exam 3 Solution 1. (20 points, 5 points per part) Multiple choice For each of the multiple choice questions below, clearly indicate your response by circling

More information

WEATHER STATION WITH SERIAL COMMUNICATION

WEATHER STATION WITH SERIAL COMMUNICATION WEATHER STATION WITH SERIAL COMMUNICATION Written by: Wenbo Ye, Xiao Qu, Carl-Wilhelm Igelström FACULTY OF ENGINEERING, LTH Digital and Analogue Projects EITF11 Contents Introduction... 2 Requirements...

More information

CS 241 Data Organization Binary

CS 241 Data Organization Binary CS 241 Data Organization Binary Brooke Chenoweth University of New Mexico Fall 2017 Combinations and Permutations In English we use the word combination loosely, without thinking if the order of things

More information

1 Introduction to Computers and Computer Terminology Programs Memory Processor Data Sheet... 4

1 Introduction to Computers and Computer Terminology Programs Memory Processor Data Sheet... 4 Overview of the PIC 16F648A Processor: Part 1 EE 361L Lab 2.1 Last update: August 1, 2016 Abstract: This report is the first of a three part series that discusses the features of the PIC 16F648A processor,

More information

PIC 16F84A programming (II)

PIC 16F84A programming (II) Lecture (05) PIC 16F84A programming (II) Dr. Ahmed M. ElShafee ١ Introduction to 16F84 ٣ PIC16F84 belongs to a class of 8-bit microcontrollers of RISC architecture. Program memory (FLASH) EEPROM RAM PORTA

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

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

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

1 Introduction to Computers and Computer Terminology Programs Memory Processor Data Sheet Example Application...

1 Introduction to Computers and Computer Terminology Programs Memory Processor Data Sheet Example Application... Overview of the PIC 16F648A Processor: Part 1 EE 361L Lab 2.1 Last update: August 19, 2011 Abstract: This report is the first of a three part series that discusses the features of the PIC 16F684A processor,

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

The EE 109 LCD Shield

The EE 109 LCD Shield EE 109 Unit 7 LCD 1 LCD BOARD 2 3 The EE 109 LCD Shield The LCD shield is a 16 character by 2 row LCD that mounts on top of the Arduino Uno. The shield also contains five buttons that can be used as input

More information

Application Note One Wire Digital Output. 1 Introduction. 2 Electrical Parameters for One Wire Interface. 3 Start and Data Transmission

Application Note One Wire Digital Output. 1 Introduction. 2 Electrical Parameters for One Wire Interface. 3 Start and Data Transmission Application Note One Wire Digital Output 1 Introduction The pressure transmitter automatically outputs pressure data, and when appropriate temperature data, in a fixed interval. The host simply waits for

More information

More (up a level)... Connecting the Nokia 3510i LCD to a Microchip PIC16F84 microcontroller

More (up a level)... Connecting the Nokia 3510i LCD to a Microchip PIC16F84 microcontroller 1 von 8 24.02.2010 21:53 More (up a level)... Connecting the Nokia 3510i LCD to a Microchip PIC16F84 microcontroller As with the FPGA board previously, the connections are made by soldering standard IDC

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

Mechatronics and Measurement. Lecturer:Dung-An Wang Lecture 6

Mechatronics and Measurement. Lecturer:Dung-An Wang Lecture 6 Mechatronics and Measurement Lecturer:Dung-An Wang Lecture 6 Lecture outline Reading:Ch7 of text Today s lecture: Microcontroller 2 7.1 MICROPROCESSORS Hardware solution: consists of a selection of specific

More information

UNIVERSITY OF ULSTER UNIVERSITY EXAMINATIONS : 2001/2002 RESIT. Year 2 MICROCONTROLLER SYSTEMS. Module Code: EEE305J1. Time allowed: 3 Hours

UNIVERSITY OF ULSTER UNIVERSITY EXAMINATIONS : 2001/2002 RESIT. Year 2 MICROCONTROLLER SYSTEMS. Module Code: EEE305J1. Time allowed: 3 Hours UNIVERSITY OF ULSTER UNIVERSITY EXAMINATIONS : 2001/2002 RESIT Year 2 MICROCONTROLLER SYSTEMS Module Code: EEE305J1 Time allowed: 3 Hours Answer as many questions as you can. Not more than TWO questions

More information

LCDs. Embedded Systems Interfacing. 20 September 2011

LCDs. Embedded Systems Interfacing. 20 September 2011 20 September 2011 How Polarizers Work How work How Color Work Other Technologies Reflective Nematic (no back light) Cholesteric Liquid Crystal Organic LED/Polymer LED Vacuum Florescent Display Display

More information

SC1602LCPro-YG ( Yellow Green Backlight ) SC1602LCPro-B ( Blue Backlight ) Large Character Size ( 4.88x9.66 mm )

SC1602LCPro-YG ( Yellow Green Backlight ) SC1602LCPro-B ( Blue Backlight ) Large Character Size ( 4.88x9.66 mm ) SC1602LCPro-YG ( Yellow Green Backlight ) SC1602LCPro-B ( Blue Backlight ) Large Character Size ( 4.88x9.66 mm ) Features 16 x 2 Large Characters RS485 Serial Interface Programmable Device Address Programmable

More information

Chapter 4 Sections 1 4, 10 Dr. Iyad Jafar

Chapter 4 Sections 1 4, 10 Dr. Iyad Jafar Starting to Program Chapter 4 Sections 1 4, 10 Dr. Iyad Jafar Outline Introduction Program Development Process The PIC 16F84A Instruction Set Examples The PIC 16F84A Instruction Encoding Assembler Details

More information

GPIO32 EXPANDER BOARD

GPIO32 EXPANDER BOARD 1 GPIO32 EXPANDER BOARD FEATURES 2 X MCP23S17 GPIO Expander IC s 4 x I/O ports matching configuration of I/O 24 Hardware addressable pins for each SPI device Easy connection to the I/O port via a 10 way

More information

Character LCD Interface for ez80acclaim! MCUs

Character LCD Interface for ez80acclaim! MCUs Application Note Character LCD Interface for ez80acclaim! MCUs AN015902-0708 Abstract This Application Note provides Character LCD driver routines, coded in ANSI C, for Zilog s ez80acclaim! Flash microcontroller-based

More information

Lab 5: LCD and A/D: Digital Voltmeter

Lab 5: LCD and A/D: Digital Voltmeter Page 1/5 OBJECTIVES Learn how to use C (as an alternative to Assembly) in your programs. Learn how to control and interface an LCD panel to a microprocessor. Learn how to use analog-to-digital conversion

More information

Chapter 9. Input/Output (I/O) Ports and Interfacing. Updated: 3/13/12

Chapter 9. Input/Output (I/O) Ports and Interfacing. Updated: 3/13/12 Chapter 9 Input/Output (I/O) Ports and Interfacing Updated: 3/13/12 Basic Concepts in I/O Interfacing and PIC18 I/O Ports (1 of 2) I/O devices (or peripherals) such as LEDs and keyboards are essential

More information

Laboratory 10. Programming a PIC Microcontroller - Part II

Laboratory 10. Programming a PIC Microcontroller - Part II Laboratory 10 Programming a PIC Microcontroller - Part II Required Components: 1 PIC16F88 18P-DIP microcontroller 1 0.1 F capacitor 3 SPST microswitches or NO buttons 4 1k resistors 1 MAN 6910 or LTD-482EC

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

LAB WORK 2. 1) Debugger-Select Tool-MPLAB SIM View-Program Memory Trace the program by F7 button. Lab Work

LAB WORK 2. 1) Debugger-Select Tool-MPLAB SIM View-Program Memory Trace the program by F7 button. Lab Work LAB WORK 1 We are studying with PIC16F84A Microcontroller. We are responsible for writing assembly codes for the microcontroller. For the code, we are using MPLAB IDE software. After opening the software,

More information

Embedded Systems Programming and Architectures

Embedded Systems Programming and Architectures Embedded Systems Programming and Architectures Lecture No 10 : Data acquisition and data transfer Dr John Kalomiros Assis. Professor Department of Post Graduate studies in Communications and Informatics

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

MICROPROCESSORS A (17.383) Fall Lecture Outline

MICROPROCESSORS A (17.383) Fall Lecture Outline MICROPROCESSORS A (17.383) Fall 2010 Lecture Outline Class # 03 September 21, 2010 Dohn Bowden 1 Today s Lecture Syllabus review Microcontroller Hardware and/or Interface Programming/Software Lab Homework

More information

Lab Experiment 9: LCD Display

Lab Experiment 9: LCD Display Lab Experiment 9: LCD Display 1 Introduction Liquid Crystal Displays (LCDs) provide an effective way for processors to communicate with the outside world. The LPC2148 board used in the lab is equipped

More information

Assembly Language Instructions

Assembly Language Instructions Assembly Language Instructions Content: Assembly language instructions of PIC16F887. Programming by assembly language. Prepared By- Mohammed Abdul kader Assistant Professor, EEE, IIUC Assembly Language

More information

Explanation of PIC 16F84A processor data sheet Part 1: overview of the basics

Explanation of PIC 16F84A processor data sheet Part 1: overview of the basics Explanation of PIC 16F84A processor data sheet Part 1: overview of the basics This report is the first of a three part series that discusses the features of the PIC 16F94A processor. The reports will refer

More information

Exam 1. Date: February 23, 2016

Exam 1. Date: February 23, 2016 Exam 1 Date: February 23, 2016 UT EID: Printed Name: Last, First Your signature is your promise that you have not cheated and will not cheat on this exam, nor will you help others to cheat on this exam:

More information

PIC PROGRAMMING START. The next stage is always the setting up of the PORTS, the symbol used to indicate this and all Processes is a Rectangle.

PIC PROGRAMMING START. The next stage is always the setting up of the PORTS, the symbol used to indicate this and all Processes is a Rectangle. PIC PROGRAMMING You have been introduced to PIC chips and the assembly language used to program them in the past number of lectures. The following is a revision of the ideas and concepts covered to date.

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

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

ECE Test #1: Name

ECE Test #1: Name ECE 376 - Test #1: Name Closed Book, Closed Notes. Calculators Permitted. September 23, 2016 20 15 10 5 0

More information

Example of Asyncronous Serial Comms on a PIC16F877

Example of Asyncronous Serial Comms on a PIC16F877 /***************************************************************************************/ /* Example of Asyncronous Serial Comms on a PIC16F877 */ /* Target: PIC16F877 */ /* Baud: 9600 */ /* Bits: 8 */

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

MicroToys Guide: PS/2 Mouse N. Pinckney April 2005

MicroToys Guide: PS/2 Mouse N. Pinckney April 2005 Introduction A computer mouse provides an excellent device to acquire 2D coordinate-based user input, since most users are already familiar with it. Most mice usually come with two or three buttons, though

More information

The EE 109 LCD Shield

The EE 109 LCD Shield EE 109 Unit 9 LCD 1 LCD BOARD 2 3 The EE 109 LCD Shield The LCD shield is a 16 character by 2 row LCD that mounts on top of the Arduino Uno. The shield also contains five buttons that can be used as input

More information

Interrupt vectors for the 68HC912B32. The interrupt vectors for the MC9S12DP256 are located in memory from 0xFF80 to 0xFFFF.

Interrupt vectors for the 68HC912B32. The interrupt vectors for the MC9S12DP256 are located in memory from 0xFF80 to 0xFFFF. Interrupts The Real Time Interrupt Interrupt vectors for the 68HC912B32 The interrupt vectors for the MC9S12DP256 are located in memory from 0xFF80 to 0xFFFF. These vectors are programmed into Flash EEPROM

More information

MICROPROCESSORS A (17.383) Fall Lecture Outline

MICROPROCESSORS A (17.383) Fall Lecture Outline MICROPROCESSORS A (17.383) Fall 2010 Lecture Outline Class # 04 September 28, 2010 Dohn Bowden 1 Today s Lecture Syllabus review Microcontroller Hardware and/or Interface Programming/Software Lab Homework

More information

C Language Programming, Interrupts and Timer Hardware

C Language Programming, Interrupts and Timer Hardware C Language Programming, Interrupts and Timer Hardware In this sequence of three labs, you will learn how to write simple C language programs for the MC9S12 microcontroller, and how to use interrupts and

More information

Lab 5: LCD and A/D: Digital Voltmeter

Lab 5: LCD and A/D: Digital Voltmeter Page 1/5 OBJECTIVES Learn how to use C (as an alternative to Assembly) in your programs. Learn how to control and interface an LCD panel to a microprocessor. Learn how to use analog-to-digital conversion

More information

Application Note - PIC Source Code v1.1.doc

Application Note - PIC Source Code v1.1.doc Programmable, RGB-backlit LCD Keyswitches APPLICATION NOTE PIC SOURCE CODE 2004-2006 copyright [E³] Engstler Elektronik Entwicklung GmbH. All rights reserved. PIC Source Code The following Assembler source

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

UNIVERSITY OF CONNECTICUT. ECE 3411 Microprocessor Application Lab: Fall Quiz II

UNIVERSITY OF CONNECTICUT. ECE 3411 Microprocessor Application Lab: Fall Quiz II Department of Electrical and Computing Engineering UNIVERSITY OF CONNECTICUT ECE 3411 Microprocessor Application Lab: Fall 2015 Quiz II There are 5 questions in this quiz. There are 9 pages in this quiz

More information

Programming (1.0hour)

Programming (1.0hour) COMPETITOR S INSTRUCTION:- Attempt all questions: Where applicable circle the letter that indicates the correct answer. Otherwise answer questions as instructed D1.1 Embedded code is used widely in modern

More information

E85 Lab 8: Assembly Language

E85 Lab 8: Assembly Language E85 Lab 8: Assembly Language E85 Spring 2016 Due: 4/6/16 Overview: This lab is focused on assembly programming. Assembly language serves as a bridge between the machine code we will need to understand

More information

EMBEDDED HARDWARE DESIGN. Tutorial Interfacing LCD with Microcontroller /I

EMBEDDED HARDWARE DESIGN. Tutorial Interfacing LCD with Microcontroller /I EMBEDDED HARDWARE DESIGN Tutorial Interfacing LCD with Microcontroller 2009-10/I LCD (Liquid Crystal Display) has become very popular option for displaying in Embedded Applications. Since they are very

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

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

Hitachi Europe Ltd. ISSUE : app026/1.0 APPLICATION NOTE DATE : 20/9/94

Hitachi Europe Ltd. ISSUE : app026/1.0 APPLICATION NOTE DATE : 20/9/94 APPLICATION NOTE DATE : 20/9/94 Configuring the HD44780 LCD controller / driver which is built onto the range of Hitachi Character Liquid Crystal Display Modules. The HD44780 gives the user the ability

More information

Timer2 Interrupts. NDSU Timer2 Interrupts September 20, Background:

Timer2 Interrupts. NDSU Timer2 Interrupts September 20, Background: Background: Timer2 Interrupts The execution time for routines sometimes needs to be set. This chapter loops at several ways to set the sampling rate. Example: Write a routine which increments an 8-bit

More information

DERTS Design Requirements (1): Microcontroller Architecture & Programming

DERTS Design Requirements (1): Microcontroller Architecture & Programming Lecture (5) DERTS Design Requirements (1): Microcontroller Architecture & Programming Prof. Kasim M. Al-Aubidy Philadelphia University 1 Lecture Outline: Features of microcomputers and microcontrollers.

More information

Real Time Operating Systems Application Board Details

Real Time Operating Systems Application Board Details Real Time Operating Systems Application Board Details Hardware Interface All labs involve writing a C program to generate an interface between a PC and an external Multi-Applications board. A 40-way ribbon

More information

Q1 Q2 Q3 Q4 Q5 Q6 Total /7.5 /5 /10 /5 /7.5 /5 /40

Q1 Q2 Q3 Q4 Q5 Q6 Total /7.5 /5 /10 /5 /7.5 /5 /40 Course name: Practical App. CS II Exam number: Final model answer Course Code: CSC20X Exam Date: 03/06/2014 Lecturer: Dr. Ahmed ElShafee Time Allowed: 120 minutes Q1 Q2 Q3 Q4 Q5 Q6 Total /7.5 /5 /10 /5

More information

IME-100 ECE. Lab 4. Electrical and Computer Engineering Department Kettering University. G. Tewolde, IME100-ECE,

IME-100 ECE. Lab 4. Electrical and Computer Engineering Department Kettering University. G. Tewolde, IME100-ECE, IME-100 ECE Lab 4 Electrical and Computer Engineering Department Kettering University 4-1 1. Laboratory Computers Getting Started i. Log-in with User Name: Kettering Student (no password required) ii.

More information

Lecture (04) PIC16F84A (3)

Lecture (04) PIC16F84A (3) Lecture (04) PIC16F84A (3) By: Dr. Ahmed ElShafee ١ Central Processing Unit Central processing unit (CPU) is the brain of a microcontroller responsible for finding and fetching the right instruction which

More information

C Language Programming

C Language Programming C Language Programming for the 8051 Overview C for microcontrollers Review of C basics Compilation flow for SiLabs IDE C extensions In-line assembly Interfacing with C Examples Arrays and Pointers I/O

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

Outlines. PIC Programming in C and Assembly. Krerk Piromsopa, Ph.D. Department of Computer Engineering Chulalongkorn University

Outlines. PIC Programming in C and Assembly. Krerk Piromsopa, Ph.D. Department of Computer Engineering Chulalongkorn University PIC ming in C and Assembly Outlines Microprocessor vs. MicroController PIC in depth PIC ming Assembly ming Krerk Piromsopa, Ph.D. Department of Computer Engineering Chulalongkorn University Embedded C

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

The amount of current drawn and the temperature generated by DC motor are crucial in understanding the performance and reliability of motors.

The amount of current drawn and the temperature generated by DC motor are crucial in understanding the performance and reliability of motors. 1/1/1 Fall 1 Honore Hodary Motivation Overheating is one of the most common cause of failure in DC motors. It can lead to bearings failure (motor jam), winding isolation (short circuit), and degradation

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

UNIVERSITY OF BOLTON SCHOOL OF ENGINEERING MSC SYSTEMS ENGINEERING AND ENGINEERING MANAGEMENT SEMESTER 2 EXAMINATION 2016/2017

UNIVERSITY OF BOLTON SCHOOL OF ENGINEERING MSC SYSTEMS ENGINEERING AND ENGINEERING MANAGEMENT SEMESTER 2 EXAMINATION 2016/2017 TW30 UNIVERSITY OF BOLTON SCHOOL OF ENGINEERING MSC SYSTEMS ENGINEERING AND ENGINEERING MANAGEMENT SEMESTER 2 EXAMINATION 2016/2017 MICROPROCESSOR BASED SYSTEMS MODULE NO: EEM7016 Date: Wednesday 17 May

More information

BV4218. I2C-LCD & Keypad. Product specification. December 2008 V0.a. ByVac 2006 ByVac Page 1 of 9

BV4218. I2C-LCD & Keypad. Product specification. December 2008 V0.a. ByVac 2006 ByVac Page 1 of 9 Product specification December 2008 V0.a ByVac 2006 ByVac Page 1 of 9 Contents 1. Introduction...3 2. Features...3 3. Electrical Specification...3 4. I2C set...4 5. The LCD Set...5 5.1. 1...5 5.2. 2...5

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

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

Laboratory: Introduction to Mechatronics. Instructor TA: Edgar Martinez Soberanes Lab 2. PIC and Programming

Laboratory: Introduction to Mechatronics. Instructor TA: Edgar Martinez Soberanes Lab 2. PIC and Programming Laboratory: Introduction to Mechatronics Instructor TA: Edgar Martinez Soberanes (eem370@mail.usask.ca) 2015-01-12 Lab 2. PIC and Programming Lab Sessions Lab 1. Introduction Read manual and become familiar

More information

16.317: Microprocessor-Based Systems I Summer 2012

16.317: Microprocessor-Based Systems I Summer 2012 16.317: Microprocessor-Based Systems I Summer 2012 Exam 3 Solution 1. (20 points, 5 points per part) Multiple choice For each of the multiple choice questions below, clearly indicate your response by circling

More information

2.1. Unit 2. Integer Operations (Arithmetic, Overflow, Bitwise Logic, Shifting)

2.1. Unit 2. Integer Operations (Arithmetic, Overflow, Bitwise Logic, Shifting) 2.1 Unit 2 Integer Operations (Arithmetic, Overflow, Bitwise Logic, Shifting) 2.2 Skills & Outcomes You should know and be able to apply the following skills with confidence Perform addition & subtraction

More information

Flow Charts and Assembler Programs

Flow Charts and Assembler Programs Flow Charts and Assembler Programs Flow Charts: A flow chart is a graphical way to display how a program works (i.e. the algorithm). The purpose of a flow chart is to make the program easier to understand.

More information

Lampiran I. Rangkaian Lengkap Alat. Universitas Sumatera Utara

Lampiran I. Rangkaian Lengkap Alat. Universitas Sumatera Utara Lampiran I Rangkaian Lengkap Alat Lampiran II Program Pada Alat /***************************************************** This program was produced by the CodeWizardAVR V2.04.9 Evaluation Automatic Program

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

Chapter 5. Problems All programming problems should include design pseudo code either as a separate design document on embedded comments in the code.

Chapter 5. Problems All programming problems should include design pseudo code either as a separate design document on embedded comments in the code. Chapter 5. Problems All programming problems should include design pseudo code either as a separate design document on embedded comments in the code. 1S. Prior to execution of the following code segment,

More information

SC1602LC 16x2 Large Characters RS232 LCD Module. User s Manual. Large Viewing Area 99mm x 24mm. Large Character Size. 4.84mm x 9.66mm.

SC1602LC 16x2 Large Characters RS232 LCD Module. User s Manual. Large Viewing Area 99mm x 24mm. Large Character Size. 4.84mm x 9.66mm. Large Viewing Area 99mm x 24mm Large Character Size 4.84mm x 9.66mm Features 16x2 Large Characters LCD RS232 Interface Simple Serial Command Wide Range Voltage Operation ( 9-15V ) 8 User s Defined Characters

More information

MTRX3700 Mechatronics

MTRX3700 Mechatronics MTRX3700 Mechatronics 3 2015 PIC18F452 Software Exercises David Rye You are to work in a group of two students to write, debug and demonstrate a series of small assembly language and C programs that meet

More information

RS232.C An Interrupt driven Asyncronous Serial Port

RS232.C An Interrupt driven Asyncronous Serial Port /***************************************************************************/ /* RS232.C An Interrupt driven Asyncronous Serial Port */ /* Date : 06/03/2002 */ /* Purpose : Asyncronous Transmitter & Receiver

More information

TSB Software Reference Manual

TSB Software Reference Manual TSB Software Reference Manual Temperature Sensors Board Commands Description L. Castellani I.N.F.N. sez. PADOVA 10 December 2009 Document Version 1.4 Firmware Version 2.5 Introduction The TSB emulate the

More information

RFT(Robotous Force/Torque Sensor) Series

RFT(Robotous Force/Torque Sensor) Series RFT(Robotous Force/Torque Sensor) Series Installation and Operation Manual REVISION 1.1 1 Contents 1. Caution 4 1.1. Notices 4 1.2. Warning 4 2. Installation 5 2.1. Overview 5 2.2. Power Supply Specifications

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

EE319K Fall 2013 Exam 1B Modified Page 1. Exam 1. Date: October 3, 2013

EE319K Fall 2013 Exam 1B Modified Page 1. Exam 1. Date: October 3, 2013 EE319K Fall 2013 Exam 1B Modified Page 1 Exam 1 Date: October 3, 2013 UT EID: Printed Name: Last, First Your signature is your promise that you have not cheated and will not cheat on this exam, nor will

More information

ECE 206, Fall 2001: Lab 3

ECE 206, Fall 2001: Lab 3 ECE 206, : Lab 3 Data Movement Instructions Learning Objectives This lab will give you practice with a number of LC-2 programming constructs. In particular you will cover the following topics: - Load/store

More information

Developement of Multi Interface Board for Educational Trainer Kit

Developement of Multi Interface Board for Educational Trainer Kit Journal of Engineering Technology Vol. 2(1): 1-5, 2012 ISSN 2231-8798 2012UniKLBMI Developement of Multi Interface Board for Educational Trainer Kit M.R. Abdullah, Z. Zaharudin, Z. Mahmoodin, Z. Zainuddin

More information

Build instructions. Name: James Kinney Project: Air-Suspension System School: Colorado State University Class: MECH307 Mechatronics

Build instructions. Name: James Kinney Project: Air-Suspension System School: Colorado State University Class: MECH307 Mechatronics Build instructions Name: James Kinney Project: Air-Suspension System School: Colorado State University Class: MECH307 Mechatronics This gadget is a Mechatronic Microcontroller. It is an air-suspension

More information

84x48 LCD Display. 1. Usage with an Arduino 1.1 Connecting the display 1.2 Pin assignment 1.3 Code example

84x48 LCD Display. 1. Usage with an Arduino 1.1 Connecting the display 1.2 Pin assignment 1.3 Code example Index 1. Usage with an Arduino 1.1 Connecting the display 1.2 Pin assignment 1.3 Code example 2. Usage with a Raspberry Pi 2.1 Connecting the display 2.2 Pin assignment 2.3 Installation of the operating

More information

ME 6405 Introduction to Mechatronics

ME 6405 Introduction to Mechatronics ME 6405 Introduction to Mechatronics Fall 2006 Instructor: Professor Charles Ume Microchip PIC Manufacturer Information: Company: Website: http://www.microchip.com Reasons for success: Became the hobbyist's

More information

UEE1302(1066) F12: Introduction to Computers and Programming Function (II) - Parameter

UEE1302(1066) F12: Introduction to Computers and Programming Function (II) - Parameter UEE1302(1066) F12: Introduction to Computers and Programming Function (II) - Parameter What you will learn from Lab 7 In this laboratory, you will understand how to use typical function prototype with

More information

USB-Based 14-Channel Data-Acquisition Module

USB-Based 14-Channel Data-Acquisition Module USB-Based 14-Channel Data-Acquisition Module DLP-IO14 LEAD FREE FEATURES: 14 IO s: 0-5V Analog, Digital In/Out, Temperature Two Bipolar Analog Inputs; ±5V Input Range Max All Analog Inputs: Up to 30Ksps

More information