Pre-MCT Training

Category: Entertainment

Presentation Description

MCT Learning


Presentation Transcript

Pre-MCT Training:

Pre-MCT Training By: Bock Yang

Do’s and Don’t:

Do’s and Don’t Do NOT teach them about MCT. This course is meant to teach them basic programming only. Do NOT turn up late on any of the 3 days. Do interact with the teacher Do help them to debug whenever possible. When stuck, feel free to approach the teacher


Objectives What is C programming Difference between java What to note during the actual training


MCT What is MCT? MCT stands for Micro-Controller Technology. Used to program the default P18F4520 Chip. Why do we need it? Because you need to. MCT saves time and space. Without MCT, programming would need to rely on logic gates.

MP Lab + C18 Complier:

MP Lab + C18 Complier What is it? Default workspace for C programming, much like Jcreator or Eclipse.

MPLab Tutorial:

MPLab Tutorial Copy this folder in C:/Cprog called example1 to D:/myproject/ Double click Example1.mcw to open up the MPLab workspace. Yes this one. The bigger 1.

MPLab Tutorial :

MPLab Tutorial This is what you should see.

C Tutorial:

C Tutorial What is C Programming? C Programming is essentially similar to Java Consist of embedded C and software C

C Tutorial:

C Tutorial This is the basic look at C programmes . Include files Start of method ‘Main’ Declaration of Variables Configurations Calculations Conditioning & output End of ‘main’ Method

Differences between C and Java:

Differences between C and Java Java Public Static void main(String[] args ) Double is the common storage No system.out.print C void main() Float is the common storage Output is seen in hardware or watch window

C Tutorial:

C Tutorial First, Data-types. Note that char type storage actually stores ASCII Hex values

C Tutorial – Basic Coding:

C Tutorial – Basic Coding Top-down Programming Include files Main method Declare variables & Configure ports Calculations Output End Main method

P18F4520 Connection :

P18F4520 Connection


Exercises 1. Assign a array to store 10 ASCII characters which are ‘A’ to ‘J’. Reassign the variable in the last array element as ‘!’. Write down all the hexadecimal values in the array.

ASCII Table:



Exercises According to the Schematic Diagram below, write a program that activates the LED(PORTBbits.RB0) and 7 Segment(PORTD) to show a ‘8’ when the push switch(PORTABits.RA3) is activated.

Debugging Exercises(Syntax):

Debugging Exercises(Syntax) Line Program Corrections, if any 1 #include <p18f4520.h> 2 #include <delays.h> 3 4 void main(){ 5 int display2; 6 int counter; 7 int logical_status; 8 while(1){ 9 char display='Z'; 10 if(display == 'Z'){ 11 PORTCbits.RC1 = true; 12 display = 'X'; 13 counter++; 14 logical status = 1; 15 } 16 if(display == 88){ 17 display2=1; 18 display = 'Z'; 19 logical status = 2; 20 } 21 if(logical_status = true && display2 = 1); 22 { 23 display2 = 0; 24 display = 'Z'; 25 }


Summary There will be another session to meet the teachers in April. The training date is 9-11 April. Get used to MPLab interface and functions.

authorStream Live Help