Upload
y33-4nn
View
49
Download
0
Tags:
Embed Size (px)
DESCRIPTION
Industrial training report
Citation preview
INDUSTRIAL TRAINING REPORT
LEE YEE ANNBACHELOR IN ENGINEERING
(COMPUTER NETWORK ENGINEERING)
SCHOOL OF COMPUTER AND COMMUNICATION ENGINEERING
UNIVERSITI MALAYSIA PERLIS
2012
INDUSTRIAL TRAINING REPORTEIT300/4
AT
SILICONETICS RESEARCH CORPORATION SDN. BHD.
LOT 8032-T1, BANDAR SATELIT ISLAM PASIR TUMBOH, JALAN PASIR PUTEH,
16150 KOTA BHARU, KELANTAN DARUL NAIM
NAME : LEE YEE ANN
MATRIC NUMBER : 101230415
PROGRAM : BACHELOR IN ENGINEERING
(COMPUTER NETWORK ENGINEERING)
ACADEMIC SESSION : 2011/2012
ACKNOWLEDGEMENT
First of all, I would like to thank God for everything He had done for me.
I would also like to thank the company, Siliconetics Research Corporation Sdn.
Bhd., for allowing me to undergo Industrial Training at this very company. I would also
extend my appreciation to the owner/CEO of the company, Mr. Rokman Bin Semail,
and the General Manager, Mr. Mohd. Fikry Bin Mohd. Yusof, that had supervised my
progress throughout the duration of the training. Their attentions, helps and support in
many ways had made my experience during the Industrial Training more worthwhile.
Not to forget the other staffs and trainees of the company, whom through their
helpfulness and friendliness, had made the experience gained throughout the duration of
Industrial Training unforgettable.
I would also express my gratitude to Associate Professor Dr. Mohammud B. Che
Husain from the School of Bioprocess Engineering for his willingness to spend a
fraction of his time to pay a visit to the company to observe my progress. Also thanks to
Universiti Malaysia Perlis (UniMAP) and the engineering school I am studying in, the
School of Computer and Communication Engineering for the knowledge and
experiences gained.
Last but not least, millions of thanks to my family members for their unlimited
blessings and support.
Thank you, everyone!
ii
ABSTRACT
Industrial Training is a platform for students to gain hands-on experience about
what they had learnt and to apply the knowledge of their respective engineering field
into the work environment. Siliconetics Research Corporation Sdn. Bhd. (SRC) is a
research and development (R&D) company that operate in the ICT and robotic field.
The robotic development in SRC uses the PIC18 microcontroler and C programming
language. A trainee that had never utilise the PIC18 microcontroler before was assigned
with projects that were aimed for the trainee to learn and familiarise with PIC18 and the
use of C language to program the system as the main tasks throughout the Industrial
Training in SRC. Secondary tasks that were aimed for the trainee to learn the
importance of documenting the projects done and to communicate with end users
indirectly through support documents and information available in the websites were
also assigned. There were also different miscellaneous tasks assigned to trainees. In
overall, by undergoing Industrial Training in SRC is a chance for student to gain
knowledge not available during lecture and lab session in UniMAP and to apply
knowledge in related field in to the work environment.
iii
TABLE OF CONTENTS
ACKNOWLEDGEMENT OF COMPLETION OF INDUSTRIAL TRAINING i
ACKNOWLEDGEMENT ii
ABSTRACT iii
TABLE OF CONTENTS iv
LIST OF TABLES vii
LIST OF FIGURES viii
CHAPTER 1 INTRODUCTION 1
1.1 Host Company 1
1.2 Organisation of the Company 2
1.3 Advantages of the Company 2
1.4 Products and Services 3
CHAPTER 2 PIC18 MICROCONTROLLER PROJECTS 6
2.1 introduction 6
2.2 PIC18 Microcontroller and the PIC18F2550 6
2.3 Common Components and Devices 7
2.4 Blinking an LED 9
2.5 More LEDs 10
2.6 Switches and LEDs 11
2.7 Switches and LED, Input/Output Control 12
2.8 Seven-Segment Displays 13
2.9 Two Seven-segment Displays Multiplexing 14
2.10 Binary Coded Decimal to Seven-segment Display Decoder/Driver IC 15
iv
2.11 16×2 Liquid Crystal Display Module Interfacing in 8-bit Mode 17
2.12 16×2 Liquid Crystal Display Module Interfacing in 4-bit Mode 18
2.13 16×1 Liquid Crystal Display Module Interfacing in 4-bit Mode 19
2.14 8×8 LED Matrix Display Interfacing 19
CHAPTER 3 PIC18 PROJECTS' DOCUMENTATION 22
3.1 Introduction 22
3.2 Schematic Diagram Drawing 22
3.3 Documenting PIC18F2550 Projects 24
3.4 Update Hitkr Website using BizAdmin 26
CHAPTER 4 MISCELLANEOUS TASKS 28
4.1 Introduction 28
4.2 ThinClient and ThinStation 28
4.3 Software Disc Packaging 30
4.4 Electrical Wiring 30
4.5 Acrylic Prototyping 31
4.6 Visit by Lecturer from UniMAP 32
CHAPTER 5 DISCUSSION AND RECOMMENDATION 33
5.1 Discussion 33
5.2 Recommendation 34
CHAPTER 6 CONCLUSION 35
6.1 Conclusion 35
REFERENCES 36
v
APPENDICES 37
Appendix A (i) 37
Appendix A (ii) 38
Appendix B (i) 39
Appendix B (ii) 40
Appendix C 41
Appendix D 43
vi
LIST OF TABLES
Table 2.1: State of Switches and Light Effect 12
vii
LIST OF FIGURES
Figure 1.1: The Corporate Logo of Siliconetics Research Corporation Sdn. Bhd. 1
Figure 1.2: Organisation Chart Siliconetics Research Corporation Sdn. Bhd. 2
Figure 1.3: Siliconetics Research Corporation Sdn. Bhd. 3
Figure 1.4: The Logo for Siliconetics Products 4
Figure 1.5: The Logo for Mawarsoft Products 4
Figure 2.1: PIC18F2550 in 28 Pins DIP Form Factor 7
Figure 2.2: Pin Assignment of PIC18F2550 in DIP Form Factor 7
Figure 2.3: Microchip PICkit3 8
Figure 2.4: Breadboard 8
Figure 2.5: Screenshot of the Splash Screen MPLAB IDE 9
Figure 2.6: Schematic Diagram of Blinking an LED Project 10
Figure 2.7: PICkit3 Connected to Program the PIC18F2550 10
Figure 2.8: Blinking an LED Project with the LED in On State 10
Figure 2.9: Schematic Diagram of More LEDs Project 11
Figure 2.10: More LEDs Project Showing One of the Light Effects 11
Figure 2.11: Schematic Diagram of Switches and LEDs Project 12
Figure 2.12: Switches and LEDs Project Showing Switches 2, 3, 7 and 8 Active 12
Figure 2.13: Schematic Diagram of Switches and LEDs, Input/Output Control Project 13
Figure 2.14: Switches and LEDs, Input/Output Control Project Showing Switch 8
Active Triggering Generation of Knight Rider Light Effect 13
Figure 2.15: Schematic Diagram of Seven-segment Displays Project 14
Figure 2.16: Seven-segment Displays Project Showing Current Count 4 14
Figure 2.17: Schematic Diagram of Two Seven-segment Displays Multiplexing Project
15
Figure 2.18: Schematic Diagram of Binary Coded Decimal to Seven-segment Display
Decoder/Driver IC Project 16
viii
Figure 2.19: Binary Coded Decimal to Seven-segment Display Decoder/Driver IC
Project Showing “00” When Switches Are 000000002 16
Figure 2.20: Schematic Diagram of 16×2 Liquid Crystal Display Module Interfacing in
8-bit Mode Project 17
Figure 2.21: 16×2 Liquid Crystal Display Module Interfacing in 8-bit Mode Project 17
Figure 2.22: Schematic Diagram of 16×2 Liquid Crystal Display Module Interfacing in
4-bit Mode Project 18
Figure 2.23: 16×2 Liquid Crystal Display Module Interfacing in 4-bit Mode Project 18
Figure 2.24: 16×1 Liquid Crystal Display Module Interfacing in 4-bit Mode Project 19
Figure 2.25: The 5 Characters to be Generated On the 8×8 LED Matrix Display 20
Figure 2.26: Schematic Diagram of 8×8 LED Matrix Display Interfacing Project 20
Figure 2.27: 8×8 LED Matrix Display Interfacing Project Showing the Fourth Character
21
Figure 3.1: Screen Shot of KiCad Project Manager 22
Figure 3.2: Screen Shot Eeschema Showing Drawing of 8×8 LED Matrix Display
Interfacing Project's Schematic Diagram 23
Figure 3.3: Screen Shot Eeschema Component Library Editor Showing Drawing for
New 8×8 LED Matrix Display Component 24
Figure 3.4: Screen Shot from the Introductory Chapter of the Documentation 24
Figure 3.5: Screen Shot of the Documentation for Blinking An LED Project 25
Figure 3.6: Screen Shot of Siliconetics BizAdmin for Blinking An LED Project 26
Figure 3.7: Screen Shot while Adding Pictures using Siliconetics BizAdmin for More
LEDs Project 27
Figure 4.1: ThinClient X300 System Showing the PCI Card and One of the Terminals 28
Figure 4.2: ThinStation Access Terminal 29
Figure 4.3: Performing Electrical Wiring, Inserting the Cable Puller to Pull the Electrical
Cables. 31
Figure 4.4: The End Product of Acrylic Sheet Shaping 32
ix
CHAPTER 1
INTRODUCTION
1.1 Host Company
Siliconetics Research Corporation Sdn. Bhd. (SRC) was officially registered on
2006. The company is an information and communication technology (ICT) and
research and development (R&D) based company. The company is located at Lot 8032-
T1, Bandar Satelit Islam Pasir Tumboh, Jalan Pasir Puteh, 16150 Kota Bharu,
Kelantan. The company can be reach via its website, http://www.srcsb.com.
Figure 1.1: The Corporate Logo of Siliconetics Research Corporation Sdn. Bhd.
The effort to establish the company started back in the 1990's where research
and development had been performed to establish a platform to develop software to be
used for educational purposes. This research and development process had started the
development of current technologies used by the company until today.
In 1996, a predecessor of SRC, a company named Perisian Mawar was
registered to develop and market Islamic based software. This company was later
rebranded as Mawarsoft, and is currently a part of Siloconetics Research Corporation
Sdn. Bhd..
In order to continue the legacy of Perisian Mawar and in order for the company
to develop and market other products while retaining the name of Mawarsoft to be
1
exclusively used for Islamic based products, SRC was established with the goal to
develop and market software to be used in other professional fields.
SRC is focused into research and development of products to be used for
professional fields such as accountancy, management, and network based technologies.
Since the beginning, SRC had developed various products according to clients'
specifications. The clients of SRC include government agencies, government linked
agencies, and private agencies. The experience earned by SRC since its establishment
had made the company mature and it now has its own technologies in the field of
multimedia, database and computer networking.
1.2 Organisation of the Company
The organisational chart of the company is as shown below.
Figure 1.2: Organisation Chart Siliconetics Research Corporation Sdn. Bhd.
1.3 Advantages of the Company
Siliconetics Research Corporation Sdn. Bhd. is fully committed into the research
and development of computer related technologies. This R&D covers the development
2
of computer software, development of customised system as requested by clients and
development of robotic systems.
Figure 1.3: Siliconetics Research Corporation Sdn. Bhd.
SRC is driven by quality and the constant R&D performed by the company
ensure that the quality of its product is well taken care of. With non-stop research and
development, SRC is able to improve its products and develop new products to meet the
ever-changing needs of the clients. This also triggered the development of company's
own technologies to be used in its products.
SRC is now proud of having its own technologies to be used in its range of
products and services. These technologies are termed “FlitBase”, used by all of its
database related technologies and products, and “Click Multimedia”, used for its
multimedia based products and services.
1.4 Products and Services
SRC offers a wide variety of products and services for its clients and customers.
These products can be categorised into several brands.
3
Figure 1.4: The Logo for Siliconetics Products
Siliconetics branded products are software or systems in the management,
administration and/or business field. Siliconetics products are designed to function in a
network and has 2 versions. The “Ant” version is the smaller version that support stand
alone usage on a single computer while the “Spider” version is client-server based and
is suitable to be used by organisations. All Siliconetics products include:
• Siliconetics Association Spider
• Siliconetics Asset Spider
• Siliconetics Government Asset Spider
• Siliconetics Payroll Spider/Ant
• Siliconetics Project Spider
• Siliconetics Accounting Spider/Ant
• Siliconetics Cash Spider/Ant
• Siliconetics Billing Spider/Ant
• Siliconetics Sales Spider/Ant
• Siliconetices Property Spider
• Siliconetics Timetable Spider/Ant
• Siliconetics Exam Spider/Ant
• Siliconetics Library Spider/Ant
• FlitSoft Click Author
• FlitSoft Media Spider
• Siliconetics BizAdmin – manages web pages hosted using BizGate Server
• Siliconetics FlitGate – Database server
• Siliconetics BizGate – HTML server
Figure 1.5: The Logo for Mawarsoft Products
4
Products bearing Mawarsoft nameplate are focused on Islamic contents. These
products are:
• Mawarsoft Qari CD
• Mawarsoft Qari Player
• Mawarsoft Digital Furqan
Another brand by SRC is Hitkr which is the name used exclusively for the
company's robotic products and system.
Beside software and robotic product, SRC also provide other services. These
services include:
• Supplying computer software. These computer software may come from other
manufacturer other than SRC if requested by the customer.
• Supplying computer devices and components as requested by the customer.
• Software or system development service as requested by the customer.
• PIC based system, device and/or components as requested by the customer.
• After sales services and training.
• Computer or robotic programming training.
• Development of websites as requested by the customer.
• Development of digital billboard system as requested by customer.
5
CHAPTER 2
PIC18 MICROCONTROLER PROJECTS
2.1 Introduction
Many tasks were assigned throughout the duration Industrial Training. These
tasks can be separated into 3 groups, namely the main tasks, secondary tasks, and other
miscellaneous tasks.
The main tasks involved PIC18 microcontroller system development projects.
These projects started from basic and simple blink a light emitting diode (LED) projet
and grew more advanced into interfacing with external devices.
2.2 PIC18 Microcontroller and the PIC18F2550
PIC is a group of microcontroller family that were developed by Microchip
Technology Inc. back in the late 1980’s. It is the successor of General Instrument’s
Peripheral Interface Controller developed in 1970’s. PIC has become known for being
low cost, containing various built-in peripherals, having small form factor and having
extremely good design support by the manufacturer and PIC user community.
The PIC18 is the family of the highest performance 8-bit microcontroller from
Microchip (the baseline and midrange 8-bit PIC family are the PIC10, PIC12 and
PIC16). PIC18 contained much more on-chip memory and other more advanced
peripherals. PIC18 was designed and optimised to be programmed in C programming
language.
6
Figure 2.1: PIC18F2550 in 28 Pins DIP Form Factor
The microcontroller to be used throughout the Industrial Training is PIC18F2550
packaged in 28-pin Dual In-line Package (DIP). Some of the features of PIC18F255 are
32kBytes Flash program memory (16k instruction word), 2kBytes data memory, 24
input/output pins with most of them are multiplexed with other functions, 10-channel 10
bit analog to digital converter, 2 Capture/Compare/PWM (CCP) modules, 4 timer
modules (one 8-bit timer and three 16-bit timers), 3 external interrupts, USB module, et
cetera. PIC18F2550 supports in-circuit programming and it has various safety and fail-
safe features built-into the chip.
Figure 2.2: Pin Assignment of PIC18F2550 in DIP Form Factor
As a member of PIC18 family means that PIC18F2550 shares many similarities
with other devices in PIC18 family. For example, the source code written for
PIC18F2550 can be used with other PIC18s with little or no modification and vice
versa.
2.3 Common Components and Devices
Other than the PIC18F2550 microcontroller, there are other components and
devices that is used throughout all the main projects. These components and devices are
explained below.
7
Figure 2.3: Microchip PICkit3
Developed by Microchip, the manufacturer of PIC, PICkit3 is the device used to
program PIC microcontroller chips with the source code written in MPLAB IDE.
Figure 2.4: Breadboard
Breadboard is a board used to construct temporary electrical circuits used for
testing and prototyping an electrical or electronic system. Jumper wires are used to
create electrical connection on the breadboard. Beside that, a 5-volt power supply unit is
required to provide the electrical energy to power up the system constructed on the
breadboard.
To write and download the source code for PIC18F2550, a computer is needed.
This computer must run MPLAB IDE software and MPLAB C18 C compiler from
Microchip. MPLAB IDE is an integrated development environment software tool that is
used to write the source code, built the PIC microcontroller application project and
interface with the PIC microcontroller. MPLAB IDE supports all PIC microcontroller
devices and has built-in functions to simulate the source code and download the source 8
code into the PIC connected to the computer via PICkit3. To program in C programming
language, a C compiler is required and Microchip had developed MPLAC C18 C
compiler to compile source code in C language for PIC18 microcontrollers. MPLAB
C18 is be fully integrated into MPLAB IDE.
Figure 2.5: Screenshot of the Splash Screen MPLAB IDE
MPLAB IDE must run on a computer and PICkit3 must be connected using
universal serial bus (USB) to a computer running MPLAB IDE. The computer used for
the main projects had the specification as follows.
• Intel Core Duo T2450 @ 2.00GHz processor
• 2.50GBytes of main memory
• 32-bit Microsoft Windows 7 Ultimate Service Pack 1 (6.1.7601 Build 7601) O/S
• MPLAB IDE version 8.85 with MPLAB C18 LITE version 3.36
2.4 Blinking an LED
The first project is nicknamed “Hello World” of microcontroller system. In this
project, an LED is connected to the PIC18F2550. The PIC18F2550 is to be downloaded
with program that will continuously send digital high and digital low signal out through
the output pin the LED is connected to to blink the LED. This is a simple project but it
is important as this is the platform to learn how to write C program for PIC18F2550 and
the basic of programming the PIC18F2550 microcontroller.
Components: 1 × Light emitting diode, 2 × 1kΩ resistor
9
Figure 2.6: Schematic Diagram of Blinking an LED Project
Figure 2.7: PICkit3 Connected to Program the PIC18F2550
Figure 2.8: Blinking an LED Project with the LED in On State
2.5 More LEDs
Second project is similar to the first project, but with 8 LEDs. All 8 LEDs are
connected to PORTB of PIC18F2550. The PIC18F2550 will send appropriate electrical
signals to these LEDs to generate light effect on the LEDs. First task is to write program
to blink all 8 LEDs. Next the program is edited to create different light effects on the
LEDs, such as blinking the LEDs alternately, leftward running light effect, rightward
10
running light effect, knight rider light effect, et cetera.
Components: 8 × Light emitting diode, 9 × 1kΩ resistor
Figure 2.9: Schematic Diagram of More LEDs Project
Figure 2.10: More LEDs Project Showing One of the Light Effects
2.6 Switches and LEDs
Next project is about input/output programming of PIC18F2550. In this project,
switches are used as input and is connected to PORTB of PIC18F2550. Output is in the
form of LEDs connected to PORTA and pin RC0 of PIC18F2550. Pin RC0 is used as
substitute for pin RA7 that is not available on PIC18F2550. The PIC18F2550 will read
the states of the switches and out put them to the LEDs. However, the LEDs is
connected in active-low configuration, thus PIC18F2550 has to invert the states from
the switches before output them to the LED.
11
Components: 8 × Light emitting diode (LED), 1 × 8-channel DIP switch array, 9 × 1kΩ
resistor, 1 × 8-channel SIP 1kΩ resistor
Figure 2.11: Schematic Diagram of Switches and LEDs Project
Figure 2.12: Switches and LEDs Project Showing Switches 2, 3, 7 and 8 Active
2.7 Switches and LED, Input/Output Control
This is a more advanced project, and this project combines Switches and LEDs
and More LEDs projects. In this project, the switches will determine which light effect
will be created on the LEDs. The state of the switches and the generated light effect is
as the table below.
Table 2.1: State of Switches and Light Effect
Active Switch Light Effect
1 Turn on all LEDs
2 Blink all LEDs
12
Table 2.1: Continue
3 Leftward running light effect
4 Rightward running light effect
8 Knight Rider light effect
Other conditions Turn off all LEDs
Components: 8 × Light emitting diode (LED), 1 × 8-channel DIP switch array, 9 × 1kΩ
resistor, 1 × 8-channel SIP 1kΩ resistor
Figure 2.13: Schematic Diagram of Switches and LEDs, Input/Output Control
Project
Figure 2.14: Switches and LEDs, Input/Output Control Project Showing Switch 8
Active Triggering Generation of Knight Rider Light Effect
2.8 Seven-Segment Displays
This is the first project involving external devices. Seven-segment displays are
used to display numerical data. Seven-segment displays are operated by providing
13
electrical signals that will turn the LEDs placed under each segments on the display. In
this project, PIC18F2550 will be interfacing directly with a 7-segment display to
continuously display counting sequence from 0 till 9. The bit sequence to interface with
the 7-segment display is stored in an array. The PIC18F2550 will enter a loop to count
from 0 till 9 and in every iteration PIC18F2550 will send the bit sequence in the array
that correspond to current count to the output port.
Components: 1 × common cathode seven-segment display, 2 × 1kΩ resistor
Figure 2.15: Schematic Diagram of Seven-segment Displays Project
Figure 2.16: Seven-segment Displays Project Showing Current Count 4
The lines of code that initialised the array with the bit sequence to interface with
the 7-segment display is included in Appendix A
2.9 Two Seven-segment Displays Multiplexing
This project used two seven-segment displays driven using the same port. The
14
common pin of both seven-segment displays are connected to RC0 and RC1, controlled
by PIC18F2550. In this project, the PIC18F2550 will read value from the switches, split
the value from the switches into two 4-bit nibbles and display the value of the upper
nibble on the left seven-segment display and the value of the lower nibble on the right
seven-segment display using look-up table array as in previous project.
This project went one step further by using the same port to interface with both
seven-segment displays. The common pin of both seven-segment displays functions as
enable pin to enable individual seven-segment display among the two. When sending
the bit pattern representing the value of upper nibble from the switches, PIC18F2550
will enable the left seven-segment display by sending digital low signal through RC1.
Likewise, when sending the bit pattern representing the value of lower nibble from the
switches, PIC18F2550 will enable the right seven-segment display by sending digital
low signal through RC0
Components: 2 × common cathode seven-segment display, 1 × 8-channel DIP switch
array, 3 × 1kΩ resistor, 1 × 8-channel SIP 1kΩ resistor
Figure 2.17: Schematic Diagram of Two Seven-segment Displays Multiplexing
Project
2.10 Binary Coded Decimal to Seven-segment Display Decoder/Driver IC
This project explored the use of binary-coded-decimal to seven-segment display
decoder/driver IC. BCD to 7-segment display decoder such as 7447 and 7448 ICs are
used to reduce the number of PIC18F2550's pins used and make 7-segment display
15
interfacing easier. Using a circuit similar to previous project, PIC18F2550 will only
send the value to be displayed on 7-segment display to BCD to seven-segment display
decoder and enable the required seven-segment display. This project should produce
same result as in two seven-segment displays multiplexing project.
Components: 1 × 7448 BCD to common cathode 7-segment display decoder, 2 ×
common cathode seven-segment display, 1 × 8-channel DIP switch array, 3 × 1kΩ
resistor, 1 × 8-channel SIP 1kΩ resistor
Figure 2.18: Schematic Diagram of Binary Coded Decimal to Seven-segment
Display Decoder/Driver IC Project
Figure 2.19: Binary Coded Decimal to Seven-segment Display Decoder/Driver IC
Project Showing “00” When Switches Are 000000002
16
2.11 16×2 Liquid Crystal Display Module Interfacing in 8-bit Mode
This project will make the PIC18F2550 interface with common 16×2
alphanumeric character LCD module in 8-bit mode. The PIC18F2550 will first initialise
the LCD module with the appropriate initialisation sequence for 8-bit interface mode.
Then the PIC18F2550 will sent the characters to be displayed on the LCD module one
by one. The flowchart of 8-bit mode initialisation is attached in Appendix B.
Components: 1 × 16×2 alphanumeric character liquid crystal display module, 1 × 1kΩ
resistor, 1 × 10kΩ potentiometer/variable resistor, 1 × pushbutton switch
Figure 2.20: Schematic Diagram of 16×2 Liquid Crystal Display Module
Interfacing in 8-bit Mode Project
Figure 2.21: 16×2 Liquid Crystal Display Module Interfacing in 8-bit Mode Project
17
2.12 16×2 Liquid Crystal Display Module Interfacing in 4-bit Mode
Unlike the previous project, this project will utilise 4-bit interface mode of the
LCD module to reduce the number of PIC18F2550's pins used. The PIC18F2550 will
first initialise the LCD module with the initialisation sequence for 4-bit interface mode.
Then the PIC18F2550 will sent the characters to be displayed on the LCD module one
by one. The flowchart of 4-bit mode initialisation is attached in Appendix B.
Components: 1 × 16×2 alphanumeric character liquid crystal display module, 1 × 1kΩ
resistor, 1 × 10kΩ potentiometer/variable resistor, 1 × pushbutton switch
Figure 2.22: Schematic Diagram of 16×2 Liquid Crystal Display Module
Interfacing in 4-bit Mode Project
Figure 2.23: 16×2 Liquid Crystal Display Module Interfacing in 4-bit Mode Project
18
2.13 16×1 Liquid Crystal Display Module Interfacing in 4-bit Mode
16×1 LCD module is slightly more complicated because the left 8 characters are
from line 1, while the right 8 characters are from line 2 of common 16×2 LCD module.
In this project, PIC18F2550 will interface with the 16×1 LCD module in 4-bit mode.
PIC18F2550 will first initialise the 16×1 LCD module with initialisation sequence for
4-bit mode. Then it will send the characters to be displayed one by one while at the
same time being careful when addressing the characters' position on the 16×1 LCD
module's screen.
Components: 1 × 16×1 alphanumeric character liquid crystal display module, 1 × 1kΩ
resistor, 1 × 10kΩ potentiometer/variable resistor, 1 × pushbutton switch
This project has the same schematic diagram as 16×2 LCD module interfacing in 4-bit
mode project.
Figure 2.24: 16×1 Liquid Crystal Display Module Interfacing in 4-bit Mode Project
2.14 8×8 LED Matrix Display Interfacing
The last project performed during the industrial training is to use pic18f2550 to
interface with an 8×8 led matrix display. Interfacing with an 8×8 led matrix display
requires the PIC18F2550 to send bit sequences to the 8×8 led matrix display row by
19
row. The characters can be generated by sending appropriate bit sequences that will
light-up the individual LEDs on the 8×8 led matrix display accordingly. The characters
to be generated in this project are as the figure below.
Figure 2.25: The 5 Characters to be Generated On the 8×8 LED Matrix Display
The lines of code that initialised the array with the bit sequence to generate the 5
characters and interface with the 8×8 LED matrix display is included in Appendix A
Components: 1 × 8×8 LED matrix display, 9 × 1kΩ resistor, 1 × pushbutton switch
Figure 2.26: Schematic Diagram of 8×8 LED Matrix Display Interfacing Project
20
Figure 2.27: 8×8 LED Matrix Display Interfacing Project Showing the Fourth
Character
21
CHAPTER 3
PIC18 PROJECTS' DOCUMENTATION
3.1 Introduction
The secondary task is about documenting and explaining everything done in the
main projects. Despite being a secondary tasks, these tasks takes up most of the time
spend during Industrial Training. These tasks require the use of software to draw the
schematic circuits and the need to take pictures of the main projects.
3.2 Schematic Diagram Drawing
One of the activities done as secondary task is to draw the schematic diagrams
for all of the main projects. A computer aided drafting (CAD) tool is required to draw
the schematic diagrams and to make the diagrams look more presentable.
Figure 3.1: Screen Shot of KiCad Project Manager
22
The CAD tool used for this purpose is KiCad EDA Suite. KiCad is an open
source software suite for electronic design automation (EDA) made for designing
schematics of electronic circuits and printed circuit boards (PCB). KiCad is developed
by the KiCad Developers Team, and features an integrated environment with schematic
capture, bill of materials list, PCB layout and much more. [1]
Since KiCad software tool is a new exposure, first step is to learn to operate this
software. KiCad starts up as a project manager that will launch other software tool
depending on the task to be performed. To draw schematic diagrams, only Eeschema
software is used. Second step is to learn how to draw schematic diagrams in Eeschema.
Previous experience with other CAD software tools or software suite such as the Altera
Quartus II is very helpful.
Figure 3.2: Screen Shot Eeschema Showing Drawing of 8×8 LED Matrix Display
Interfacing Project's Schematic Diagram
Eeschema has all commonly used components preloaded, however some
component such as the 8×8 LED matrix display is not available in its default library,
thus this component has to be custom-made using the Eeschema Component Library
Editor.
23
Figure 3.3: Screen Shot Eeschema Component Library Editor Showing Drawing
for New 8×8 LED Matrix Display Component
When the schematic diagrams are done, they can be plotted (copied) to clipboard
to be used with other application software.
3.3 Documenting PIC18F2550 Projects
For every PIC project completed, it had to be documented for future reference.
The documentation is done using a word editor such as Microsoft Office Word.
Figure 3.4: Screen Shot from the Introductory Chapter of the Documentation
24
The documentation includes an introductory chapter to explain the what this
documentation is about, the PIC and PIC18F2550, the PICkit3, MPLAB IDE and
MPLAB C18, the C programming language to be used, and other related informations.
Figure 3.5: Screen Shot of the Documentation for Blinking An LED Project
The documentation for all of the PIC18 projects done must have the following
informations.
• Introduction – introduces about the project and what is the expected project's
outcome.
• List of Components – a list of all the components used in the projects. This part
also explain in detail about the components used, for example, how to used an
LCD module, its initialisation sequence and its instruction set, and how to use
and interface the PIC18F2550 with the components.
• The Circuit – shows the schematic diagram of the project being documented.
This part also explain how to construct the circuit shown in the schematic
diagram.
• The Steps – explains step by step the procedures to do the project. This part also
explain how to write the source code and what the source code do to the system.
• Known Issues – discussions about the possible issues that will arise while doing
the project.
• Source Code – the source code for the project being documented is included
25
here.
• Appendix – extra informations about the project and pictures of the complete
project.
3.4 Update Hitkr Website using BizAdmin
The third task included as the secondary task is to update the website of
http://www.hitkr.com.my/ with the project that had been performed. The website is
hosted on the company's web server that runs Siliconetics BizGate.
To update the webpage hosted using Siliconetics BizGate, the Siliconetics
BizAdmin is needed. The supervisor had first explained how to use Siliconetics
BizAdmin to upload new post and add pictures to the website.
Figure 3.6: Screen Shot of Siliconetics BizAdmin for Blinking An LED Project
26
Figure 3.7: Screen Shot while Adding Pictures using Siliconetics BizAdmin for
More LEDs Project
27
CHAPTER 4
MISCELLANEOUS TASKS
4.1 Introduction
Miscellaneous tasks are the tasks assigned that are not related to the main
projects and the secondary tasks.
4.2 ThinClient and ThinStation
ThinClient and ThinStation are computer networking devices that will utilise a
computer's resources to its maximum potential by sharing the host computer's resources
with other users at the same time.
Figure 4.1: ThinClient X300 System Showing the PCI Card and One of the
Terminals
The first task is to troubleshoot a ThinClient system. There are no documentation
28
and driver CDs available for the system. A ThinClient X300 system consist of a PCI
card and 3 access terminals. The 3 access terminals is connected to the PCI card via
straight-through cables.
Closer inspection on the PCI card revealed the manufacturer of the system,
which is NComputing. Browsed the website of NComputing for the drivers and other
related documentations. Searched the support and community site of NComputing and
the search returned that ThinClient X300 do not has driver for Windows 7 operating
system, support is only available for Windows XP operating system.
Figure 4.2: ThinStation Access Terminal
ThinStation is similar to ThinClient that it provide service to allow multiple
access to single computer resources to share the resource among multiple users. Unlike
ThinClient that uses a PCI card to provide the access, ThinStation accesses the server
computer through local area network (LAN). ThinStation has Windows CE installed and
this operating system will be loaded whenever the system is switched on. Access to
server computer is via Remote Desktop Connection service available by latest Windows
operating systems.
The task is to learn to use this system and develop an operating procedure to use
ThinStation system. First step is to create multiple user accounts on the computer that
will function as the server where ThinStation will access to. Next step is to run Remote
Desktop Connection service to request connection to the host computer b providing
correct username and password. This is where a problem arose.
29
ThinStation has no CMOS battery as in normal computers. This caused
ThinStation to revert to reset its time whenever it is switch on. Remote Desktop
Connection request will be turned down by the host computer if the time difference
between the requesting ThinStation system and the host computer is too large.
Therefore, the ThinStation's system time had to be configured before requesting access
via Remote Desktop Connection. When the time of the ThinStation system is
configured, and the provided username and password is correct, the host computer sill
grant access to ThinStation as the newly signed-in user.
4.3 Software Disc Packaging
The company produces software packaged in CDs and DVDs. These discs has to
be pack into proper packaging before the software discs is sent into the market.
Software discs packaging are performed from time to time and this process is done by
hand. Trainees are exposed to the methods used by small-scale companies to package
CDs and DVDs.
First of all, the new software discs need to be place into a CD/DVD case. Second
the labels of the software discs are added to the CD/DVD case. Then the software discs
in the CD/DVD case will be warped with the CD/DVD case jacket that contains
informations about the software discs. Next, this discs warped in CD/DVD case jacket
warping is inserted into a plastic film warping to protect the content from dusts and
improve its look. Once the discs is inserted into the plastic film warping, this plastic
film is sealed using a sealer. Once the plastic film warping is properly sealed, hot air is
blown to the plastic film to make the warping contract and tightly warp the content
inside. Then the end product will be checked for quality before it is placed into a box for
shipment.
4.4 Electrical Wiring
Another task done during the Industrial Training is to perform electrical wiring
around the company. The company is planning to add more computers and more plug
30
points are needed. The task is to wire electric cables to marked points where the new
computers will be placed.
Figure 4.3: Performing Electrical Wiring, Inserting the Cable Puller to Pull the
Electrical Cables.
Accurate measurements are taken before starting. Then the PVC pipes to be used
is measured and cut accordingly. Next, several holes are drilled into the wall to mount
the sockets and PVC pipes. The PVC pipes are also bended as needed. The sockets and
PVC pipes are then mounted to the wall. To pull the electrical cables through the PVC
piping, a cable puller is first inserted into the PVC pipes, then the electrical cables are
slowly pulled through the PVC piping. Final step is to strip the cables and fasten them
into the 3-pin plug socket points. The connection is tested for all plug points the check
for connectivity.
4.5 Acrylic Prototyping
One of the procedure while developing a new system is to build a prototype.
Acrylic sheet is one of the commonly used material for building prototypes. This task is
to expose to the basic of forming an acrylic sheet to build a prototype.
First of all, measurements had to be taken and marking of to cut and bend the
acrylic sheet is performed. Based on the marking of where the acrylic sheet is to be cut,
the sheet is scored using a scoring knife. The cut must be straight. Then the acrylic sheet
31
is break along the marking and the groove that was made when scoring the sheet. Once
the acrylic sheet is cut/broken, it can be bent into the desired shape. To bend the sheet
along the marking, a hot air blower is used to heat up and soften the acrylic sheet along
the line it will be bent. When the acrylic is soft enough, it can be bent easily. Bending of
the acrylic sheet is repeated on other markings to create the desired shape.
Figure 4.4: The End Product of Acrylic Sheet Shaping
4.6 Visit by Lecturer from UniMAP
On 14th August 2012 at 10.30am, Associate Professor Dr. Mohammud B. Che
Husain paid a visit to the company to check on my progress during Industrial Training.
A presentation is made, followed by discussion of what had been done during Industrial
Training.
32
CHAPTER 5
DISCUSSION AND RECOMMENDATION
5.1 Discussion
The projects from main task during Industrial Training used the PIC18F2550
microcontroller. This microcontroller technology is not taught in the School of
Computer and Communication Engineering. Thus the PIC18 is a new technology that I
learnt during Industrial Training at Siliconetics Research Corporation Sdn. Bhd.
Despite being unfamiliar with the PIC18, the Internet is a good source of
information about PIC18 and a book by Mazidi, M. A. (2008) titled “PIC
Microcontroller And Embedded Systems Using Assembly and C for PIC18” is a good
reference to learn PIC. Furthermore, although PIC has different architecture compare to
the microcontroller and microprocessor devices taught by SCCE, the same basic of
programming a microcontroler or microprocessor system is still the same.
The use of C programming language in writing the source code for programming
the PIC18F2550 makes programming easier. However this will require a C compiler
that is designed to compile the source code of PIC18. The drawback of using C
programming for this purpose is the lack of direct control of the microcontroler.
Programmer will limited access to certain function of the microcontroller compared to
programming in assembly language.
Documenting a project can be seen as an important task beacuse it can be used
as future reference.
33
5.2 Recommendation
Some of the courses taught in the university is using the technologies that is
considered outdated by the industry. The university should at least expose the students
to the use of latest technologies used in the industry to prepare the students for working
world.
34
CHAPTER 6
CONCLUSION
6.1 Conclusion
Throughout the Industrial Training, many knowledge and experiences had been
gained. Knowledge about microcontroller devices other than the 8085 microprocessor
learnt in UniMAP showed that even with different devices with different architectures,
the basics learnt by using 8085 is still applicable. Beside that, the use of PIC18 has
many benefit as it is one of the widely used microcontroller technology in the market.
The use of C programming language to program the PIC showed that the knowledge
gained during the first year is not to be wasted as it can be used in future years.
Experiences gained throughout the Industrial Training showed that the training is
beneficial to train a student with the right attitude while working.
In a nutshell, the training stint at Siliconetics Research Corporation Sdn. Bhd.
for 12 weeks has many benefit. The exposure to current and latest technology, and the
new knowledge and experiences gained while undergoing Industrial Training is not to
be wasted and it can be used in the future.
35
REFERENCES
[1] KiCad, (2012). About KiCad, http://www.kicad-
pcb.org/display/KICAD/About+KiCad, 5 September 2012 : 09:40am.
[2] Mazidi, M.A., McKinlay, R.D. and Causey, D. (2008). PIC microcontroller and
embedded systems using assembly and C for PIC18, Pearson Education, Upper Saddle
River, NJ.
36
Appendix A (i): Array Initialisation of Bit Pattern For Common Cathode Seven-Segment Display Interfacing
const char seg7 [10] = { 0x3F, //bit pattern for number 0
0x06, //bit pattern for number 1
0x5B, //bit pattern for number 2
0x4F, //bit pattern for number 3
0x66, //bit pattern for number 4
0x6D, //bit pattern for number 5
0x7D, //bit pattern for number 6
0x07, //bit pattern for number 7
0x7F, //bit pattern for number 8
0x67 //bit pattern for number 9
};
37
Appendix A (ii): Array Initialisation of Bit Pattern For 8×8 LED Matrix Display Interfacing
unsigned char characters[NUMCHAR][8] = { {0x18, 0x38, 0x78, 0xff, //left arrow
0xff, 0x78, 0x38, 0x18},
{0x18, 0x3c, 0x7e, 0xff, //up arrow
0xff, 0x18, 0x18, 0x18},
{0x18, 0x1c, 0x1e, 0xff, //right arrow
0xff, 0x1e, 0x1c, 0x18},
{0x00, 0x66, 0xff, 0xff, //heart shape
0x7e, 0x3c, 0x18, 0x00},
{0b00000000, //smiley
0b01100110, //using binary
0b01100110,
0b10000001,
0b11000011,
0b01111110,
0b00111100,
0b00000000}
};
38
Appendix B (i): Flowchart of Initialisation Sequence of LCD Module for 8-bit Interface Mode
39
Appendix B (ii): Flowchart of Initialisation Sequence of LCD Module for 4-bit Interface Mode
40
Appendix C: C Program for 16×1 LCD 4-Bit Interfacing//C program for interfacing with 16x1 LCD module in 4-bit mode to display //text string “Hello World” centred on the screen#include <p18f2550.h>
#pragma config FOSC = INTOSCIO_EC //Internal oscillator, port function on RA6, EC used by USB #pragma config WDT = OFF //Disable watchdog timer#pragma config LVP = OFF //Disable LVP
#define lcd_rs LATBbits.LATB0 //label LATC2 as lcd_rs#define lcd_rw LATBbits.LATB1 //label LATC6 as lcd_rw#define lcd_en LATBbits.LATB2 //label LATC7 as lcd_en#define lcd_db LATB //label LATB as lcd_db
void delay(unsigned int); //prototype of delay() functionvoid lcd_cmd4(unsigned char); //prototype of lcd_cmd4() functionvoid lcd_dat4(unsigned char); //prototype of lcd_dat4() functionvoid lcd_init4(); //prototype of lcd_init4() function
void main(){ TRISB = 0x00; //PortB as output
lcd_init4(); //initialise LCD
lcd_cmd4(0x82); //set position 3 of line 1 (left half of LCD)lcd_dat4('H'); //send 'H' to LCDdelay(1); //short delaylcd_dat4('e'); //send 'e' to LCDdelay(1);lcd_dat4('l'); //send 'l' to LCDdelay(1);lcd_dat4('l'); //send 'l' to LCDdelay(1);lcd_dat4('o'); //send 'o' to LCDdelay(1);lcd_dat4(' '); //send ' ' (space character) to LCD
lcd_cmd4(0xC0); //set position 0 of line 2 (right half of LCD)lcd_dat4('W'); //send 'W' to LCDdelay(1);lcd_dat4('o'); //send 'o' to LCDdelay(1);lcd_dat4('r'); //send 'r' to LCDdelay(1);lcd_dat4('l'); //send 'l' to LCDdelay(1);lcd_dat4('d'); //send 'd' to LCDdelay(1);lcd_dat4('!'); //send '!' to LCDdelay(1);
while (1);}
void lcd_init4(){ delay(15); //initial delay
lcd_cmd4(0x03);delay(5);lcd_cmd4(0x33); //8 bit, 2 lines, 5x7 font (system set)
41
Appendix C: C Program for 16×1 LCD 4-Bit Interfacinglcd_cmd4(0x32); //8 bit, 2 lines, 5x7 font (system set)
lcd_cmd4(0x28); //4 bit, 2 lines, 5x7 font (system set)lcd_cmd4(0x0E); //display on, cursor on, blinking(display)lcd_cmd4(0x01); //clear displaylcd_cmd4(0x06); //inc address, no shift(entry mode set)delay(1);
}
void lcd_cmd4(unsigned char commd){ unsigned char cmdhi, cmdlo;
cmdhi = commd & 0xF0; //store upper nibble in cmdhicmdlo = (commd << 4) & 0xF0; //store lower nibble in cmdlolcd_en = 0; //en initially lowlcd_rs = 0; //select command registerlcd_rw = 0; //to write command to lcd
lcd_db = cmdhi | 0b00000100; //place high nibble command and en highlcd_db = cmdhi | 0b00000000; //place high nibble command and en low
//(to activate LCDdelay(1); //delay for normal processing
lcd_db = cmdlo | 0b00000100; //place low nibble command and en highlcd_db = cmdlo | 0b00000000; //place low nibble command and en low
//(to activate LCD)// delay(1); //delay for processing}
void lcd_dat4(unsigned char datum){ unsigned char dathi, datlo;
dathi = datum & 0xF0; //store upper nibble in dathidatlo = (datum << 4) & 0xF0; //store lower nibble in datlolcd_en = 0; //en initially lowlcd_rs = 1; //select data registerlcd_rw = 0; //to write command to lcd
lcd_db = dathi | 0b00000101; //place high nibble command and en highlcd_db = dathi | 0b00000001; //place high nibble command and en low
//(to activate LCD)delay(1); //delay for processing
lcd_db = datlo | 0b00000101; //place low nibble command and en highlcd_db = datlo | 0b00000001; //place lwo nibble command and en low
// (to activate LCD)delay(1); //delay for processing
}
void delay(unsigned int passed){ unsigned int j, k;
for (j=0;j<passed;j++)for (k=0;k<10;k++);
}
42
Appendix D: Documentation for 8×8 LED Matrix Display Project
CHAPTER 3
Project 6
LED Matrices
Introduction
Another interesting display device that is commonly used is the LED matrix display.
This device is versatile and can be used to display any desired characters when
configured properly. It is also easy to use as it is built using only light emitting diodes
(LEDs) and internal connectors. LED matrix displays vary greatly in size according to
user’s preferences. The size of LED matrices ranges between as small as 4×4 and up
until as large as desired by the user that may contain more that thousands of individual
LEDs. The difference in size does not matter once the basic of interfacing with a LED
matrix in understood.
In this project, 8×8 LED matrix will be used to demonstrate how to interface with an
LED matrix to display 5 different characters.
When connecting and controlling external devices or peripherals, data are transmitted
using wires from output port of the microcontroller to specific pins on the external
devices. The pin assignment of the external device or peripheral plays important role
and different external devices has different number of pins and different pin
assignments. Understanding the function of each pins of the external devices is crucial,
thus it is advisable to refer to the datasheet of the external devices whenever it is to be
used before connecting to the PIC18.
Components
Computer with MPLAB IDE and MPLAB C18 installed
PICkit3 Debugger/Programmer with USB connector
43
Appendix D: Documentation for 8×8 LED Matrix Display Project
5V power supply
Breadboard (Protoboard)
PIC18F2550
1 × 1kΩ resistor
8 × 330Ω resistor
1 × 8×8 LED matrix display
Jumper wires
LED matrix is a display device that is made up from many individual light emitting
diodes (LEDs) arranged in a matrix. This matrix can be in any size and there is no
restriction on what is the maximum size of the LED matrix. The LED matrix functions
just like an ordinary LED, it will light up when appropriate electrical current is applied
to the LED at the correct polarity. The basic construction of a 4×4 LED matrix is similar
to the figure below.
Figure 3.6.1: The Internal Circuitry of a 4×4 LED matrix
As shown above, the anodes of the LEDs placed in the same row are connected
together. The anodes of the LEDs at first row is connected to pin R1, the anodes of the
LEDs at second row is connected to R2 and so on. The same goes to the cathodes of the
LEDs. The cathodes of the LEDs at first column is connected to C1, the cathodes of the
LEDs at second column is connected to C2 and so on. The construction of almost all
LED matrix displays is the same as above, with slight variation. Some LED matrix
display vary in a way that the polarity of the internal LEDs are reversed with respect to
the diagram above, which mean that the anodes are connected to columns and cathodes
are connected to rows.
Different manufacturer has different configuration for their LED matrix displays and the
variety of sizes of LED matrix display available means that there are no standard pin
assignments for LED matrix displays. For example, let us take 2 different 8×8 LED
matrix displays and compare.
44
Appendix D: Documentation for 8×8 LED Matrix Display Project
The first 8×8 LED matrix display has a total of 16 pins with 8 pins at each side. The
second 8×8 LED matrix display on the other hand has a total of 24 pins with 12 pins at
each side. That is more pins than needed for an 8×8 as only 8 pins for the rows and 8
pins for the column is enough to interface with the LED matrix display.
Figure 3.6.2: Two Different 8×8 LED matrix displays
Figure 3.6.3: The Back View of Two 8×8 LED Matrix Displays. The First LED
Matrix Display (Left) Has 16 Pins While the Second (Right) Has 24 Pins
As mentioned previously, both of these 8×8 LED Matrix Displays has different pin
number, thus different pin assignments. There are no markings on both displays to
indicate the functions of their pins or the polarity of the pins and the individual LED
inside of them. Therefore users have to determine the polarity of the pins and how the
pins are connected to the internal LEDs. To makes things easier, assume that row pins
are connected to anodes and column pins are connected to cathodes. A method that can
be used to determine the pins’ functions and polarity on a LED matrix display is to
45
Appendix D: Documentation for 8×8 LED Matrix Display Project
supply power (VDD/VCC) and ground (VSS/GND) to the pins and see which LED lights up
on the display. A multimeter with diode test function may also be used to determine the
pins’ function and polarity of the LED matrix displays.
Figure 3.6.4: Testing the First LED Matrix Display Using a Multimeter with Diode
Test Function that Turns On the LED at Position Row4, Col6
Figure 3.6.5: Testing the Second LED Matrix Display Using a Multimeter with
Diode Test Function that Turns On the LED at Position Row5, Col6
Once the pins’ function and polarity are figured out, the LED matrix display can be used
to display any character that fits into its size. To turn on LEDs on the LED matrix
display, an electrical supply signal with appropriate polarity has to be applied to the
appropriate column and row pins. To turn on all individual LEDs on the matrix display,
supply power (VDD/VCC) to all row pins and ground (VSS/GND) to the column pins
46
Appendix D: Documentation for 8×8 LED Matrix Display Project
Figure 3.6.6: All LEDs of the Two 8×8 LED Matrix Displays are Turned On
After testing both LED matrix displays, both displays have the pin assignments shown
below. Note that with the pin assignment as below, users can turn the matrix displays
around and the pin assignments are still the same. The row pins are anode and the
column pins are cathode.
Figure 3.6.7: Pin Assignments of Two 8×8 LED Matrix Displays. The First LED
Matrix Display (Left) Has 16 Pins While the Second (Right) Has 24 Pins
All LED matrix displays function in a similar way.
The Circuit (Schematic Diagram)
To build the circuit according to the circuit diagram shown below,
First connect the power pins of the PIC (VDD and VSS) to the power source and GND.
Connect to a 1kΩ pull-up resistor as in the previous projects. Then connect to a
push button switch before connecting the push button switch to ground. This will
function as a Master Clear reset switch for the PIC. The PIC will be reset when the
push button switch is pressed (Master CLear Reset).
Connect all the pins of PORTB to the row pins of the 8×8 LED matrix display. The
RB0 pin of PIC18F2550 is connected to R1 of the ×8 LED matrix display, the RB1
pin to R2 pin, RB2 pin to R3 and so on.
Connect all the pins of PORTA to column pins of the 8×8 LED matrix display. Since
PORTA has only 7 pins but there are 8 column pins on the 8×8 LED matrix display,
47
Appendix D: Documentation for 8×8 LED Matrix Display Project
pin RC0 will be used to substitute as the eighth pin of PORTA (RA7). The RA0 pin of
PIC18F2550 is connected to C1 of 8×8 LED matrix display, pin RA1 to C2 and so
on till the last pin RA6 to C7. Lastly connect RC0 of PIC18 to C8 of the LED matrix
display.
To avoid burning the LEDs on the LED matrix display, pins of PORTA and RC0
should be connected to a resistor before connecting it to the column pins of the
LED matrix display.
The 8×8 LED matrix display used for this circuit is same as the first 8×8 LED matrix
display discussed above.
Schematic 3.5: Circuit Diagram to Interface with a 8×8 LED Matrix Display
Steps
48
Appendix D: Documentation for 8×8 LED Matrix Display Project
1. Construct the circuit according to the schematic diagram. Below is an example of
the circuit.
Figure 3.6.8: The Circuit Constructed on Breadboard with the 8×8 LED
Matrix Display Removed. The Red Dots Mark Where the Pins of the
8×8 LED Matrix Display Will Be Plugged-In To.
Figure 3.6.9: The Circuit Constructed on Breadboard with the 8×8 LED
Matrix Display in Place
49
Appendix D: Documentation for 8×8 LED Matrix Display Project
2. Open MPLAB IDE. Create a new project using Project Wizard. Navigate to
current project’s directory and add a .c file to the project.
3. This program will interface with the 8×8 LED Matrix Display to continuously
display 5 different characters in a sequence as below. The characters are displayed
on the 8×8 LED Matrix Display by creating the dots row by row. But this is done in
high speed such that the human eyes will see that all the dots are turned on at the
same time.
Figure 3.6.10: The Sequence from (Left to Right) of the Characters to
Be Displayed on the 8×8 LED Matrix Display
4. The program should first initialise the PIC with appropriate settings and
configurations. Then it will create an array to store the bit pattern to turn on the
individual LEDs on the matrix row by row. After that the program will enter a loop
that will continuously display the characters forever.
a. First setup the PIC with necessary configurations by adding the appropriate
#include, #pragma, function prototypes and other initialisation codes to the
.c file. There will be a function that will interface with the 8×8 LED matrix
display in this program.
#include <p18f2550.h>
#pragma config FOSC = INTOSCIO_EC //Internal oscillator, port
//function on RA6, EC used by USB
#pragma config WDT = OFF //Disable watchdog timer
#pragma config LVP = OFF //Disable LVP
#define NUMCHAR 5 //define number of characters
void dispMat(unsigned char, unsigned char); //function prototypes
void main()
{
}
50
Appendix D: Documentation for 8×8 LED Matrix Display Project
b. Next create an array that will be initialised with the bit patterns of all 8 rows
of the 8×8 LED matrix display for 5 characters. This will be a 2-dimensional
array of 5×8. The array will has a total of 5 characters and 8 rows per
character. This array can be written in binary or hexadecimal. Every value in
the array is the bit pattern of which LED of the row has to be turned on to
build the character. The position of 0 in the value is where the LEDs will not
be turned on and position of 1 is where the LEDs will be turned on for any
given row. All characters have 8 rows. Below is the array to create the
characters in the sequence stated in step 3.
unsigned char characters[NUMCHAR][8] = {
{0x18,0x38,0x78,0xff, //left arrow
0xff,0x78,0x38,0x18}, //using hexadecimal
{0x18,0x3c,0x7e,0xff, //up arrow
0xff,0x18,0x18,0x18},
{0x18,0x1c,0x1e,0xff, //right arrow
0xff,0x1e,0x1c,0x18},
{0x00,0x66,0xff,0xff, //heart shape
0x7e,0x3c,0x18,0x00},
{0b00000000,0b01100110,//smiley
0b01100110,0b10000001,//using binary
0b11000011,0b01111110,
0b00111100,0b00000000}
}; //array of bit patterns for
// the 5 characters
c. In the main function, declare the variables to be used, and specify the
direction of our data on PORTA, PORTB and RC0. Add the following line into
the main function.
unsigned char cntr; //variables declaration
unsigned char outR; //indicate which row is active
unsigned char cntrR; //count number of row, maximum 8
unsigned char selChar; //count which character to be displayed
TRISA = 0x00; //PortA as Output
TRISB = 0x00; //PortB as Output
TRISCbits.TRISC0 = 0; //PortC.RC0 as Output
//initialise the declared variables
outR = 0x01; //start from row1
selChar = 0; //start with 1st character;
d. The operations should continue indefinitely. A loop forever structure is
needed
51
Appendix D: Documentation for 8×8 LED Matrix Display Project
while(1) //loop forever
{
}
e. In the loop, create a for loop that will loop through the characters stored in
the array created in step 4(b).
for(selChar=0;selChar<NUMCHAR;selChar++)//loop between characters
{
}
f. In the for loop, create another for loop that will loop through every row of
the bit pattern. This loop will call a function dispMat() that will interface
with the 8×8 LED matrix display by sending the bit pattern of current row
pointed by selChar and cntrR variables. This loop will also activate next
row after the bit pattern of current row is sent to the LED matrix display
through dispMat().
//to turn on LEDs of current row and activate next row
for(cntrR=0;cntrR<8;cntrR++)
{ //call function to interface with the 8x8 LED matrix display
//send the characters pointed by selChar and cntrR variables in
//the array and which row will be activated to dispMat
dispMat(characters[selChar][cntrR],outR);
//activate next row
outR=outR<<1;
}
//start with column1 again
outR = 0x01;
g. After exiting this loop, the variable outR that indicates which row to be
activated has to be reset to start from R1 again.
h. Next is to create define the dispMat() function. This function will accept
the bit pattern of which LED of a given row to be turned on and the pattern of
which row need to be turned on. Remember that PORTB of PIC18F2550 is
connected to row pins of the 8×8 LED matrix display and PORTA (and RC0)
of PIC18F2550 is connected to the column pins of the LED matrix display
which is active low.
i. dispMat()has to format the information passed from function call to
interface with the 8×8 LED matrix display. The bit pattern to be sent to
52
Appendix D: Documentation for 8×8 LED Matrix Display Project
column pins for each active row has to be inverted as the column pins are
active low. Study the function definition below.
//receive which row and which LED of the row to be turned on
//format the received data and send to 8x8 LED matrix display
void dispMat(unsigned char passA, unsigned char passB)
{ unsigned char outA;
//the column are active low,
//invert data passed by function call
outA=~passA;
//send row data
PORTB = passB;
//send column data on RC0 when RA7 should be on
PORTA = outA;
if(outA >= 0x80) //check status of RA7
{ PORTCbits.RC0 = 1; //on RC0 if RA7 on
}
else
{ PORTCbits.RC0 = 0; //off RC0 if RA7 off
}
}
5. Build All the project. Correct any error that occurred in the project and the
source code.
6. Select the PICkit3 as the programmer to be used and set the build configuration to
Release. Build the project again.
7. Connect the PICkit3 to the USB port of your computer and to the PIC. Make sure
that the pins of the PICkit3 are connected to the proper pins on the PIC18F2550.
Switch on the power supply. MPLAB IDE will detect the PICkit3 and the PIC
connected to it. Make sure that the PIC device attached to the PICkit3 is the same
device we had configured in above steps (PIC18F2550). Click OK at the Voltage
Caution dialog box that appears.
8. Download the program we had written into the PIC18F2550. Observe the output.
53
Appendix D: Documentation for 8×8 LED Matrix Display Project
9. At this point you may not see any pattern or characters shown on the 8×8 LED
matrix display and all LEDs seem to be turned on. Add the following lines of codes
highlighted in yellow into the exact position as below. This lines of codes will force
the program the continuously generate each characters 150 times before changing
to next character in the sequence. It will also functions as a form of delay for every
characters.
for(selChar=0;selChar<NUMCHAR;selChar++) //loop between characters
{ //continously turn on LEDs row by row 150 times function as delay
//for each of the characters
for(cntr=0;cntr<150;cntr++)
{ //to turn on LEDs of current row and activate next row
for(cntrR=0;cntrR<8;cntrR++)
{ //call function to interface with 8x8 LED matrix display
//send the characters pointed by selChar and cntrR
//variables in the array and
// which row will be activated to dispMat
dispMat(characters[selChar][cntrR],outR);
//activate next row
outR=outR<<1;
}
//start with row1 again
outR = 0x01;
}
}
10. Build All the project and download the source code again. Observe the result.
11. Do changes to the array that stores the bit sequence to include your own character
design. Build All the project and download the source code again. Observe
that your own characters are displaying properly.
12. Change the condition of the statement for(cntr=0;cntr<150;cntr++) to
change the duration for each character to be displayed on the LED matrix display.
Known Issues
1. The characters displayed on the 8×8 LED matrix display is mirrored left to right
54
Appendix D: Documentation for 8×8 LED Matrix Display Project
a. When storing the bit sequence of the LEDs to be turned on in the array, we
assume the LSB is at the right side of the string and the MSB is at the left side
of the string which is more natural to be looked at when coding. However the
LSB of PORTA is actually connected to C1 which is located at the left side of
the display and RC0 (MSB of PORTA) is connected to C8 located at the right
side of the display. This caused the mirroring of the character displayed on the
8×8 LED matrix display.
b. Change bit sequence of the LEDs to be turned on in the array so that the bit
sequence is the mirrored version of the original bit sequence. Or
c. Change the circuit such that RA0 is connected to C8, RA1 to C7 and so on till
lastly RC0 is connected to C1. Or
d. Add into the program a function that will produce the mirrored version the bit
sequence. Add the function call to this function right before sending the bit
sequence to the 8×8 LED matrix display. (This method is included into the
attached .c file below.)
The .c File
#include <p18f2550.h>
#pragma config FOSC = INTOSCIO_EC //Internal oscillator, port function on RA6
#pragma config WDT = OFF //Disable watchdog timer
#pragma config LVP = OFF //Disable LVP
#define NUMCHAR 5 //define number of characters
void dispMat(unsigned char, unsigned char); //function prototypes
unsigned char mirrorByte(unsigned char);
unsigned char characters[NUMCHAR][8] = { {0x18,0x38,0x78,0xff, //left arrow
0xff,0x78,0x38,0x18}, //using hexadecimal
{0x18,0x3c,0x7e,0xff, //up arrow
0xff,0x18,0x18,0x18},
{0x18,0x1c,0x1e,0xff, //right arrow
0xff,0x1e,0x1c,0x18},
{0x00,0x66,0xff,0xff, //heart shape
0x7e,0x3c,0x18,0x00},
{0b00000000, //smiley
0b01100110, //using binary
0b01100110,
55
Appendix D: Documentation for 8×8 LED Matrix Display Project
0b10000001,
0b11000011,
0b01111110,
0b00111100,
0b00000000}
}; //the characters
void main() //main function
{ unsigned char cntr, outR; //variables declaration
unsigned char cntrR, selChar;
TRISA = 0x00; //PortA as Output
TRISB = 0x00; //PortB as Output
TRISCbits.TRISC0 = 0; //PortC.RC0 as Output
//initialise the declared variables
outR = 0x01; //start from row1
selChar = 0; //start with 1st character
while(1) //loop forever
{ for(selChar=0;selChar<NUMCHAR;selChar++) //loop between characters
{ //continously turn on LEDs row by row 150 times function as delay
//for each of the characters
for(cntr=0;cntr<150;cntr++)
{ //to turn on LEDs of current row and activate next row
for(cntrR=0;cntrR<8;cntrR++)
{ //call function to interface with 8x8 LED matrix
//display send the characters pointed by selChar
//and cntrR variables in the array and
// which row will be activated to dispMat()
dispMat(characters[selChar][cntrR],outR);
//activate next row
outR=outR<<1;
}
//start with row1 again
outR = 0x01;
}
}
}
}
//receive which row to activate and which LED of the row to be turned on
//format the received data and send to 8x8 LED matrix display
void dispMat(unsigned char passA, unsigned char passB)
{ unsigned char outA;
//the column are active low, invert data passed by function call
outA=~passA;
56
Appendix D: Documentation for 8×8 LED Matrix Display Project
//mirror the data left and right
outA = mirrorByte(outA);
//send row data
PORTB = passB;
//send column data on RC0 when RA7 should be on
PORTA = outA;
if(outA >= 0x80) //check status of RA7
{ PORTCbits.RC0 = 1; //on RC0 if RA7 on
}
else
{ PORTCbits.RC0 = 0; //off RC0 if RA7 off
}
}
//function to left-right mirror a byte string
unsigned char mirrorByte(unsigned char toMirror)
{ unsigned char mirrored=0x00, cnt8;
for(cnt8=0;cnt8<8;cnt8++)
{ mirrored = mirrored<<1;
mirrored = mirrored | (toMirror & 0x01);
toMirror = toMirror>>1;
}
return mirrored;
}
Appendix
57
Appendix D: Documentation for 8×8 LED Matrix Display Project
Figure 3.6.11: First Character, Left Arrow
Figure 3.6.12: Second Character, Up Arrow
Figure 3.6.13: Third Character, Right Arrow
58
Appendix D: Documentation for 8×8 LED Matrix Display Project
Figure 3.6.14: Fourth Character, Heart Shape
Figure 3.6.15: Fifth Character, Smiley
59