7/27/2019 Soalan PRA MySkills 2013 -Release Publis
1/11
Pertandingan Myskills Ke-7
1
PERTANDINGAN MySkills2013
(ELECTRONICS)
6 JAM
PERINGKAT PRA-KELAYAKAN
NAMA: __________________________________________
NO. KP:__________________________________________
JABATAN PEMBANGUNAN KEMAHIRANKEMENTERIAN SUMBER MANUSIA
7/27/2019 Soalan PRA MySkills 2013 -Release Publis
2/11
2
Project : Heater Display Input Panel
Time Limit: 6 hrs
This project accesses each competitor to design, assemble, write an embedded
C code and test project.
Project Description:
In this project, three (3) switches were provided for user preference. If the correctselection is made by pressing any of the push button, the selected option will bedisplayed on the first row of the LCD. This is done by centered displaying thestring represents the selection made such HOT for HOT selection. Buzzer is activated two (2) times at the end of selection. In the case of more than one (1)button were pressed, the string ERROR will be centered displaying on thesecond row of the LCD; buzzer beeps for three (3) times.
Figure 1 (Block Diagram)
7/27/2019 Soalan PRA MySkills 2013 -Release Publis
3/11
Pertandingan Myskills Ke-7
3
X1
16MHz
C527p
C427p
+5v
C7100nF
C6100nF
+5v
R810k
RA0/AN02
RA1/AN13
RA2/AN2/VREF-/CVREF4
RA3/AN3/VREF+5
RA4/T0CKI/C1OUT/RCV6
RA5/AN4/SS/LVDIN/C2OUT7
RA6/OSC2/CLKO14
OSC1/CLKI13
RB0/AN12/INT0/FLT0/SDI/SDA33
RB1/AN10/INT1/SCK/SCL34
RB2/AN8/INT2/VMO35
RB3/AN9/CCP2/VPO36
RB4/AN11/KBI0/CSSPP37
RB5/KBI1/PGM38RB6/KBI2/PGC
39
RB7/KBI3/PGD40
RC0/T1OSO/T1CKI15
RC1/T1OSI/CCP2/UOE16
RC2/CCP1/P1A17
VUSB18
RC4/D-/VM23
RC5/D+/VP24
RC6/TX/CK25
RC7/RX/DT/SDO26
RD0/SPP019
RD1/SPP120
RD2/SPP221
RD3/SPP322
RD4/SPP427
RD5/SPP5/P1B 28RD6/SPP6/P1C
29
RD7/SPP7/P1D30
RE0/AN5/CK1SPP8
RE1/AN6/CK2SPP9
RE2/AN7/OESPP10
RE3/MCLR/VPP1
U1
PIC18F4550
MCLR
MCLR
OSC1
OSC2
OSC2OSC1
VUSB
C8220n
1 2 3 4 5 6
J166226-006
MCLR
+5V
PGD
PGC
IO8IO9
IO10IO11IO12
IO13IO14IO15PGMPGCPGD
ANA0ANA1ANA2ANA3T0CKIANA4
IO0IO1IO2IO3IO4
IO5IO6IO7
PWM1PWM0
TX/RC6RX/RC7SDOSDA
SCL
SS
PICKIT3
IO16IO17IO18
VI1
VO3
GND
2
U27805
C925v/22uF
C1025V/22uF
D2
1N4001
+12v
+12v
0v
+5V
C1125V/22uF
Coupling formicrocontroller
T1CKI
R9680R
MCLR
D7
14
D6
13
D5
12
D4
11
D3
10
D2
9
D1
8
D0
7
E
6
RW
5
RS
4
VSS
1
VDD
2
VEE
3
LCD1LM016L
+5v IO
IO1
IO2
IO0
IO4
IO5
IO6
IO7
VEE
+5v IO
pin15(lcd
)
pin16(lcd
)
R1033R
+5v IO
VEE
Figure 2
Schematic Diagram
7/27/2019 Soalan PRA MySkills 2013 -Release Publis
4/11
Pertandingan MySkills Ke-7
4
Marking scheme:
Item Description Weight Score
1 Design circuit 30%2 Functionality 40%
3 Component assembly 10%
4 Soldering quality 10%
5 Wiring/jumper quality 10%
Parts List (Table 1)
ITEM PARTS NAME AND VALUE QTY REFERENCE NUMBER
1 RESISTORS CORBON TYPE 1/4W 5%
33R
120R
200R
390R
680R
1K
10K
12K
20K
Trim pot preset 10K PCB type
333332133
1
2 CAPACITORS
10uF 25v (Electrolytic)
22uF 25v (Electrolytic)
10nF
100nF (ceramic)
220nF (ceramic)
27pF (ceramic)
432512
3 SEMICONDUCTOR COMPONENTS
PIC 18F4550 c/w socket
Voltage regulator 7805 c/w heatsink
Transistor 2N3904 Transistor 2N3903
Diode IN4001
Diode IN4008
Diode IN914
11
11111
4 OTHERS
Strip board 25cm x 11cm
LCD LM016L
Crystal 16MHz
211
7/27/2019 Soalan PRA MySkills 2013 -Release Publis
5/11
5
6 pin PCB Header 45 degree bend
Buzzer 12Vdc PCB type
Normaly Open PCB Miniture Push ButtonSwitch
16 Pin Female Header
16 Pin Male Header
Microchip PIC Kit 3 downloader
114
111
The competitor needs to prepare the following equipments, machinery,installations and materials.
Item Qty Material Description Notes
1 1 Soldering Iron and equipment
2 1 Soldering Iron Stand
3 1 Solder wick or Solder Remover
4 1 Brush
5 1 Pincer
6 1 Nipper
7 1 Wire Stripper
8 1 Scissors
9 1 Tweezers
10 1 IC pick
11 1 PCB stand
12 1 Parts box
13 1 Precise screwdriver For trimmerresistor
14 1 Screw driver + type
15 1 Screw driver - type
16 1 Spanner
17 1 Safety Glasses
7/27/2019 Soalan PRA MySkills 2013 -Release Publis
6/11
6
Filename: main file.c
Filename: header file 1.h
#include "header file 1.h" // include files#include "header file 2.h" // definitions, global variables and function prototypes
void main(void){
unsigned char i,count;ADCON1= 0b001111; // Digital I/OCMCON = 0b00000111; // off comparator pg 234TRIS_PB1=1; // setting Push Button as input and PWM as outputTRIS_PB2=1;TRIS_PB3=1;TRIS_PWM0=0;PWM0=0;
Initialize_LCD(); // Must be called prior to usage of LCD
send_control(0x82);putr_lcd("Given Codes");
send_control(0xc3);putr_lcd("PKM 2013");
while(1){}// while
} //Main/* ---------------------End of File --------------------------*/
#include
#include #include #include #include #include "lcd 2x16 COM2013.c"
#pragma config FOSC = HSPLL_HS // HS oscillator, PLL enabled (HSPLL)#pragma config PLLDIV = 4 // Divide by 4 (16 MHz oscillator input)#pragma config CPUDIV = OSC4_PLL6 // [Primary Oscillator Src: /4][96 MHz PLL Src: /6]#pragma config USBDIV = 2 // USB clock comes from 96 MHz PLL output / 2#pragma config FCMEN = OFF // Disable Fail-Safe Clock Monitor#pragma config IESO = OFF // Disable Oscillator Switchover mode#pragma config PWRT = OFF // Disable Power-up timer#pragma config BOR = OFF // Disable Brown-out reset#pragma config VREGEN = ON // Use internal USB 3.3V voltage regulator#pragma config WDT = OFF // Disable Watchdog timer
#pragma config MCLRE = ON // Enable MCLR Enable#pragma config LVP = OFF // Disable low voltage ICSP#pragma config ICPRT = OFF // Disable dedicated programming port (44-pin devices)#pragma config CP0 = OFF // Disable code protection/* ---------------------End of File --------------------------*/
7/27/2019 Soalan PRA MySkills 2013 -Release Publis
7/11
7
Filename: header file 2.h
Filename: lcd 2 x 16 COM3013.c
/*Filename: lcd 2x16 COM2013.cDate: 20/12/2012Author: Myskills JPK
Revision: 1Depedency: lcd 2x16 COM2013.h*/
#include "lcd 2x16 COM2013.h"//continue
#define PB1 PORTBbits.RB2#define PB2 PORTBbits.RB3#define PB3 PORTBbits.RB4#define PWM0 PORTCbits.RC2#define TRIS_PB1 TRISBbits.TRISB2
#define TRIS_PB2 TRISBbits.TRISB3#define TRIS_PB3 TRISBbits.TRISB4#define TRIS_PWM0 TRISCbits.TRISC2
unsigned char x, y;
/*This function delay the system for the duration determines by i and system clock while checking RB2-RB5, if RB3-RB5 different to previous RB3-RB5, the function terminated by returning 1*/unsigned short char delay_jab(void){
unsigned char i;for(i=0; i>2&0B0111;
if (x!=y) return 1;Delay10KTCYx(1);
}
return 0;}/* To use pins RC4 and RC5 as digitalinputs, the USB module must be disabled(UCON = 0) and the on-chipUSB transceiver must be disabled(UCFG = 1
7/27/2019 Soalan PRA MySkills 2013 -Release Publis
8/11
8
//continuation
/*Provide 18 instruction cycles for LCD internal delay*/void DelayFor18TCY( void ){ unsigned char i;
for (i=0; i
7/27/2019 Soalan PRA MySkills 2013 -Release Publis
9/11
9
//continuation
void Four_bit_only (char x){while(check_busy());LCD_DATA_TRIS &= 0x0f; // Set data line as outputLCD_DATA &= 0x0f; // clear previous higher nibble on data lineLCD_DATA |= (x & 0xf0); // put higher nibble
LCD_RS = 0; // Logic 0LCD_RW = 0; // Logic 0DelayFor18TCY();LCD_E = 1; // pull high clockDelayFor18TCY();LCD_E = 0; // pull down clockDelayFor18TCY();
}
void send_data(char x){while(check_busy());
LCD_DATA_TRIS &= 0x0f; // Set data line as outputLCD_DATA &= 0x0f; // clear previous higher nibble on data line
LCD_DATA |= x & 0xf0; // put higher nibble
LCD_RS = 1; // Logic 1LCD_RW = 0; // Logic 0
DelayFor18TCY();LCD_E = 1; // pull high clockDelayFor18TCY();LCD_E = 0; // pull down clockDelayFor18TCY();
LCD_DATA &= 0x0f; // clear previous higher nibble on data lineLCD_DATA |= ((x4) &0x0f;LCD_E = 0; // pull down clockreturn x;}
//Continue
7/27/2019 Soalan PRA MySkills 2013 -Release Publis
10/11
10
Filename: lcd 2 x 16 COM3013.h
//continuation
/* Print the string from the buffer pointed by pointer*/void puts_lcd(char *pointer){
while(*pointer){ // print till null encounteredsend_data(*pointer);
pointer++;}
}
void putr_lcd(const rom char *pointer){while(*pointer){ // WHILE NOT NULL CHARACTER
send_data(*pointer);pointer++;}
}
void Initialize_LCD(void){LCD_DATA_TRIS = 0b00000000; // Set all lines as outputLCD_E = 0; // Logic 0LCD_RS = 0; // Logic 0
LCD_RW = 0; // Logic 0Delay1KTCYx(250); // 15msFour_bit_only(0b00100000); // (1)1st Function Set - 4-bit (entry 1 T12)send_control(0b00101000); // (2)2nd Function Set - 4-bit, 2 lines, 5X7 (entry 6 T6)send_control(0b00001110 ); // (3)Display & cursor on/off (entry 4 T6)send_control(0b00000110); // (4)Entry mode - inc addr, no shift (entry 3 T6)}
/*---------------------End of lcd 2 x 16 COM2013.c --------------------------------------------*/
/*Filename: lcd 2x16 COM2013.hDate: 20/12/2012Author: Myskills JPK
Revision: 1Depedency: delay.h
This free 2 x 16 LCD driver are provided as is without any guarantees or warranty.
Although the author has attempted to find and correct any bugs in thecodes, the author is not responsible for any damageor losses of any kind caused by the use or misuse of the codes.
The author is under no obligation to provide support, service, corrections,or upgrades to the programs.
*/
/* definitions of PINs connected to 2 x 16 LCD*/#define LCD_DATA PORTD#define LCD_DATA_TRIS TRISD#define LCD_E PORTDbits.RD0 // EN signal for LCD#define TRIS_LCD_E TRISDbits.TRISD0#define LCD_RS PORTDbits.RD2 // RS signal for LCD#define TRIS_LCD_RS TRISDbits.TRISD2#define LCD_RW PORTDbits.RD1 // RW signal for LCD#define TRIS_LCD_RW TRISDbits.TRISD1
//continue
7/27/2019 Soalan PRA MySkills 2013 -Release Publis
11/11
11
//continuation
void DelayFor18TCY( void );/*Provides 18 instruction cycles for LCD internal delay*/
unsigned char check_busy(void);/* Checks busy flag which is b7 of the LCD lines.It returns 1 on busy or 0 on not busy. It could be calledas:
while(check_busy()); // wait here till not busy*/
void send_control(char CMD);/* Sends command (RS=0 and RW =0) to LCD.Returns: NoneExample used:
send_control(x);where x is any character that define as LCD command
For detail please refer to HD44780U (LCD-II) - page 199*/
void Four_bit_only(char CMD);/* Sends only the higher nibble of the given character.Returns: NoneExample used:
Four_bit_only(x:y);
sends x only to LCD*/
void send_data(char x);/* Sends data (RS=1 and RW =0) to LCD.Returns: NoneExample used:
send_data(x);where x is any character to be displayed on the LCD
For detail please refer to HD44780U (LCD-II) - page 199*/
char read_data(void);/* Reads data (RS=1 and RW =1) from the set address.Returns: Character whuch is pointed by the CURSORExample used:
x = read_data();Note:
x must be defined as character*/
void puts_lcd(char *pointer);/* Prints the string from the buffer pointed by pointer.The string can be defined on the program RAM/register aschar array1[]="Just testing";
Returns: NoneExample used:
puts_lcd(array1);*/
void putr_lcd(const rom char *pointer);/* Prints the string from the buffer pointed by pointer.The string can be defined on the program ROM aschar const rom array1[]="Just testing";
Returns: NoneExample used:
1. putr_lcd(array1);2. putr_lcd("ASC 2012);
*/
void Initialize_LCD(void);/*Initializes the LCD and must be called once by the main function.For detail please refer to HD44780U (LCD-II) - page 207*/
/*---------------------End of lcd 2 x 16 COM2013.h --------------------------------------------*/
Top Related