Microcontrollers session. What is Microcontroller? Microcontroller is composed of microprocessor,ram, flash memory,EEPROM and some modules like timers,

Slides:



Advertisements
Similar presentations
Working with time: interrupts, counters and timers Chapter Six Dr. Gheith Abandah1.
Advertisements

Electronics Design Lab TUTORIAL PIC Microcontrollers Francesco Tenore 2/10/2006.
م/محمد علي عطية حسين. Pin Diagram DescriptionPin Name Oscillator crystal input/external clock source input. OSC1/CLKIN Oscillator crystal output.OSC2/CLKOUT.
ECT 357 Ch 16 Output Control. Today’s Quote: The measure of a man is not how great his faith is bt how great his love is. The measure of a man is not.
Slides created by: Professor Ian G. Harris Inputs and Outputs PIC Vcc RA3 RA4 RA5  Make an LED toggle state when button is pressed  Need to read RA3,
Data acquisition and manipulation
Introduction of Holtek HT-46 series MCU
Eng. Husam Alzaq The Islamic Uni. Of Gaza
5-1 Timer/Counters In many microprocessor systems we need to:  count logic pulses  measure the frequency of signals  measure the period of pulses 
Railway Foundation Electronic, Electrical and Processor Engineering.
Taking timing further Chapter Nine 9.1 – 9.8 Dr. Gheith Abandah1.
Microprocessor Systems Design I Instructor: Dr. Michael Geiger Fall 2013 Lecture 26: PIC microcontroller intro.
Timers and Interrupts Shivendu Bhushan Summer Camp ‘13.
Microcontroller Architecture— PIC18F Family
Railway Foundation Electronic, Electrical and Processor Engineering.
Microcontroller Architecture PIC18F Family
Today’s Lecture List the Timers of PIC18 and their associated registers Describe the various modes of the PIC18 timers Program the PIC18 timers in Assembly.
V 0.21 Timers A timer on a  C is simply a counter The input clock frequency to a timer can be prescaled so that it is some fraction of the system clock.
Building Assembler Programs Chapter Five Dr. Gheith Abandah1.
System Clocks.
16F877A. Timer 0 The Timer0 module timer/counter has the following features: –8-bit timer/counter –Readable and writable –8-bit software programmable.
Timers ELEC 330 Digital Systems Engineering Dr. Ron Hayne
Timers The timers of the PIC16C7X microcontroller can be briefly described in only one sentence. There are three completely independent timers/counters.
I/O PORTS (Simplest Peripherals) PORT A: 6 bits wide (7th and 8th bit always read as 0) PORT B: 8 bits wide PORT C: 8 bits wide PORT D: 8 bits wide.
MCU: Interrupts and Timers Ganesh Pitchiah. What’s an MCU ?
Digital to Analogue Converter
Directives, Memory, and Stack. Directives Special commands to the assembler May or may not generate machine code Categories by their function Programming.
PIC16F877 ISR Points to note Interrupt Triggers –Individual interrupt flag bits are set, regardless of the status of their corresponding mask bit, PEIE.
Time Measurement Capture Mode of the Capture/Compare/PWM module is used for time measurement. TMR1 or TMR3 16-bit value transferred to 16-bit capture.
MICROCONTROLLER SYSTEMS Part 1. Figure 1.1Elements of a digital controller CPU Central Processing Unit Input Peripherals Output Peripherals ROM Read Only.
Atmel Atmega128 Overview ALU Particulars RISC Architecture 133, Mostly single cycle instructions 2 Address instructions (opcode, Rs, Rd, offset) 32x8 Register.
CCP MODULES  The CCP module (Capture/Compare/PWM) is a peripheral which allows the user to time and control different events.  Capture Mode provides.
Timers and Interrupts Anurag Dwivedi. Let Us Revise.
EEE237 Introduction to Microprocessors Week x. SFRs.
Teachers Name : Suman Sarker Telecommunication Technology Subject Name : Microcontroller & Embedded System Subject Code : 6871 Semester : 7th Department.
Architecture and instruction set. Microcontroller Core Features:  Operating speed: DC - 20 MHz clock input DC ns instruction cycle Up to 8K x.
Saxion University of Applied Sciences Advanced Microcontrollers A practical approach.
Interrupts  An interrupt is any service request that causes the CPU to stop its current execution stream and to execute an instruction stream that services.
I NTRODUCTION TO PIC PROGRAMMING By : S HERIF H ARHASH.
Features of the PIC18 microcontroller - 8-bit CPU - 2 MB program memory space (internal 32KB to 128KB) bytes to 1KB of data EEPROM - Up to 4096 bytes.
Working with Time: Interrupts, Counters and Timers
PIC16F887.
PIC12F629/675. “Wide variety” 8-84 pin RISC core, 12/14/16bit program word USART/AUSART, I 2 C, ADC, ICSP, ICD OTP/UV EPROM/FLASH/ROM Families: PIC12,
Interrupts ELEC 330 Digital Systems Engineering Dr. Ron Hayne Images Courtesy of Ramesh Gaonkar and Delmar Learning.
Programming PIC 16F84A in Assembly. PIC16F84 pin-out and required external components.
I/O PORTS. General purpose I/O pins can be considered the simplest of peripherals. They allow the PICmicro™ to monitor and control other devices. To add.
Special Features. Device Configuration bits Revision Device Configuration bits Revision On-chip Power-on Reset (POR) Revision On-chip Power-on Reset (POR)
One more PIC18F252 example and revision for exam B222L Branislav Vuksanovic, UoP, ECE.
TIMERS.
Timer modules in PIC 16F877.  The PIC 16F877 basically has three independent timer modules,  denoted by the symbols, TIMER-0, TIMER1,andTIMER2. . These.
 Mini-Computer ◦ Microprocessor  The Brains  Arithmetic Logic Unit (ALU)  Control Unit  Program/ Data Storage  Peripherals (Input/Output)  Low-Cost.
16F877A.
Chapter 9 PIC18 Timer Programming in Assembly
Microprocessor Systems Design I
Microprocessor Systems Design I
INT. TO EMBEDDED SYSTEMS DEVELOPMENT
Microprocessor Systems Design I
Microprocessor Systems Design I
Microprocessors Timers
Microprocessor Systems Design I
EECE.3170 Microprocessor Systems Design I
The PIC uCs PIC Microcontroller and Embedded Systems Muhammad Ali Mazidi, Rolin McKinlay and Danny Causey Eng. Husam Alzaq The Islamic Uni. Of Gaza 11-1.
Pugazhendhi.M 11/12/2018 TIMERS 11/12/2018 CCET CCET.
PIC18 Timer Programming “Explain the assembly language programming for the timer and counter module”
ADC and DAC Data Converter
EECE.3170 Microprocessor Systems Design I
EECE.3170 Microprocessor Systems Design I
ADC and DAC Data Converter
PIC18 Interrupt Programming
Timers Chapter 2.
Presentation transcript:

Microcontrollers session

What is Microcontroller? Microcontroller is composed of microprocessor,ram, flash memory,EEPROM and some modules like timers, Analog to Digital converter, CCP, USART, etc.… Ahmed Hussam 2

The Microprocessor:  In the PIC there is a processor that can execute only some instructions according to its type (8, 16, 32, 64 bits).  The instructions are excited by the processor in four main steps : (fetch, decode, execute, store )  The speed of the microprocessor is how many instructions can be executed in one second  The processor speed depends on the crystal oscillator frequency so by increasing the crystal frequency the speed of the processor increase Ahmed Hussam 3

Memory organization (Flash Memory) - The PIC18F has a 21-bit program counter (PC)it can address 2 Mbyte (221 locations). -PC determines the address of the instruction to fetch for execution. -The size of any instruction is 1 words excepts 4 instruction that takes 2 words. (word=2 byte) Ahmed Hussam4

Memory organization (RAM) Ahmed Hussam 5

Assembly instructions  There are 75 assembly instruction.  The most important instructions are : (MOVLW, MOVWF, MOVF, MOVFF, ADDWF, CLRF, SETF, BCF, BSF, BRA, GOTO,BTFSS, BTFSC, CPFSGT, CPFSLT, CPFSEQ, RETURN, RETFIE FAST) Ahmed Hussam6

7

8

9

List of symbols used in instruction set Ahmed Hussam10

Digital input/output ports  Some pins of the I/O ports are multiplexed with an alternate function from the peripherals of the MCU.  If the PIN is enabled as I/O other function is disabled.  Each port has three registers for its operation: TRIS register: Data direction register PORT register: read the levels (1 or 0) of the pins LAT register: output latch (we clear it always once at the beginning)  Any bit in TRIS determine the direction of its corresponding bit/pin in the PORT.  If TRIS bit =1 corresponding PORT pin is Input  If TRIS bit =0 corresponding PORT pin is Output Ahmed Hussam 11

 Example: write an initializing code for PORTA to set RA4 as an O/P while the rest of pins are set as I/P.  Solution: clrf PORTA, ACCESS clrf LATA, ACCESS movlw 0XEF ; (1 Input, 0 Output) movwf TRISA, ACCESS ;set all PORTA pins are I/P except RA4 is o/p. Ahmed Hussam12

Analog to digital convertor (ADC) Ahmed Hussam13

How to use the ADC ??  There are 5 special function registers (SFR) used in the ADC MODULE IN PIC 18F4620  A/D Result High Register (ADRESH)  A/D Result Low Register (ADRESL)  A/D Control Register 0 (ADCON0)  A/D Control Register 1 (ADCON1)  A/D Control Register 2 (ADCON2) Ahmed Hussam14

bit 7-6 Unimplemented: Read as ‘0’ bit 5-2 CHS3:CHS0: Analog Channel Select bits 0000 = Channel 0 (AN0) 0001 = Channel 1 (AN1) 0010 = Channel 2 (AN2) 0011 = Channel 3 (AN3) 0100 = Channel 4 (AN4) 0101 = Channel 5 (AN5)(1,2) 0110 = Channel 6 (AN6)(1,2) 0111 = Channel 7 (AN7)(1,2) 1000 = Channel 8 (AN8) 1001 = Channel 9 (AN9) 1010 = Channel 10 (AN10) 1011 = Channel 11 (AN11) 1100 = Channel 12 (AN = Unimplemented(2) 1110 = Unimplemented(2) 1111 = Unimplemented(2) Ahmed Hussam 15

 bit 1 GO/DONE: A/D Conversion Status bit  When ADON = 1:  1 = A/D conversion in progress  0 = A/D Idle  bit 0 ADON: A/D On bit  1 = A/D converter module is enabled  0 = A/D converter module is disabled Ahmed Hussam16

bit 7-6 Unimplemented: Read as ‘0’ bit 5 VCFG1: Voltage Reference Configuration bit (VREF- source) 1 = VREF- (AN2) 0 = VSS bit 4 VCFG0: Voltage Reference Configuration bit (VREF+ source) 1 = VREF+ (AN3) 0 = VDD Ahmed Hussam17

Ahmed Hussam18

bit 7 ADFM: A/D Result Format Select bit 1 = Right justified 0 = Left justified bit 6 Unimplemented: Read as ‘0’ bit 5-3 ACQT2:ACQT0: A/D Acquisition Time Select bits 111 = 20 TAD 110 = 16 TAD 101 = 12 TAD 100 = 8 TAD 011 = 6 TAD 010 = 4 TAD 001 = 2 TAD 000 = 0 TAD(1) bit 2-0 ADCS2:ADCS0: A/D Conversion Clock Select bits 111 = FRC (clock derived from A/D RC oscillator)(1) 110 = FOSC/ = FOSC/ = FOSC/4 011 = FRC (clock derived from A/D RC oscillator)(1) 010 = FOSC/ = FOSC/8 000 = FOSC/2 Ahmed Hussam 19

The acquisition time bits table Ahmed Hussam20

ADC block diagram Ahmed Hussam21

Pulse width modulation (PWM)  CCP module is a module can used in one of three modes  1- Capture  2- Compare  3- PWM  PWM is used to control on the width of the pulse and its frequency  in pwm mode you must run timer 2 to determine the frequency and the pulse width  There are three SFR used to control the ccp module  1- CCP1CON  2-CCP1RL  3-CCP1RH Ahmed Hussam22

Ahmed Hussam23 bit 7-6 Unimplemented: Read as ‘0’ bit 5-4 DCxB1:DCxB0: PWM Duty Cycle bit 1 and bit 0 for CCP Module x Capture mode: Unused. Compare mode: Unused. PWM mode: These bits are the two LSbs (bit 1 and bit 0) of the 10-bit PWM duty cycle. The eight MSbs (DCx9:DCx2) of the duty cycle are found in CCPRxL. you also need two SFR in timer 2 1- T2CON 2- PR2 the pwm module in pic 18F4620 is 10 bits pwm.

 bit 3-0 CCPxM3:CCPxM0: CCP Module x Mode Select bits  0000 = Capture/Compare/PWM disabled (resets CCP module)  0001 = Reserved  0010 = Compare mode, toggle output on match (CCPIF bit is set)  0011 = Reserved  0100 = Capture mode, every falling edge  0101 = Capture mode, every rising edge  0110 = Capture mode, every 4th rising edge  0111 = Capture mode, every 16th rising edge  1000 = Compare mode: initialize CCP pin low; on compare match, force CCP pin high  (CCPxIF bit is set)  1001 = Compare mode: initialize CCP pin high; on compare match, force CCP pin low  (CCPxIF bit is set)  1010 = Compare mode: generate software interrupt on compare match (CCPxIF bit is set,  CCP pin reflects I/O state)  1011 = Compare mode: trigger special event, reset timer, start A/D conversion on  CCP2 match (CCPxIF bit is set)  11xx = PWM mode Ahmed Hussam24

Timer 2 Ahmed Hussam25 bit 7 Unimplemented: Read as ‘0’ bit 6-3 T2OUTPS3:T2OUTPS0: Timer2 Output Postscale Select bits 0000 = 1:1 Postscale 0001 = 1:2 Postscale 1111 = 1:16 Postscale bit 2 TMR2ON: Timer2 On bit 1 = Timer2 is on 0 = Timer2 is off bit 1-0 T2CKPS1:T2CKPS0: Timer2 Clock Prescale Select bits 00 = Prescaler is 1 01 = Prescaler is 4 1x = Prescaler is 16

Period and duty determination  RC2 must be initialized as output for PWM.  PWM Period = (4/Fosc) * (PR2+1) * TMR2 prescale  PWM duty cycle = (1/Fosc) * (CCPR1L:CCP1CON ) * TMR2 prescale Ahmed Hussam26

Learn more about:  Capture  Compare  EEPROM  Lock up table  Interrupt  Low voltage detector  USART  CAN (found in pic 18F458) Ahmed Hussam27

Interrupt:  PIC18F has high and low priority interrupts.  High priority interrupt vector at 0X0008  Low priority interrupt vector at 0X0018  The high priority interrupt override low priority interrupt  Each interrupt source has 3 bits to control its operation: 1. Flag bit: to indicate the occurrence of the interrupt event 2. Enable bit: to enable the interrupt (allow the PC to branch to the interrupt vector address when the flag bit is set) vector address when the flag bit is set) 3. Priority bit: to select high or low priority Interrupt priority feature is enabled by setting IPEN bit in RCON register  Interrupt priority feature is enabled by setting IPEN bit in RCON register. Ahmed Hussam 28

Ahmed Hussam29 bit 7 GIE/GIEH: Global Interrupt Enable bit When IPEN = 0: 1 = Enables all unmasked interrupts 0 = Disables all interrupts When IPEN = 1: 1 = Enables all high priority interrupts 0 = Disables all interrupts bit 6 PEIE/GIEL: Peripheral Interrupt Enable bit When IPEN = 0: 1 = Enables all unmasked peripheral interrupts 0 = Disables all peripheral interrupts When IPEN = 1: 1 = Enables all low priority peripheral interrupts 0 = Disables all low priority peripheral interrupts

 bit 5 TMR0IE: TMR0 Overflow Interrupt Enable bit  1 = Enables the TMR0 overflow interrupt  0 = Disables the TMR0 overflow interrupt  bit 4 INT0IE: INT0 External Interrupt Enable bit  1 = Enables the INT0 external interrupt  0 = Disables the INT0 external interrupt  bit 3 RBIE: RB Port Change Interrupt Enable bit  1 = Enables the RB port change interrupt  0 = Disables the RB port change interrupt  bit 2 TMR0IF: TMR0 Overflow Interrupt Flag bit  1 = TMR0 register has overflowed (must be cleared in software)  0 = TMR0 register did not overflow  bit 1 INT0IF: INT0 External Interrupt Flag bit  1 = The INT0 external interrupt occurred (must be cleared in software)  0 = The INT0 external interrupt did not occur  bit 0 RBIF: RB Port Change Interrupt Flag bit  1 = At least one of the RB7:RB4 pins changed state (must be cleared in software)  0 = None of the RB7:RB4 pins have changed state Ahmed Hussam30

Ahmed Hussam31 bit 7 RBPU: PORTB Pull-up Enable bit 1 = All PORTB pull-ups are disabled 0 = PORTB pull-ups are enabled by individual port latch values bit 6 INTEDG0: External Interrupt 0 Edge Select bit 1 = Interrupt on rising edge 0 = Interrupt on falling edge bit 5 INTEDG1: External Interrupt 1 Edge Select bit 1 = Interrupt on rising edge 0 = Interrupt on falling edge bit 4 INTEDG2: External Interrupt 2 Edge Select bit 1 = Interrupt on rising edge 0 = Interrupt on falling edge bit 3 Unimplemented: Read as ‘0’ bit 2 TMR0IP: TMR0 Overflow Interrupt Priority bit 1 = High priority 0 = Low priority bit 1 Unimplemented: Read as ‘0’ bit 0 RBIP: RB Port Change Interrupt Priority bit 1 = High priority 0 = Low priority

Ahmed Hussam32 bit 7 INT2IP: INT2 External Interrupt Priority bit 1 = High priority 0 = Low priority bit 6 INT1IP: INT1 External Interrupt Priority bit 1 = High priority 0 = Low priority bit 5 Unimplemented: Read as ‘0’ bit 4 INT2IE: INT2 External Interrupt Enable bit 1 = Enables the INT2 external interrupt 0 = Disables the INT2 external interrupt bit 3 INT1IE: INT1 External Interrupt Enable bit 1 = Enables the INT1 external interrupt 0 = Disables the INT1 external interrupt bit 2 Unimplemented: Read as ‘0’ bit 1 INT2IF: INT2 External Interrupt Flag bit 1 = The INT2 external interrupt occurred (must be cleared in software) 0 = The INT2 external interrupt did not occur bit 0 INT1IF: INT1 External Interrupt Flag bit 1 = The INT1 external interrupt occurred (must be cleared in software) 0 = The INT1 external interrupt did not occur

Timer 0 with interrupt  Timer 0 interrupts when an over flow happens in tmr0l (when TMR0 is in 8 bits mode)  To use timer 0 there are three SFR are used  1- T0CON  2- TMR0L  3- TMR0H Ahmed Hussam33

Ahmed Hussam 34 bit 7 TMR0ON: Timer0 On/Off Control bit 1 = Enables Timer0 0 = Stops Timer0 bit 6 T08BIT: Timer0 8-bit/16-bit Control bit 1 = Timer0 is configured as an 8-bit timer/counter 0 = Timer0 is configured as a 16-bit timer/counter bit 5 T0CS: Timer0 Clock Source Select bit 1 = Transition on T0CKI pin 0 = Internal instruction cycle clock (CLKO) bit 4 T0SE: Timer0 Source Edge Select bit 1 = Increment on high-to-low transition on T0CKI pin 0 = Increment on low-to-high transition on T0CKI pin bit 3 PSA: Timer0 Prescaler Assignment bit 1 = TImer0 prescaler is NOT assigned. Timer0 clock input bypasses prescaler. 0 = Timer0 prescaler is assigned. Timer0 clock input comes from prescaler output. bit 2-0 T0PS2:T0PS0: Timer0 Prescaler Select bits 111 = 1:256 Prescale value 110 = 1:128 Prescale value 101 = 1:64 Prescale value 100 = 1:32 Prescale value 011 = 1:16 Prescale value 010 = 1:8 Prescale value 001 = 1:4 Prescale value 000 = 1:2 Prescale value

Digital input output example  Make a program that takes a digital signal from a push buttom so that when you push the button a led illuminates ORG 0X  CLRF PORTD,ACCESS  CLRF LATD,ACCESS  MOVLW 0X01  MOVWF TRISD,ACCESS  AGAIN  BTFSS PORTD,0,ACCESS  BRA L1  BSF PORTD,1,ACCESS  BRA L2  L1  BCF PORTD,1,ACCESS  L2  BRA AGAIN Ahmed Hussam 35

Analog read example  Make a program that read analog signal from a potentiometer so that when the volt is greater 2.5 volt make a led illuminates Ahmed Hussam36

 ORG 0X  MOVLW 0X01  MOVWF ADCON0,ACCESS  CLRF ADCON1,ACCESS  MOVLW 0X2A  MOVWF ADCON2,ACCESS  CLRF PORTD,ACCESS  CLRF LATD,ACCESS  CLRF TRISD,ACCESS  AGAIN  BSF ADCON0,1,ACCESS  L1  BTFSC ADCON0,1,ACCESS  BRA L1  MOVLW 0X80  CPFSLT ADRESH,ACCESS  BRA L2  BCF PORTD,0,ACCESS  BRA L3  L2  BSF PORTD,0,ACCESS  L3  BRA AGAIN Ahmed Hussam 37

Pwm example  Make a program that read an analog signal from a potentiometer and take the result as 8 bit from the adc and use it in the pwm module where the frequency of the signal is 1 KHz Ahmed Hussam38

 ORG 0X  MOVLW 0X01  MOVWF ADCON0,ACCESS  CLRF ADCON1,ACCESS  MOVLW 0X2A  MOVWF ADCON2,ACCESS  CLRF PORTC,ACCESS  CLRF LATC,ACCESS  CLRF TRISC,ACCESS  MOVLW 0X0F  MOVWF CCP1CON,ACCESS  MOVLW 0X07  MOVWF T2CON,ACCESS  AGAIN  BSF ADCON0,1,ACCESS  L1  BTFSC ADCON0,1,ACCESS  BRA L1  MOVFF ADRESH,CCPR1L  BRA AGAIN Ahmed Hussam39

Timer 0 with interrupt example  Make a program of led flasher that make the led illuminats for one second then the led is turned of for one second by using timer 0 in 8 bit mode using interrupt Ahmed Hussam40

 X EQU 0X00  ORG 0X00000  GOTO MAIN  ORG 0X0008  INCF X,F,ACCESS  BCF INTCON,2,ACCESS  RETFIE FAST  MAIN  MOVLW 0XA0  ;MOVLW 0X00  MOVWF INTCON,ACCESS  CLRF X,ACCESS  MOVLW 0X47  MOVWF T0CON,ACCESS  CLRF PORTD,ACCESS  CLRF LATD,ACCESS  CLRF TRISD,ACCESS  CLRF TMR0L,ACCESS  CLRF TMR0H,ACCESS  AGAIN  BTG PORTD,0,ACCESS  ;BCF PORTD,1,ACCESS Ahmed Hussam41

 CALL DELAY  ;BSF PORTD,0,ACCESS  ;CALL DELAY  BRA AGAIN   DELAY  BSF T0CON,7,ACCESS  MOVLW 0X3D  L1  CPFSGT X,ACCESS  BRA L1  CLRF X,ACCESS  BCF T0CON,7,ACCESS  CLRF TMR0L,ACCESS  CLRF TMR0H,ACCESS  RETURN Ahmed Hussam42

Configuration bits for pic 18F4620  title "PIC18F4620 counting program"  list P=PIC18F4620 ;p=18fxxx  #include ; This ?header file? contains all  ;******************************************************************************  ;my configrations  __CONFIG _CONFIG1H, _IESO_OFF_1H &_FCMEN_OFF_1H & _OSC_HS_1H ;_OSC_HSPLL_1H  __CONFIG _CONFIG2L, _BOREN_OFF_2L & _PWRT_OFF_2L  __CONFIG _CONFIG2H, _WDT_OFF_2H  __CONFIG _CONFIG3H, _PBADEN_OFF_3H  __CONFIG _CONFIG4L, _LVP_OFF_4L & _STVREN_OFF_4L  __CONFIG _CONFIG5L, _CP0_OFF_5L & _CP1_OFF_5L & _CP2_OFF_5L & _CP3_OFF_5L  __CONFIG _CONFIG5H, _CPB_OFF_5H & _CPD_OFF_5H  __CONFIG _CONFIG6L, _WRT0_OFF_6L & _WRT1_OFF_6L & _WRT2_OFF_6L & _WRT3_OFF_6L  __CONFIG _CONFIG6H, _WRTB_OFF_6H & _WRTC_OFF_6H & _WRTD_OFF_6H  __CONFIG _CONFIG7L, _EBTR0_OFF_7L & _EBTR1_OFF_7L & _EBTR2_OFF_7L & _EBTR3_OFF_7L  __CONFIG _CONFIG7H, _EBTRB_OFF_7H  Ahmed Hussam 43

 ;******************************************************************************  ;X EQU 0X00  ORG 0X00000  GOTO MAIN  ORG 0X0008   RETFIE FAST   MAIN  ;put your code here   END Ahmed Hussam44

Configuration bits for pic 18F452  title "PIC18F452 counting program"  list P=PIC18F452 ;p=18fxxx,f=inhx32  #include ; This ?header file? contains all   ;******************************************************************************  ;Configuration bits  ; The __CONFIG directive defines configuration data within the.ASM file.  ; The labels following the directive are defined in the P18F458.INC file.  ; The PIC18FXX8 Data Sheet explains the functions of the configuration bits.  ; Change the following lines to suit your application.  __CONFIG _CONFIG1H, _OSCS_OFF_1H & _HS_OSC_1H ; _HSPLL_OSC_1H  __CONFIG _CONFIG2L, _BOR_OFF_2L & _PWRT_OFF_2L  __CONFIG _CONFIG2H, _WDT_OFF_2H  __CONFIG _CONFIG4L, _STVR_OFF_4L & _LVP_OFF_4L  __CONFIG _CONFIG5L, _CP0_OFF_5L & _CP1_OFF_5L & _CP2_OFF_5L & _CP3_OFF_5L  __CONFIG _CONFIG5H, _CPB_OFF_5H & _CPD_OFF_5H  __CONFIG _CONFIG6L, _WRT0_OFF_6L & _WRT1_OFF_6L & _WRT2_OFF_6L & _WRT3_OFF_6L  __CONFIG _CONFIG6H, _WRTB_OFF_6H & _WRTC_OFF_6H & _WRTD_OFF_6H  __CONFIG _CONFIG7L, _EBTR0_OFF_7L & _EBTR1_OFF_7L & _EBTR2_OFF_7L & _EBTR3_OFF_7L  __CONFIG _CONFIG7H, _EBTRB_OFF_7H  ;****************************************************************************** Ahmed Hussam 45

 ;Variable definitions  ORG 0X  GOTO MAIN  ORG 0X00008  RETFIE FAST  MAIN  ;put your code here  END Ahmed Hussam46