Tic-Tac-Toe with mtouch. Version 1.0. June Cytron Technologies Sdn. Bhd.

Similar documents
RFID: Read and Display V2010. Version 1.1. Sept Cytron Technologies Sdn. Bhd.

Display Real Time Clock (RTC) On LCD. Version 1.2. Aug Cytron Technologies Sdn. Bhd.

SK18A. 18 Pins PIC START-UP KIT. User s Manual V1.1. Dec 2007

IFC-OC04 Interface Free Controller Output Card

IFC-MD15A Interface Free Controller Brush Motor Card

IFC-EB02 Interface Free Controller Extension Board

CYTRON USB PIC Programmer v2009 UP00B

SK40C ENHANCED 40 PINS PIC START-UP KIT. User s Manual V1.3. March 2012

Cytron USB to UART Converter UC00A

RE08A Rotary Encoder Kit

PS2 Controller Starter Kit SKPS

BLD04A Brushless DC Motor Driver

IFC-MB00 Interface Free Controller Main Board

SHIELD-MD10 Cytron 10A Motor Driver Shield

Transcendent Frequency Counter

Capacitive Touch Remote Control Reference Design User s Guide

The FED PIC Flex 2 Development Boards

LABORATORY MANUAL Interfacing LCD 16x2, Keypad 4x4 and 7Segment Display to PIC18F4580

DEV-1 HamStack Development Board

Cytron 3A Motor Driver Shield SHIELD-3AMOTOR. User s Manual Rev 1.0 April 2017

Bolt 18F2550 System Hardware Manual

PICado Alpha Development Board V1.0

PIC Microcontroller Introduction

Maker Uno MAKER-UNO. User s Manual. Rev 1.0 Dec 2017

PVK40. User's manual. Feature Rich Development and Educational Kit for 40-pin Microchip PIC microcontrollers

AKKON USB CONTROLLER BOARD

SD02B 2A Stepper Motor Driver

PIC16F87X. 28/40-pin 8-Bit CMOS FLASH Microcontrollers. Devices Included in this Data Sheet: Pin Diagram PDIP. Microcontroller Core Features:

Rapid40i PIC Prototyping PCB User Manual

Shack Clock kit. U3S Rev 2 PCB 1. Introduction

For more detailed information about this product please refer to the QT510 datasheet.

Rapid40iXL PIC Prototyping PCB User Manual

Rapid28iXL PIC Prototyping PCB User Manual

DEVBOARD3 DATASHEET. 10Mbits Ethernet & SD card Development Board PIC18F67J60 MICROCHIP

E3B USER'S GUIDE. for QT310 / QT320 QProx IC evaluation and development Overview. Fast Start

KPIC-0818P (V050919) Devices Included in this Data sheet: KPIC-0818P

PIC 28 Pin Board Documentation. Update Version 5.0

Linux Kernel Hacking Free Course, 3rd edition. HWMPS: Hardware Monitor & Protection System

PIC-32MX development board Users Manual

BSCB-2 BASIC STAMP CARRIER BOARD

Capacitive mtouch Sensing Solutions

K191 3 Channel RGB LED Controller

BIG8051. Development system. User manual

LPC2148 DEV BOARD. User Manual.

LED Knight Rider. Yanbu College of Applied Technology. Project Description

Sierra Radio Systems. HamStack. Project Board Reference Manual V1.0

PedalSync. 9 Switches MV-62. Chip. Module. and

PIC Dev 14 Through hole PCB Assembly and Test Lab 1

BIGdsPIC6. Development System. User manual

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

Keywords Digital IC tester, Microcontroller AT89S52

MT2 Introduction Embedded Systems. MT2.1 Mechatronic systems

Dual Interface LCD Display Controller

SD02C 2A Stepper Motor Driver. User s Manual V1.0

MOD-ZIGBEE-PIR sensor development board USER S MANUAL All boards produced by Olimex LTD are ROHS compliant

Pridgen Vermeer Robotics Xmega128 Manual

HAND HELD PROGRAMMER QUICK START GUIDE

DEV16T. LCD Daughter board

GLiPIC Ver C Assembly manual Ver 1.0

Exclusive 2.5 GHz Frequency Counter

Variable Power Supply Digital Control Circuit Diagram Using Lm317

BV511 Hardware Guide ByVac ByVac Revision 1.0

IS-S0108 Single Switch Solution

TP80301 Data Sheet Copyright SIGMATONE Version 1.0

Schematic Diagram: R2,R3,R4,R7 are ¼ Watt; R5,R6 are 220 Ohm ½ Watt (or two 470 Ohm ¼ Watt in parallel)

User Manual For CP-JR ARM7 USB-LPC2148 / EXP

TC35 GSM Development Board

09/05/2014. Engaging electronics for the new D&T curriculum. Geoff Hampson Managing Director of Kitronik. Presentation overview

Goal: We want to build an autonomous vehicle (robot)

NeoLoch. Inquisitor 6821 PIA Blade Manual. Overview. Preliminary Release

TDSDB Features. Description

Doc: page 1 of 8

Embedded Systems. PIC16F84A Internal Architecture. Eng. Anis Nazer First Semester

PIC-P40 development board Users Manual

PIC Dev 14 Surface Mount PCB Assembly and Test Lab 1

SBAT90USB162 Atmel. SBAT90USB162 Development Board User s Manual

Modtronix Engineering Modular Electronic Solutions SBC28DC. Single board computer for 28 pin DIP PICs

Section 30. In-Circuit Serial Programming (ICSP )

Department of Electronics and Instrumentation Engineering Question Bank

USER GUIDE. Atmel QT1 Xplained Pro. Preface

Fireloch 4 Digit 7 Segment Programmable Display Module

Advanced Lantern 1.0 Kit. Introduction to the Advanced Lantern 1.0 Kit

MeterBuilder MB-1 PROGRAMMABLE RF POWER METER. CIRCUIT DESCRIPTION Version 1.01 June 2011

EasyPIC5 Development System

Professional Radio GM Series. Controlhead Service Information

AVR Peripheral Board. Campus Component Pvt. Ltd.

AXE033 SERIAL/I2C LCD & CLOCK

EL Wire sequencer / power supply PART NO

S12VR Hardware Design. Guidelines. 1 Introduction. 2 Hardware Design. Guidelines. 2.1 Voltage regulator. Freescale Semiconductor

PIC PORTABLE PROGRAMMER QUICK START GUIDE

SECURE DIGITAL ACCESS SYSTEM USING IBUTTON

Pin # Name Type Description

8051 Intermidiate Development Board. Product Manual. Contents. 1) Overview 2) Features 3) Using the board 4) Troubleshooting and getting help

Two-wire. Jumper for 12V. J2 Enable Adjust D/A1. Super PLC Warning: Warranty Void if this label is damaged 62256LP-12 CMOS RAM 4.

SBC44EC. Single board computer for 44 pin PLCC PICs

USER GUIDE. Atmel QT6 Xplained Pro. Preface

F²MC-8L FAMILY MB89201 SERIES FLASH PROGRAMMING 8-BIT MICROCONTROLLER APPLICATION NOTE. Fujitsu Microelectronics Europe Application Note

BASIC Stamp 1 Project Board (#27112) Development / Education Platform for the BASIC Stamp 1

Downloaded from Elcodis.com electronic components distributor

Pin # Name Type Description

Transcription:

Tic-Tac-Toe with mtouch PR28 Version 1.0 June 2010 Cytron Technologies Sdn. Bhd. Information contained in this publication regarding device applications and the like is intended through suggestion only and may be superseded by updates. It is your responsibility to ensure that your application meets with your specifications. No representation or warranty is given and no liability is assumed by Cytron Technologies Incorporated with respect to the accuracy or use of such information or infringement of patents or other intellectual property rights arising from such use or otherwise. Use of Cytron Technologies s products as critical components in life support systems is not authorized except with express written approval by Cytron Technologies. No licenses are conveyed, implicitly or otherwise, under any intellectual property rights. FEATURES OVERVIEW This document describes the development of Cytron Technologies DIY (Do It Yourself) Project PR28. This project demonstrates hobbyist on how to build a simple Microchip s mtouch where no extra components are needed excluding the sensing pads on PCB. In this project, capacitive sensing module (CSM) is used. Tic Tac Toe game is one of the simple applications of mtouch. This DIY project will be using PIC 16F727 microcontroller, 74HC595 shift registers, piezo, mtouch, RGB LEDs and 2 x 16 characters LCD. PIC16F727-8-bit microcontroller with 35 I/O - Operates with 5V supply - Operating speed 20MHz - mtouch Sensing Oscillator Module which is up to 16-input channels 74HC595 Shift Register - 8-bit serial input - 8-bit serial or parallel output - Shift register with direct clear Capacitive Touch Sensor (mtouch ) - Made up from copper sensor pads Created by Cytron Technologies Sdn. Bhd. All Rights Reserved 1

SYSTEM OVERVIEW 74 HC 595 RGB LEDs mtouch PIC16F727 LCD Piezo GENERAL DESCRIPTION PR28 is an open-sourced microcontroller Do It Yourself kit. This PIC microcontroller based project is designed to develop a Tic-Tac-Toe game using mtouch. mtouch, also known as capacitive touch sensor, can replace mechanical buttons with capacitive alternative. In addition, it helps in cost reduction. mtouch has become more prevalent and in demand for commercial applications such as mobile devices and mp3 players. Thus, this project will show users how to work with mtouch. For information, PR28 uses internal oscillator to run the program. PIC16F727 This powerful (200 nanosecond instruction execution) yet easy-to-program (only 35 single word instructions) CMOS FLASH-based 8-bit microcontroller with nano- Watt XLP Technology packs Microchip's powerful PIC architecture into a 28- or 40- or 44-pin package and is upwards compatible with the 28- or 40- pin PIC16CXX and PIC16FXXX Microcontrollers. Features of the device: Interrupt capability 8-Level Deep Hardware Stack Direct, Indirect or Relative Addressing modes Processor Read Access to Program Memory Precision Internal Oscillator a. 16MHz or 500kHz operation b. Factory calibrated to ±1%, typical c. Software tunable d. Software selectable +1, +2, +4 or +8 divider Multiplexed Master Clear with Pull-up or Input Pin 14 channels of 8-bit Analog-to-Digital (A/D) converter where conversion is also available during sleep mode Enhanced Timer1: a. Dedicated low-power 32 khz oscillator b. 16-bit timer/counter with pre-scaler c. External Gate Input mode with toggle and single shot modes d. Interrupt-on-gate completion 2 capture/compare/pwm functions Synchronous Serial Port (SSP): a. SPI (Master/Slave) b. I²C (Slave) with Address Mask Addressable Universal Asynchronous Receiver Transmitter (AUART). mtouch Sensing Oscillator Module which is up to 16 input channels 40-pin PDIP (PIC 16F727) Figure 1 Figure 1 shows the pin diagram for PIC16F727. For more information about the PIC microcontroller, please refer to the datasheet. The datasheet can be found in microchip web site at: http://www.microchip.com Created by Cytron Technologies Sdn. Bhd. All Rights Reserved 2

74HC595 Shift Register 74HC595 shift register is the cheapest and easiest way to extend I/O ports if user is running out of I/O pins. Using this 8-bit shift register, user can control 8 outputs at a time while only taking up 3 I/O ports on microcontroller. Features of this device are as follows: 8-bit serial input 8-bit serial or parallel output Storage register with 3-state output Shift register with direct clear 100MHz (typical) shift out frequency Output capability a. Parallel outputs; bus driver b. Serial outputs; standard Icc category: MSI For more information on 74HC595 shift register, please refer to the datasheet which is available at the website http://www.nxp.com/documents/data_sheet/74hc_hct5 95.pdf Capacitive Touch Sensor (mtouch ) The construction of mtouch only consists of copper pads on PCB board. There is no extra components needed to make the mtouch functions. The detailed explanation on how to work with mtouch will be discussed in later section. Power supply for the circuit Push Button as input for PIC microcontroller Figure 4 One push button needs one I/O pin to be used as an input for PIC microcontroller. The connection of the push button to the I/O pin is shown in Figure 3. The I/O pin should be pulled up to 5V using a resistor (with value range 1K-10K) and this configuration will result in an active-low input. When the button is being pressed, reading of I/O pin will be in logic 0, while when the button is not pressed, reading of that I/O pin will be logic 1. ICSP for programming PIC microcontroller Figure 5 Figure 3 User can choose either AC to DC adaptor (not included in the DIY project set) or 9V-12V battery (not included in the DIY project set) to power up the circuit. Higher input voltage will produce more heat at LM7805 voltage regulator. Typical voltage is 12V. Anyhow, LM7805 will still generate some heat at 12V. There are two type of power connector for the circuit, DC plug (J1) and 2510-02 (Power Connector). Normally AC to DC adaptor can be plugged to J1 type connector. The basic connection for In-Circuit Serial Programmer (ICSP) is as displayed in Figure 5. There are a few types of USB in-circuit programmer can be found in Cytron, for example, UIC00B. However, programmer is not included in this DIY project package since the programmer can be reused for other projects. For the instruction of using a PIC programmer, please refer to the particular PIC programmer user s manual at cytron website. Referring to Figure 3, the D2 is used to protect the circuit from wrong polarity supply. C2 and C3 are used to stabilize the voltage at the input side of the LM7805 voltage regulator, while the C1 and C4 are used to stabilize the voltage at the output side of the LM7805 voltage supply. LED is a green color LED to indicate the power status of the circuit. R1 is a resistor to protect LED from excessive current that will burn the LED. Created by Cytron Technologies Sdn. Bhd. All Rights Reserved 3

Transistor Figure 8 The transistor is used to amplify the current for the RGB LEDs. In this project, 3 NPN transistors, 2N2222A, are used. The pin sequence is as shown in Figure 8. Beware that wrong sequence will burn the transistor. RGB LEDs HARDWARE This project will require following hardware: a. 1 x PIC16F727 b. 1 x PR28 Printed Circuit Board (PCB) c. 1 x LCD (2x16 character) d. 3 x 74HC595 Shift Register e. 9 x RGB LEDs f. 1 x piezo g. 1 x 9V-12V power supply h. Related electronic components Please refer to Appendix A for the board layout of PR28. The board layout is provided for free therefore Cytron Technologies will not be responsible for any further modification or improvement. Interface LCD (2x 16 Character) with PIC16F727 To use the LCD display, users have to solder 16 pin header pin to the LCD display. LCD used in this project is RT1602C, for other type of LCD, please refer to its data sheet. Figure 9 The RGB LED contains 3 LEDs encased in one shell. It looks like a single white LED except that it has four leads. It can be used to display 3 different colors which are red, green or blue. Pin 1, pin 3 and pin 4 are the anode pins for the red color LED, green color LED and blue color LED, respectively. Pin 2 which has the longest leg, is the cathode pin. In this project, pin 1, 3 and 4 are connected to the 74HC595 shift register whereas pin 2 is connected to the collector of a transistor. In this project, RGB LEDs are used to show the output for the Tic-Tac-Toe game where red color represents player 1 and green color to indicate player 2. In addition, if there is no winner in the game, blue color LEDs will blink continuously. Figure 11 Figure 11 is a 2X16 character LCD. LCD connection pin and function of each pin is shown: Piezo Pin Name Pin function Connection The piezo used in this project works similarly as a buzzer 1 VSS Ground GND except that it has no polarity. The difference of piezo and 2 VCC Positive supply 5V buzzer is that piezo can play melody with the use of for LCD PWM. Of course, before using PWM function, the piezo 3 VEE Brightness adjust Connected to needs to be connected to CCP1 or CCP2 pin of PIC a trimmer to microcontroller. In this case, the piezo is connected to adjust LCD RC2 which is CCP1. To play a certain note, we need to brightness adjust the PR2 value to get the PWM period needed by 4 RS Select register, RE0 using the equation below. select instruction PWM period = [(PR2) +1] 4 Tosc or data register 5 R/W Select read or GND write 6 E Start data read or RE1 To fully understand the working of the piezo, kindly refer write to the sample source code provided as well as the PIC 7 DB0 Data bus pin RB0 microcontroller datasheet. 8 DB1 Data bus pin RB1 9 DB2 Data bus pin RB2 Created by Cytron Technologies Sdn. Bhd. All Rights Reserved 4

10 DB3 Data bus pin RB3 11 DB4 Data bus pin RB4 12 DB5 Data bus pin RB5 13 DB6 Data bus pin RB6 14 DB7 Data bus pin RB7 15 LED+ Backlight positive input 16 LED- Backlight negative input a resistor to limit excessive current GND Figure 14 Figure 12 Interface 74HC595 with PIC16F727 The basic connection of 74HC595 is as demonstrated in Figure 13 below. Figure 15 Interface mtouch with PIC16F727 To utilize the capacitive sensing module in PIC16F727, all the copper pads must be connected to the capacitive channels of PIC microcontroller and set those pins to analog pins. This step is very vital before proceeding to software algorithm. In this project, the mtouch or touch pad is connected as shown in Figure16. Figure 13 As mentioned earlier, 74HC595 is a serial-in parallel- or serial-out shift register. Basically, it works as synchronous serial communication where one pin can be pulsed up and down thereby communicating a data byte to the register bit by bit. By pulsing second pin, the clock pin, bits can be delineated. To have clearer picture on this, please refer to Figure 14 and Figure 15, respectively. Figure 16 Theoretically, to know whether the touch pad has been touched or not is by determining the change of capacitance. As demonstrated in Figure 17, before a Created by Cytron Technologies Sdn. Bhd. All Rights Reserved 5

finger presses the pad, the PCB pad itself has a capacitance, Cp. However, if a finger presses the copper pad, another capacitance, Cf is introduced where it is in parallel with Cp. Thus, the equivalent of capacitance increases after finger press. Additionally, the capacitance change will result in change in frequency. To scan a pad, frequency change on copper pad is measured. To get a clear picture on this, please refer to Figure 17. Figure 17 There are a few methods to perform capacitive sensing, such as comparator, Charge Time Measurement Unit (CTMU), Capacitive Voltage Divider (CVD) and Capacitive Sensing Module (CSM). In this project, the touch pad is sensed by capacitive sensing module (CSM) at fixed time interval. The benefit of this method is that it does not need external oscillator since the module has its own oscillator embedded. The frequency of each pad at rest is averaged. Frequency Measurement Since CSM is a frequency-based method, timer method is used. Basically, Timer 2 is used as the timer resource instead of using Timer 0 due to it has greater flexibility in defining time base. On the other hand, Timer 1 gate is used as a counter. It will increment at every rising edge of capacitive sensing module output frequency. The value on the Timer 1 will be a measure for CSM oscillator frequency. The completion of Timer 1 gate event, triggered by Timer 2 overflow, will generate a Timer 1 gate interrupt. When servicing the interrupt, the value from the Timer 1 can be read to determine the oscillator frequency. In detailed, capacitance of the pad alone results in a corresponding square wave frequency. When the PR2 value is matched, the current count value in Timer 1 will be read and stored as reference. Once the finger is touched, the RC time constant of the oscillator increases and thus results in a decrease of frequency of the square wave output. Therefore, on the next interrupt, the Timer 1 value will be smaller. Using a software algorithm to compare the difference between these values, the sensor can be identified as pressed or not pressed. Below explains the frequency changes graphically. Figure 18 For more detailed information on the working of mtouch, kindly refer to the application notes which can be downloaded for free in Microchip website (http://www.microchip.com) Explanation on Tic-Tac-Toe using mtouch When a pad is touched, the frequency on the CSM changes due to the extra capacitance from the finger. The change in frequency is noted and the LEDs light up to indicate which button was pressed. Since the mtouch is used for the Tic-Tac-Toe game, the LEDs will not light up immediately after the touch pad has been pressed. Each copper pad is only responsible for only one RGB LED. For example, a touch pad which is noted as X1 is responsible to the RGB LED that is also noted as X1. When that particular touch pad has been pressed and being detected by PIC microcontroller, PIC will check whether that particular pad has been touched previously or not. If yes, that particular RGB LED will not response. On the contrary, the RGB LED will light up. PCB circuit board 1 Not Pressed 2 3 4 5 8 9 10 11 14 15 18 Pressed 19 6 12 16 Not Pressed 7 13 17 Components: 1. Slide Switch ( to ON or OFF the circuit) 2. 2510-02 connector ( to use either 9V or 12V battery) 3. AC-DC adaptor socket Created by Cytron Technologies Sdn. Bhd. All Rights Reserved 6

4. IN 4007 diode ( to protect the circuit from wrong polarity) 5. LM7805 (to supply 5V for PIC and 74HC595 Shift register. 6. ICSP programmer connector ( to program the code into PIC) 7. 74HC595 shift register ( to control RGB LEDs) 8. Reset button ( to reset the PIC) 9. LED ( power indicator) 10. 1N4148 ( to protect LED from wrong polarity) 11. Capacitors ( to stabilize both input and output voltage of LM7805) 12. 2N2222 transistors ( to amplify the current for RGB LEDs) 13. RGB LEDs 14. Piezo ( to play melody) 15. PIC 16F727 ( the main brain of this project) 16. Contrast ( to control the contrast of LCD) 17. mtouch (for Tic Tac Toe gaming) 18. LCD ( to display the result and guidelines of the Tic Tac Toe game) 19. 0.1uF capacitor ( to stabilize the supply voltage to the PIC) Software: Flow Chart for main loop Flow chart for ISR: Frequency Measurement ISR Read Timer 1 value Current Reading < (average threshold)? Yes Button pressed No Button not pressed Start Perform average Initialize PIC, LCD And Capacitive Sensing Module Set Next Channel Clear all variables and set flag = 0 Restart Timer Enable interrupt Return Timer 1 gate interrupt? Yes No Service interrupt Main loop Created by Cytron Technologies Sdn. Bhd. All Rights Reserved 7

Flow chart for Tic-Tac-Toe Game Main loop Play starting melody Check flag Flag = 0? No Yes Player 1 Player 2 The button pressed has been pressed previously? Yes No Toggle flag Store X or O into matrix based on flag Display RGB LEDs accordingly Winner? Yes No Draw? No Toggle flag Yes Play melody Display result on LCD Stop Created by Cytron Technologies Sdn. Bhd. All Rights Reserved 8

For more information about the software for this system, please refer to the source code provided. The explanation of each instruction is provided in the source code as the comment of each line. Guide for making 2510-02 connector 1 2 The source code is provided free and Cytron Technologies will not be responsible for any further modification or improvement. GETTING START User can obtain the hardware set for this project (PR28) either by online purchasing (www.cytron.com.my) or by purchasing it in Cytron Technologies Shop. 1. Once user has the hardware set, soldering process can be started. Please solder the electronic components one by one according to the symbols or overlays on the Printed Circuit Board (PCB). Ensure that the component value and polarity is correctly soldered. Please refer to PCB Layout in Appendix A. Caution: Make sure all the connectors (2510) are soldered in proper side. Those electronic components have polarity such as capacitors, diodes, PIC, 74HC595s, LM7805, transistors, RGB LEDs and LED should be soldered in right polarity or it may cause the circuit board fail to work. Warning: Before the battery (Power) is plugged in, make sure the polarity is correct to prevent explosion. Wrong polarity of capacitor also may cause explosion. 3 4 5 6 7 Figure 19 Guide for making 2510-02 for 9V battery connector: Figure 20 (not included in DIY project set) Created by Cytron Technologies Sdn. Bhd. All Rights Reserved 9

2. Please download the necessary files and document from Cytron Technologies website. These included documentation, sample source code, schematic, component list and software. 3. The next step is to install MPLAB IDE and HI-TECC C PRO into a computer. The MPLAB IDE and HI-TECC C PRO can be downloaded from www.cytron.com.my. Please refer MPLAB IDE installation step document to install the software. The documents can be used to any version of MPLAB IDE software. 4. After the installation complete, open the project file provided using MPLAB IDE. Please refer MPLAB Open Project document to open the sample program. 5. Plug in power supply for the circuit. User can choose to use battery or AD to DC adaptor. the power. The programmer is not included in the hardware set but it can be found at Cytron website. (User manual is provided at website). 7. Test the functionality of the PCB board. 8. Have fun! TEST METHOD 1. Switch ON the power Power LED (Green) will turn ON. A short melody will be played. LCD will show Cytron Technologies Sdn Bhd and PR 28 Tic-Tac-Toe with mtouch ). Then, LCD will show the indicator for RGB LEDs, which is Player 1 = red and Player 2 = green. Next, LCD will show Player 1 starts first. AC to DC adaptor: Figure 21 (Not included in DIY project set) Connection to the PCB board: 12V Polarity 2. Press your finger on the touch pad Tic Tac Toe game has been started. RGB LED will turn ON accordingly with the position. For player 1, the RGB LED will be in red color. Whereas, player 2 is in green color. LCD will guide user who is the turn each time. Repeat this step continuously until there is a winner. 3. If player 1 is a winner A melody will be played. LCD will display Congratulation!! **Player 1 win** 4. If player 2 is a winner A melody will be played. LCD will display Congratulation!! **Player 2 win** 5. If there is a draw Different melody will be played. LCD will display Congratulation!! **draw** and blink continuously. All RGB LEDs will be blinking continuously in blue color. 6. If all steps mentioned above can be executed, your project is done successfully. Congratulations!! Figure 22 6. Build the project and load the hex file into the PIC microcontroller using the USB In-Circuit Programmer (UIC00B). When user builds the project, MPLAB IDE will generate hex file. The hex file generated from MPLAB IDE will be named according to project name, not C file name. Cytron Technologies also provide hex file for user. Do not forget to switch ON Please note that do not try to press more than one touch pad each time as it will cause instability of the system. WARRANTY No warranty will be provided as this is DIY project. Thus, user is advised to check the polarity of each electronic component before soldering it to board. Created by Cytron Technologies Sdn. Bhd. All Rights Reserved 10

Demonstration 1. When player 1 press position Z1 on the touch pad, the RGB LED on position Z1 will turn ON in red color. The LCD will show that player 2 is the next turn. This step is as shown in Figure below. 2. Next, when player 2 press position Y2 at touch pad, the RGB LED on position Y2 will turn ON in green color. The LCD will then guide users that player 1 is the next turn. 3. These two steps will repeat till there is a winner or draw. Created by Cytron Technologies Sdn. Bhd. All Rights Reserved 11

Appendix A PCB Layout: PWR Slide Switch Reset LED PIEZO 1N4007 Adaptor 1N4148 330 4K7 LM7805 0.1uF 16V 10uF PIC 16F727 ICSP Programmer 2N2222 Transistors 1 K 100 74HC595 1 K 74HC595 RGB LEDS 74HC595 0.1 uf Contrast mtouch LCD * Cytron Technologies reserved the right to replace the component in the list with component of the same functionality without prior notice. Created by Cytron Technologies Sdn. Bhd. All Rights Reserved 12

PR28-Tic-Tac-Toe with mtouch Prepared by Cytron Technologies Sdn. Bhd. 19, Jalan Kebudayaan 1A, Taman Universiti, 81300 Skudai, Johor, Malaysia. Tel: +607-521 3178 Fax: +607-521 1861 URL: www.cytron.com.my Email: support@cytron.com.my sales@cytron.com.my Created by Cytron Technologies Sdn. Bhd. All Rights Reserved 13