Preface xiii Acknowledgements xv 1 Introduction to Microcontrollers and Display Systems 1 1.1 Microcontrollers and Microprocessors 2 1.2 Evolution of the Microcontroller 3 1.3 Parts of a Microcontroller 4 1.3.1 Address 4 1.3.2 ALU 5 1.
3.3 Analogue Comparator 5 1.3.4 Analogue-to-Digital Converter 5 1.3.5 Brown-out Detector 5 1.3.6 Bus 5 1.
3.7 CAN 6 1.3.8 CISC 6 1.3.9 Clock 6 1.3.10 CPU 6 1.
3.11 EEPROM 6 1.3.12 EPROM 6 1.3.13 Ethernet 7 1.3.14 Flash Memory 7 1.
3.15 Harvard Architecture 7 1.3.16 Idle Mode 7 1.3.17 Interrupts 7 1.3.18 LCD Drivers 8 1.
3.19 Pipelining 8 1.3.20 Power-on Reset 8 1.3.21 PROM 8 1.3.22 RAM 8 1.
3.23 Real-time Clock 8 1.3.24 Register 9 1.3.25 Reset 9 1.3.26 RISC 9 1.
3.27 ROM 9 1.3.28 Serial Input-Output 9 1.3.29 Sleep Mode 9 1.3.30 Supply Voltage 10 1.
3.31 Timers 10 1.3.32 USB 10 1.3.33 Watchdog 10 1.4 Display Devices 10 1.4.
1 LED 10 1.4.2 7-Segment LED 11 1.4.3 OLED 12 1.4.4 LCD 12 1.5 Summary 15 Exercises 15 2 PIC18F Microcontrollers 17 2.
1 The PIC18F2410 Microcontroller 18 2.2 PIC18F2410 Architecture 19 2.2.1 The Program Memory 21 2.2.2 The Data Memory 21 2.2.3 Power Supply Requirements 22 2.
2.4 Oscillator Configurations 24 2.2.5 The Reset 30 2.2.6 Parallel I/O Ports 31 2.2.7 Timer Modules 38 2.
2.8 Analogue-to-Digital Converter Module 43 2.2.9 Special Features of the CPU 48 2.2.10 Interrupts 49 2.2.11 Pulse Width Modulator Module 53 2.
3 Summary 56 Exercises 56 3 C Programming Language 59 3.1 C Languages for Microcontrollers 59 3.2 Your First mikroC Pro for PIC Program 61 3.2.1 Comments 61 3.2.2 Beginning and Ending a Program 62 3.2.
3 White Spaces 63 3.2.4 Variable Names 63 3.2.5 Reserved Names 64 3.2.6 Variable Types 64 3.2.
7 Constants 66 3.2.8 Escape Sequences 68 3.2.9 Volatile Variables 69 3.2.10 Accessing Bits of a Variable 69 3.2.
11 sbit Type 70 3.2.12 bit Type 70 3.2.13 Arrays 70 3.2.14 Pointers 73 3.2.
15 Structures 76 3.2.16 Unions 80 3.2.17 Operators in mikroC Pro for PIC 80 3.2.18 The Flow of Control 90 3.3 Functions in mikroC Pro for PIC 101 3.
3.1 Function Prototypes 102 3.3.2 void Functions 103 3.3.3 Passing Parameters to Functions 104 3.3.4 Passing Arrays to Functions 106 3.
3.5 Interrupt Processing 106 3.4 mikroC Pro for PIC Built-in Functions 108 3.5 mikroC Pro for PIC Libraries 109 3.5.1 ANSI C Library 109 3.5.2 Miscellaneous Library 111 3.
6 Using the mikroC Pro for PIC Compiler 111 3.6.1 mikroC Pro for PIC IDE 112 3.6.2 Creating a New Source File 118 3.6.3 Compiling the Source File 122 3.7 Using the mikroC Pro for PIC Simulator 123 3.
7.1 Setting a Break-Point 124 3.8 Other mikroC Pro for PIC Features 126 3.8.1 View Statistics 126 3.8.2 View Assembly 127 3.8.
3 ASCII Chart 127 3.8.4 USART Terminal 127 3.8.5 Seven Segment Editor 127 3.8.6 Help 128 3.9 Summary 128 Exercises 129 4 PIC Microcontroller Development Tools - Including Display Development Tools 131 4.
1 PIC Hardware Development Boards 132 4.1.1 Super Bundle Development Kit 132 4.1.2 PIC18 Explorer Board 132 4.1.3 PIC18F4XK20 Starter Kit 134 4.1.
4 PICDEM 4 135 4.1.5 PIC16F887 Development Kit 135 4.1.6 FUTURLEC PIC18F4550 Development Board 137 4.1.7 EasyPIC6 Development Board 137 4.1.
8 EasyPIC7 Development Board 139 4.2 PIC Microcontroller Display Development Tools 140 4.2.1 Display Hardware Tools 140 4.2.2 Display Software Tools 143 4.3 Using the In-Circuit Debugger with the EasyPIC7 Development Board 145 4.4 Summary 149 Exercises 149 5 Light Emitting Diodes (LEDs) 151 5.
1 ATypical LED 151 5.2 LED Colours 153 5.3 LED Sizes 154 5.4 Bi-Colour LEDs 154 5.5 Tri-Colour LEDs 155 5.6 Flashing LEDs 155 5.7 Other LED Shapes 155 5.8 7-Segment LEDs 156 5.
8.1 Displaying Numbers 157 5.8.2 Multi-digit 7-Segment Displays 159 5.9 Alphanumeric LEDs 159 5.10 mikroC Pro for PIC 7-Segment LED Editor 163 5.11 Summary 163 Exercises 164 6 Liquid Crystal Displays (LCDs) and mikroC Pro for PIC LCD Functions 165 6.1 HD44780 Controller 165 6.
2 Displaying User Defined Data 168 6.3 DDRAM Addresses 169 6.4 Display Timing and Control 171 6.4.1 Clear Display 172 6.4.2 Return Cursor to Home 172 6.4.
3 Cursor Move Direction 172 6.4.4 Display ON/OFF 172 6.4.5 Cursor and Display Shift 173 6.4.6 Function Set 173 6.4.
7 Set CGRAM Address 173 6.4.8 Set DDRAM Address 173 6.4.9 Read Busy Flag 174 6.4.10 Write Data to CGRAM or DDRAM 174 6.4.
11 Read Data from CGRAM or DDRAM 174 6.5 LCD Initialisation 174 6.5.1 8-bit Mode Initialisation 175 6.5.2 4-bit Mode Initialisation 175 6.6 Example LCD Display Setup Program 177 6.7 mikroC Pro for PIC LCD Functions 180 6.
7.1 Lcd_Init 180 6.7.2 Lcd_Out 181 6.7.3 Lcd_Out_Cp 181 6.7.4 Lcd_Chr 181 6.
7.5 Lcd_Chr_Cp 181 6.7.6 Lcd_Cmd 182 6.8 Summary 182 Exercises 183 7 Graphics LCD Displays (GLCD) 185 7.1 The 128 x 64 Pixel GLCD 185 7.2 Operation of the GLCD Display 187 7.3 mikroC Pro for PIC GLCD Library Functions 189 7.
3.1 Glcd_Init 189 7.3.2 Glcd_Set_Side 190 7.3.3 Glcd_Set_X 190 7.3.4 Glcd_Set_Page 190 7.
3.5 Glcd_Write_Data 190 7.3.6 Glcd_Fill 190 7.3.7 Glcd_Dot 191 7.3.8 Glcd_Line 191 7.
3.9 Glcd_V_Line 191 7.3.10 Glcd_H_Line 191 7.3.11 Glcd_Rectangle 192 7.3.12 Glcd_Rectangle_Round_Edges 192 7.
3.13 Glcd_Rectangle_Round_Edges_Fill 192 7.3.14 Glcd_Box 193 7.3.15 Glcd_Circle 193 7.3.16 Glcd_Circle_Fill 194 7.
3.17 Glcd_Set_Font 194 7.3.18 Glcd_Set_Font_Adv 194 7.3.19 Glcd_Write_Char 195 7.3.20 Glcd_Write_Char_Adv 195 7.
3.21 Glcd_Write_Text 195 7.3.22 Glcd_Write_Text_Adv 195 7.3.23 Glcd_Write_Const_Text_Adv 196 7.3.24 Glcd_Image 196 7.
4 Example GLCD Display 196 7.5 mikroC Pro for PIC Bitmap Editor 198 7.6 Adding Touch-screen to GLCDs 199 7.6.1 Types of Touch-screen Displays 200 7.6.2 Resistive Touch Screens 200 7.7 Summary 203 Exercises 204 8 Microcontroller Program Development 205 8.
1 Using the Program Description Language and Flowcharts 205 8.1.1 BEGIN - END 206 8.1.2 Sequencing 206 8.1.3 IF - THEN - ELSE - ENDIF 206 8.1.
4 DO - ENDDO 207 8.1.5 REPEAT - UNTIL 209 8.1.6 Calling Subprograms 209 8.1.7 Subprogram Structure 209 8.2 Examples 211 8.
3 Representing for Loops in Flowcharts 216 8.4 Summary 218 Exercises 218 9 LED Based Projects 219 9.1 PROJECT 9.1 - Flashing LED 219 9.2 PROJECT 9.2 - Binary Counting Up LEDs 226 9.3 PROJECT 9.3 - Rotating LEDs 229 9.
4 PROJECT 9.4 - Wheel of Lucky Day 231 9.5 PROJECT 9.5 - Random Flashing LEDs 239 9.6 PROJECT 9.6 - LED Dice 240 9.7 PROJECT 9.7 - Connecting more than one LED to a Port Pin 246 9.
8 PROJECT 9.8 - Changing the Brightness of LEDs 250 9.9 PROJECT 9.9 - LED Candle 264 9.10 Summary 267 Exercises 267 10 7-Segment LED Display Based Projects 269 10.1 PROJECT 10.1 - Single Digit Up Counting 7-Segment LED Display 269 10.2 PROJECT 10.
2 - Display a Number on 2-Digit 7-Segment LED Display 271 10.3 PROJECT 10.3 - Display Lottery Numbers on 2-Digit 7-Segment LED Display 278 10.4 PROJECT 10.4 - Event Counter Using 4-Digit 7-Segment LED Display 285 10.5 PROJECT 10.5 - External Interrupt Based Event Counter Using 4-Digit 7-Segment LED Display with Serial Driver 292 10.6 Summary 302 Exercises 303 11 Text Based LCD Projects 305 11.
1 PROJECT 11.1 - Displaying Text on LCD 305 11.2 PROJECT 11.2 - Moving Text on LCD 307 11.3 PROJECT 11.3 - Counting with the LCD 310 11.4 PROJECT 11.4 - Creating Custom Fonts on the LCD 315 11.
5 PROJECT 11.5 - LCD Dice 317 11.6 PROJECT 11.6 - Digital Voltmeter 325 11.7 PROJECT 11.7 - Temperature and Pressure Display 327 11.8 PROJECT 11.8 - The High/Low Game 333 11.
9 Summary 344 Exercises 345 12 Graphics LCD Projects 347 12.1 PROJECT 12.1 - Creating and Displaying a Bitmap Image 347 12.2 PROJECT 12.2 - Moving Ball Animation 355 12.3 PROJECT 12.3 - GLCD Dice 357 12.4 PROJECT 12.
4 - GLCD X-Y Plotting 372 12.5 PROJECT 12.5 - Plotting Temperature Variation on the GLCD 374 12.6 PROJECT 12.6 - Temperature and Relative Humidity Measurement 385 12.7 Operation of the SHT11 386 12.8 Acknowledgement 389 12.9 Summary 400 Exercises 400 13 Touch Screen Graphics LCD Projects 401 13.
1 PROJECT 13.1 - Touch Screen LED ON-OFF 401 13.2 PROJECT 13.2 - LED Flashing with Variable Rate 410 13.3 Summary 418 Exercises 418 14 Using the Visual GLCD Software in GLCD Projects 419 14.1 PROJEC.