Embedded System - Zero To Hero For Beginner Module
Embedded System - Zero To Hero For Beginner Module
Contents
Chapter 1 ..................................................................................................................................................................................................... 3
1.1
1.3
1.2
1.4
1.5
Chapter 2 .................................................................................................................................................................................................. 13
2.1
2.2
2.2.1
2.2.2
2.2.3
2.2.4
2.2.5
2.2.6
2.3
2.3.1
2.3.2
2.3.2
Delay18.c ................................................................................................................................................................. 16
LCD.c .......................................................................................................................................................................... 16
Delay18.h ................................................................................................................................................................. 23
LCD.h.......................................................................................................................................................................... 23
System.h ................................................................................................................................................................... 24
Adc.c//This file provides the functions for the ADC module ........................................................... 27
Adc.h .......................................................................................................................................................................... 28
2.4
2.5
Keypad ................................................................................................................................................................................. 32
2.4.1
2.5.1
2.5.2
2.5.3
Keypad.h .................................................................................................................................................................. 35
Chapter 3 .................................................................................................................................................................................................. 36
3.1
3.2
3.2.1
3.2.2
3.2.3
3.2.4
3.3
Interrupt ............................................................................................................................................................................. 36
References ............................................................................................................................................................................................... 38
Chapter 1
1.1
The Introduction
1.2
Microcontroller Features
1.2.1
Supply Voltage
Most microcontrollers operate with the standard logic voltage of 5V. Some
microcontrollers can operate at as low as 2.7V, and some will tolerate 6V without any
problem. The manufacturers data sheet will have information about the allowed
limits of the power supply voltage.
Usually, a voltage regulator circuit is used to obtain the required power supply
voltage when the device is operated from a mains adapter or batteries. For example, a
5V regulator is required if the microcontroller is operated from a 5V supply using a
9V battery.
1.2.2
The Clock
All microcontrollers require a clock (or an oscillator) to operate, usually
provided by external timing devices connected to the microcontroller. In most cases,
these external timing devices are a crystal plus two small capacitors. In some cases
they are resonators or an external resistor-capacitor pair. Some microcontrollers have
built-in timing circuits and do not require external timing components. If an
application is not time-sensitive, external or internal (if available) resistor-capacitor
timing components are the best option for their simplicity and low cost.
An instruction is executed by fetching it from the memory and then decoding
it. This usually takes several clock cycles and is known as the instruction cycle. In
PIC microcontrollers, an instruction cycle takes four clock periods. Thus the
microcontroller operates at a clock rate that is one-quarter of the actual oscillator
frequency. The PIC18F series of microcontrollers can operate with clock frequencies
up to 40MHz.
1.2.3
Timers
Timers are important parts of any microcontroller. A timer is basically a
counter which is driven from either an external clock pulse or the microcontrollers
internal oscillator. A timer can be 8 bits or 16 bits wide. Data can be loaded into a
timer under program control, and the timer can be stopped or started by program
control. Most timers can be configured to generate an interrupt when they reach a
certain count (usually when they overflow). The user program can use an interrupt to
carry out accurate timing-related operations inside the microcontroller.
Microcontrollers in the PIC18F series have at least three timers.
Some microcontrollers offer capture and compare facilities, where a timer
value can be read when an external event occurs, or the timer value can be compared
to a pre-set value, and an interrupt is generated when this value is reached. Most
PIC18F microcontrollers have at least two capture and compare modules.
1.2.4
Watchdog
Most microcontrollers have at least one watchdog facility. The watchdog is
basically a timer that is refreshed by the user program. Whenever the program fails to
refresh the watchdog, a reset occurs. The watchdog timer is used to detect a system
problem, such as the program being in an endless loop. This safety feature prevents
runaway software and stops the microcontroller from executing meaningless and
unwanted code. Watchdog facilities are commonly used in real-time systems where
the successful termination of one or more activities must be checked regularly.
1.2.5
Reset Input
Reset input is used to reset a microcontroller externally. Resetting puts the
microcontroller into a known state such that the program execution starts from
address 0 of the program memory. An external reset action is usually achieved by
connecting a push-button switch to the reset input. When the switch is pressed, the
microcontroller is reset.
1.2.6
Interrupts
Interrupts are an important concept in microcontrollers. An interrupt causes
the microcontroller to respond to external and internal (e.g., a timer) events very
quickly. When an interrupt occurs, the microcontroller leaves its normal flow of
program execution and jumps to a special part of the program known as the interrupt
service routine (ISR). The program code inside the ISR is executed, and upon return
from the ISR the program resumes its normal flow of execution.
The ISR starts from a fixed address of the program memory sometimes known
as the interrupt vector address. Some microcontrollers with multi-interrupt features
have just one interrupt vector address, while others have unique interrupt vector
addresses, one for each interrupt source. Interrupts can be nested such that a new
interrupt can suspend the execution of another interrupt. Another important feature of
multi-interrupt capability is that different interrupt sources can be assigned different
levels of priority. For example, the PIC18F series of microcontrollers has both lowpriority and high priority interrupts levels.
1.2.7
Brown-out Reset/Detector
Brown-out detectors, which are common in many microcontrollers, reset the
microcontroller if the supply voltage falls below a nominal value. These safety
features can be employed to prevent unpredictable operation at low voltages,
especially to protect the contents of EEPROM-type memories.
1.2.8
1.2.9
1.3
Microcontroller Architecture
This module use PIC18F4550 as the main reference as our trainer board also use the same
microcontroller model. The right place to learn the microcontroller architecture is the
datasheet. The ability to read the datasheet can be developing through experience but in
reality, it is really not that hard to understand a technical paper.
Figure 1 show the pin mapping for the PIC18F4550 model PDIP, which have 40 pin. In
summary, based on datasheet, the PIC18F4550 microcontroller has 5 input/output ports
(PORTA, PORTB, PORTC, PORTD and PORTE), 4 timers, 13 channels or pin for 10-bit analog
to digital module, 1 compare/capture/PWM module and support USB module.
1.4
Support Component
The PIC microcontroller might operate by its own, but to get higher level of efficiency,
the support components become a compulsory. The following are a few scenarios which are
quite popular related with the embedded system circuit design.
1.4.1 External Reset Circuit
Figure 2 above show how the external reset for PIC microcontroller can be done. To
use this feature, the user must enable the Master Clean Reset, MCLR configuration in
the config word setting. This feature will give the user to hard reset the embedded
system. For details of this feature, look at page 47 on PIC18F4550 datasheet.
1.4.2 Crystal Oscillator Operation and Setting
Figure 3 shows how a crystal is connected to the microcontroller. The capacitor values
depend on the mode of the crystal and the selected frequency. Table 2.4 gives the
recommended values. For example, for a 4MHz crystal frequency, use 15pF capacitors.
Higher capacitance increases the oscillator stability but also increases the start-up time.
The LP (low-power) oscillator mode is advised in applications to up to 200 KHz clock. The XT
mode is advised to up to 4MHz, and the HS (high-speed) mode is advised in applications
where the clock frequency is between 4MHz to 25MHz.
1.5
In this sub-topic, we will discuss about how to transfer the machine code into the PIC
microcontroller. To do this, the microcontroller has a special feature named In Circuit Serial
Programming, ICSP.
Microcontrollers can be serially programmed while in the end application circuit. This is
simply done with two lines for clock and data and three other lines for power, ground and
the programming voltage. This allows customers to manufacture boards with
unprogrammed devices and then program the microcontroller just before shipping the
product. This also allows the most recent firmware or a custom firmware to be
programmed.
Figure 4: Show the pin mapping of PIC18F4550, the colored pin is needed for ICSP
Figure 5: Pickit 2
For model PIC18 and above, there are a few method to transfer generated machine
code into the microcontroller, other method is using the bootloader.
Chapter 2
In this chapter, we will discuss a few sample programmes for PIC microcontroller. A
brief explanation for the written programme is use for better understanding. Before we
start, it is strongly recommended that the reader has a basic understanding of C language,
numbering format, digital system and know how to read electronic schematic diagram.
For all sample program shown in this guide, we use the same template for all
application and modify the template only for specific need application like definition of
variables, port direction depend on application and others that relevant. We would like to
recommend making 1 file for 1 application, like 1 file specific only for adc function or 1 for
lcd display only. This is for code maintenance or upgrade or for better understanding for
other people while look at our coding.
2.1
LED Blinking
//config word
#pragma config FOSC = HS
#pragma config PWRT = ON
#pragma config BOR = OFF
#pragma config WDT = OFF
#pragma config PBADEN = ON
#pragma config MCLRE = ON
#pragma config LVP = OFF
PORTD = 0xFF;
Delay10KTCYx(2000);
PORTD = 0;
Delay10KTCYx(2000);
} // while (1)
}// main
Crystal
oscillator
PIC18F4550
Figure 7: schematic diagram for pic18f4550 with led, crystal oscillator and external reset button.
2.2
LCD Display
//config word
#pragma config FOSC = HS
#pragma config PWRT = ON
#pragma config BOR = OFF
#pragma config WDT = OFF
#pragma config PBADEN = ON
#pragma config MCLRE = ON
#pragma config LVP = OFF
//global variables
rom const char string_poli[] = " Politeknik\n Mersing";
//main fucntion
void main(void)
{
PORTA = 0;
PORTB = 0;
PORTC = 0;
PORTD = 0;
PORTE = 0;
// Initialize the I/O port direction.
TRISA = 0b00010001;
TRISB = 0b00001111;
TRISC = 0b10010011;
TRISD = 0;
TRISE = 0;
// Initialize the LCD.
lcd_initialize();
// Display message
lcd_clear_msg(string_poli); //display poli name
delay_ms(500);
//wait for ~2s
//infinity looping
//while (1)
//
{
//
lcd_clear_msg("SeST Board@PMJ");
delay_ms(1250);
} // while (1)
}// main
2.2.2 Delay18.c
//
// This file provides the functions of delay for PIC18F
//
#include <p18f4550.h>
//include the PIC18F model of PIC header file
#include <delays.h>
#include "system.h"
A function named delay_10us which take-in
#include "delay18.h"
unsigned integer variables to process.
void delay_10us(unsigned int ui_10microsecond)
Another form of looping control, the follow-up
{
instruction within the curly bracket will only run if
for( ; ui_10microsecond > 0; ui_10microsecond --)
the control statement is true.
{
Delay10TCYx(5); //50 instruction cycle with 20MHz oscillator is 10us
}
}
Delay10TCYx() is a built in function within the
compiler. Different compiler might has different
void delay_ms(unsigned int ui_millisecond)
{
for( ; ui_millisecond > 0; ui_millisecond --)
{
Delay1KTCYx(5); //5K instruction cycle with 20MHz oscillator is 1ms
}
}
2.2.3 LCD.c
//
// This file provides the functions for the 2x16 LCD display in 8 bit interface
//
#include <p18f4550.h>
//include the PIC18F model of PIC header file
#include "delay18.h"
#include "system.h"
#include "lcd.h"
//private constant
/* The protocol for the LCD
R/S
DB7
DB6
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
format
0
1
A
1
D
D
DDRAM
A summary of a protocol
register of chipset for lcd
display.
DB5
0
0
0
0
0
1
DB4
0
0
0
0
1
DL
DB3
0
0
0
1
SC
N
DB2
0
0
1
D
RL
F
DB1
0
1
ID
C
X
X
DB0
1
X
S
B
X
X
Functions
Clear LCD
Return Cursor to home position
Set Cursor move direction
Enable Display/Cursor
Move Cursor/Shift Display
Set Interface Length and Display
A
D
A
D
A
D
A
D
A
D
A
D
X = Don't care
A = Address
*/
// The command code for the LCD.
#define CMD_CLEAR
#define CMD_HOME
0b00000001
0b00000010
=0
Command
Decrement
No display shift
Display Off
Cursor Off
Cursor Blink Off
Move Cursor
Shift Left
4-bit Interface
1 line
5x8 dots
=1
Character
increment
Display shift
Display On
Cursor On
Cursor Blink On
Shift Display
Shift Right
8-bit Interface
2 line
5x10 dots
This function is to
make sure the lcd
display is ready to
operate with our
setting.
}
void lcd_clear_msg(rom const char* csz_string)
{
lcd_clear();
lcd_putstr(csz_string);
}
set_lcd_rs(0);
set_lcd_data(0);
}
void set_lcd_e(unsigned char b_output)
{
LCD_E = b_output;
}
void set_lcd_rs(unsigned char b_output)
{
LCD_RS = b_output;
}
void set_lcd_data(unsigned char uc_data)
{
LCD_DATA = uc_data;
}
void lcd_display(void)
{
display_control |= MSK_D;
lcd_config(CMD_DISPLAY_CONTROL | display_control);
}
void lcd_no_display(void)
{
display_control &= ~MSK_D;
lcd_config(CMD_DISPLAY_CONTROL | display_control);
}
void lcd_cursor(void)
{
display_control |= MSK_C;
lcd_config(CMD_DISPLAY_CONTROL | display_control);
}
void lcd_no_cursor(void)
{
display_control &= ~MSK_C;
lcd_config(CMD_DISPLAY_CONTROL | display_control);
}
void lcd_cursor_blink(void)
{
display_control |= MSK_B;
lcd_config(CMD_DISPLAY_CONTROL | display_control);
}
void lcd_no_blink(void)
{
display_control &= ~MSK_B;
lcd_config(CMD_DISPLAY_CONTROL | display_control);
}
void lcd_shift_left(void)
{
2.2.4 Delay18.h
#ifndef _DELAY18_H
#define _DELAY18_H
void delay_10us(unsigned int ui_10microsecond);
void delay_ms(unsigned int ui_millisecond);
#endif
2.2.5 LCD.h
#ifndef _LCD_H
#define _LCD_H
2.2.6 System.h
// This is the header file that describes the system properties for SeST Board program
// Oscillator Frequency,
#define _XTAL_FREQ
20000000
// result in Fosc to 20MHz with 20MHz Crystal
// I/O Connections.
// Parallel 2x16 Character LCD
#define LCD_E
LATAbits.LATA3
// E clock pin is connected to RA3
#define LCD_RS
LATAbits.LATA2
// RS pin is used for LCD to differentiate data is command or
character, RA2
#define LCD_BACKLIGHT
LATAbits.LATA1
// Back light of LCD, active high, connected to RA1
#define LCD_DATA
LATD
// Data Latch of LCD is connected to PORTD, 8 bit mode
// DB7(LCD) = RD7(PIC)
// DB6(LCD) = RD6(PIC)
This is the control pins for lcd
// DB5(LCD) = RD5(PIC)
display.
// DB4(LCD) = RD4(PIC)
// DB3(LCD) = RD3(PIC)
// DB2(LCD) = RD2(PIC)
// DB1(LCD) = RD1(PIC)
// DB0(LCD) = RD0(PIC)
Figure 8: Schematic diagram for pic18f4550 interfacing with 16x2 lcd display.
2.3
//config word
#pragma config FOSC = HS
#pragma config PWRT = ON
#pragma config BOR = OFF
#pragma config WDT = OFF
#pragma config PBADEN = ON
#pragma config MCLRE = ON
#pragma config LVP = OFF
//function prototype
void test_adc(void);
//global variable
rom const char string_poli[] = " Politeknik\n Mersing";
//main fuction
void main(void)
{
// ensure all the hardware port in zero initially
PORTA = 0;
PORTB = 0;
PORTC = 0;
PORTD = 0;
PORTE = 0;
// Initialize the I/O port direction.
TRISA = 0b00010001;
TRISB = 0b00001111;
TRISC = 0b10010011;
TRISD = 0;
TRISE = 0;
// Initialize ADC.
adc_initialize();
// Initialize the LCD.
lcd_initialize();
// Display message
}// main
//adc function
void test_adc(void)
{
unsigned int ui_adc = 0;
unsigned char i = 0;
float f_adc = 0.0;
adc_on();
//activate ADC module
lcd_clear_msg("AN:
\nT:
");
// Read from the ADC and display the value.
while (1)
{
f_adc = 0.0;
for(i = 0; i < 10; i++)
{
f_adc = f_adc + (float)ui_adc_read();
previous result
}
f_adc = f_adc/10.0; //averange the result
lcd_goto(0x03);
lcd_bcd(4, (unsigned int)f_adc);
datasheet
lcd_goto(0x43);
lcd_float(1, f_adc*0.488);
}}
2.3.2 Adc.c//This file provides the functions for the ADC module
//
#include <p18f4550.h>
//include the PIC18F model of PIC header file
#include "system.h"
#include "adc.h"
void adc_initialize(void)
{
// Set Vref+ to Vdd and Vref- to Vss
ADCON1bits.VCFG1 = 0;
ADCON1bits.VCFG0 = 0;
// Set AN0 only as analog input, others AN as digital pin
ADCON1bits.PCFG3 = 1;
ADCON1bits.PCFG2 = 1;
ADCON1bits.PCFG1 = 1;
ADCON1bits.PCFG0 = 0;
2.3.2 Adc.h
#ifndef _ADC_H
#define _ADC_H
extern void adc_initialize(void);
extern void adc_on(void);
extern void adc_off(void);
extern unsigned int ui_adc_read(void);
#endif
Figure 9: Schematic diagram for pic18f4550interfacing with analog sensor and 16x2 lcd display.
2.4
Motor Controller
//config word
#pragma config FOSC = HS
#pragma config PWRT = ON
#pragma config BOR = OFF
#pragma config WDT = OFF
#pragma config PBADEN = ON
#pragma config MCLRE = ON
#pragma config LVP = OFF
//fucntion prototype
void Delay1KTCYx( unsigned char unit );
//global variables
rom const char string_poli[] = " Politeknik\n Mersing";
#define _XTAL_FREQ
20000000
//main fucntion
void main(void)
{
// ensure all the hardware port in zero initially
PORTA = 0;
PORTB = 0;
PORTC = 0;
PORTD = 0;
PORTE = 0;
// Initialize the I/O port direction.
TRISA = 0b00010001;
TRISB = 0b00001111;
TRISC = 0b10010011;
TRISD = 0;
TRISE = 0;
while (1)
{
LATDbits.LATD0=1;
LATDbits.LATD1=0;
Delay10KTCYx(200);
Delay10KTCYx(200);
Delay10KTCYx(200);
LATDbits.LATD0=0;
LATDbits.LATD1=1;
Delay10KTCYx(200);
Delay10KTCYx(200);
Delay10KTCYx(200);
} // while (1)
}// main
5V dc
motor.
Figure 10: Schematic diagram for pic18f4550 with L293D motor driver for dc motor control.
To control motor with pic microcontroller only is quite
impossible, but depend on type of motor. Motor
characteristic operations normally need high current
particularly during the kick-start. That why we use motor
driver whenever we want to control motor. It help to
regulate the current usage by motor. The motor driver has
its own power supply thus it not dependable to
microcontroller for power source. This will make sure a
smooth power supply to motor. Check datasheet for L293D
motor driver.
2.5
Keypad
//config word
#pragma config FOSC = HS
#pragma config PWRT = ON
#pragma config BOR = OFF
#pragma config WDT = OFF
#pragma config PBADEN = ON
#pragma config MCLRE = ON
#pragma config LVP = OFF
//function prototype
void test_keypad(void);
rom const char string_poli[] = " Politeknik\n Mersing";
//main fucntion
void main(void)
{
// ensure all the hardware port in zero initially
PORTA = 0;
PORTB = 0;
PORTC = 0;
PORTD = 0;
PORTE = 0;
// Initialize the I/O port direction.
TRISA = 0b00010001;
TRISB = 0b00001111;
TRISC = 0b10010011;
TRISD = 0;
TRISE = 0;
// Initialize the LCD.
lcd_initialize();
// Display message
lcd_clear_msg(string_poli); //display poli
delay_ms(500);
//wait for ~2s
while (1)
{
test_keypad();
} // while (1)
}// main
void test_keypad(void)
{
unsigned char i = 0;
char c_pressed_key;
static char sz_keys_array[] = "123A456B789C*0#D";
// Display message
lcd_clear_msg("Test Keypad\nPlease press:");
// Loop to test every key in the keypad
while (sz_keys_array[i] != '\0')
{
// Display message
lcd_goto(0x4E);
lcd_putchar(sz_keys_array[i]);
2.5.2 Keypad.c
//keypad.c
#include <p18f4550.h>
#include "system.h"
#include "delay18.h"
#include "keypad.h"
delay_10us(1);
if (KP_C1 == 0) return 1;
if (KP_C2 == 0) return 2;
if (KP_C3 == 0) return 3;
if (KP_C4 == 0) return 10;
KP_R1 = 1;
// scan keypress on 2nd row: 4, 5, 6, B
KP_R2 = 0;
KP_R3 = 1;
KP_R4 = 1;
//Delay a short time for the pin to get to correct state before detecting proper key
delay_10us(1);
if (KP_C1 == 0) return 4;
// Key '4' is pressed
if (KP_C2 == 0) return 5;
// Key '5' is pressed
if (KP_C3 == 0) return 6;
// Key '6' is pressed
if (KP_C4 == 0) return 11;
// Key 'B' is pressed, we will store as 11
KP_R1 = 1;
// scan keypress on 3rd row: 7, 8, 9, C
KP_R2 = 1;
KP_R3 = 0;
KP_R4 = 1;
//Delay a short time for the pin to get to correct state before detecting proper key
delay_10us(1);
if (KP_C1 == 0) return 7;
// Key '7' is pressed
if (KP_C2 == 0) return 8;
// Key '8' is pressed
if (KP_C3 == 0) return 9;
// Key '9' is pressed
if (KP_C4 == 0) return 12;
// Key 'C' is pressed, we will store as 12
KP_R1 = 1;
// scan keypress on 4th row: *, 0, #, D
KP_R2 = 1;
KP_R3 = 1;
KP_R4 = 0;
//Delay a short time for the pin to get to correct state before detecting proper key
delay_10us(1);
if (KP_C1 == 0) return 14;
// Key '*' is pressed, we will store as 14
if (KP_C2 == 0) return 0;
// Key '0' is pressed
if (KP_C3 == 0) return 15;
// Key '#' is pressed, we will store as 15
if (KP_C4 == 0) return 13;
// Key 'D' is pressed, we will store as 13
return 0xFF;
}
unsigned char c_key_to_ASCII (unsigned char key_number)
{
// if number is from 0 to 9, convert to ASCII character by adding 0x30
if (key_number < 10)
return key_number + 0x30;
// if number is greater than 9, it is alphabet and symbol
if (key_number == 10) return 'A';
// convert to ASCII A
if (key_number == 11) return 'B';
// convert to ASCII B
if (key_number == 12) return 'C';
// convert to ASCII C
if (key_number == 13) return 'D';
// convert to ASCII D
if (key_number == 14) return '*';
// convert to ASCII *
if (key_number == 15) return '#';
// convert to ASCII #
return 0; //no key pressed, return null
}
2.5.3 Keypad.h
#ifndef _KEYPAD_H
#define _KEYPAD_H
extern unsigned char c_read_keypad(void);
extern unsigned char c_key_to_ASCII (unsigned char key_number);
extern unsigned char c_wait_keypad(void);
#endif
Figure 11: Schematic diagram for pic18f4550 interfacing with 4x4 keypad and 16x2 lcd display.
Chapter 3
From the previous chapter, we can see a few of simple program which intended to make
better understanding before we go for much complicated embedded system project.
Therefore, below is a list for a few concepts in Part II of our guide book that we can use to
enhance the level of complexity of the project.
3.1
The pulse width modulation (PWM) mode produces a PWM output at 10-bit resolution. A
PWM output is basically a square waveform with a specified period and duty cycle.
The PWM is quite useful if we intend to control motor. The sample program in chapter 2
only shows how to control rotation, but not the speed. If we need to control the speed
rotation of the motor, we must apply the PWM element in the motor control instruction.
Detail program will be in Part II of our guide book.
3.2
Interrupt
An interrupt is an event that requires the CPU to stop normal program execution and then
execute a program code related to the event causing the interrupt. Interrupts can be
generated internally (by some event inside the chip) or externally (by some external event).
An example of an internal interrupt is a timer overflowing or the A/D completing a
conversion. An example of an external interrupt is an I/O pin changing state.
Interrupts can be useful in many applications such as:
Some applications may need to know when a task, such as an A/D conversion, is completed. This can
be accomplished by continuously checking the completion flag of the A/D converter. A more elegant
solution would be to enable the A/D completion interrupt so the CPU is forced to read the converted
data as soon as it becomes available.
Interrupts in the PIC18F family can be divided into two groups: high priority and low priority.
Applications that require more attention can be placed in the higher priority group. A highpriority interrupt can stop a low-priority interrupt that is in progress and gain access to the
CPU.
However, high-priority interrupts cannot be stopped by low-priority interrupts. If the
application does not need to set priorities for interrupts, the user can choose to disable the
priority scheme so all interrupts are at the same priority level. High-priority interrupts are
vectored to address 00008H and low-priority ones to address 000018H of the program
memory. Normally, a user program code (interrupt service routine, ISR) should be at the
interrupt vector address to service the interrupting device.
Interrupt also can be used to detect pressed button when interfacing with keypad. More
detail explanation and program sample code will be in our Part II guide book.
3.3
The PIC18F4550 microcontroller support for usb connection. To use the usb feature in pic
microcontroller, the level of complexity is not for beginner, the protocol setting need to precisely
configure to get valid data. In our Part II guide book, we will include a sample application of
controlling an output port using a computer and pic microcontroller using usb connection.
References
[1]
[2]