Mct Q&a

1283 words 6 pages
(G) On Keypad & Sensor :
1. How many I/O interface pins between keypad (4x4) and PIC18f4520?
- Keypad (4x4) has 8 I/O interface pins.
- In this example schematic that has RB0 to R07 connected to the 8 I/O pins on to the Keypad (4x4)

- PIC18f4520 has 36 I/O pins that grouped into 5 ports
- It should require 8 pins to connect a 4x4 keypad.

2. How to detect if a key is depressed?
E.g. Of flowchart when things are input.
E.g. Of flowchart when things are input.


Wait for Key Release
Wait for Key Release
Swap I/O back to original setup
Swap I/O back to original setup
Combine ‘R’ and ‘T’ and put into global variable
Combine ‘R’ and ‘T’ and put into global variable
Read another input (Keypad) and put into
…show more content…
- Fed the signal directly into the 13 Analog channels [AN0 to AN4 share same pins as RA0 – RA3 & RA5] [AN5, AN6& AN7 share same pins as RE0, RE1 &RE2] [AN8 – AN12 share same pins RB0 – RB4] [PORTs A, B&E can also be used for analog inputs.]
3- Configuring ports for digital I/O
Discovery: Steps
1) identify the port to be used.
2) If Port A, B or E is used, configure them as digital I/O pins by->Setting ADCON1: 0b0000111;
3) Configure the direction of each I/O pin -> using TRISx (E.g. Port A use TRISA input=1 out=0.
4- Teaching the microcontroller if an I/O pin is to be used for input or output. Discovery:
Read Only Memory (ROM) can be used to save the program permanently to be executed from future.
Random Access Memory (RAM) can be used for temporary storing data and intermediate results created and used during the operation of the microcontrollers.
5- Structure of a C program
1) Documentation
-Comment lines; naming the program.
2) Pre-process Statements
-# symbol is pre-processor directive.
3) Global Declarations main ()
in sum=0; float y;
main ()
in sum=0; float y;
-Variables are declared before main () function as known as Global variables.
4) The main () function
-Only one main.
5) Braces
-Opening { } closing.
6) Local Declarations
- all variables are used in main () function should be declared in


  • Diploma Q
    3159 words | 13 pages
  • Book Report for Rifleman Dodd
    945 words | 4 pages
  • Nebosh Paper 1 Q & a
    8556 words | 35 pages
  • Mcts Guide to Microsoft Windows 7 Chapter 1 Solutions
    1523 words | 7 pages
  • Est1 Company Q
    943 words | 4 pages
  • Convention Tourism Being Saturated?
    1811 words | 8 pages
  • Interview Q&a
    1679 words | 7 pages
  • Avenue Q Term Paper
    2452 words | 10 pages
  • With the Old Breed Book Report
    1545 words | 7 pages
  • Hsa-535 Midterm and Final Q&a
    2551 words | 11 pages