Download presentation
Presentation is loading. Please wait.
Published byMerryl Pierce Modified over 9 years ago
1
Microprocessor and Microcontroller Based Systems Instructor: Eng.Moayed N. EL Mobaied The Islamic University of Gaza Faculty of Engineering Electrical Engineering Department بسم الله الرحمن الرحيم ECOM 4315 — Fall 2008 Lecture 10
2
;************************ PROCESSOR 16f84 #include "p16f84.inc" __CONFIG _CP_OFF & _WDT_OFF & _PWRTE_ON & _XT_OSC ;****************************************************** ORG 0x00 goto Main ;****************************************************** Main bSf STATUS,RP0 movlw 0xff movwf TRISA movlw 0x00 movwf TRISB ;****************************************************** bcf STATUS,RP0 begin movf porta,0 movwf PORTB GOTO BEGIN END.ASM file “ to transfer 5 bits from portA to portB HEX File
3
:020000040000FA :1000000001288316FF308500003086008312050822 :040010008600072837 :02400E00F13F80 :00000001FF.HEX file “ to transfer 5 bits from portA to portB HEX File
4
How to Generates Hex file HEX File ;************************ PROCESSOR 16f84 #include "p16f84.inc" __CONFIG _CP_OFF & _WDT_OFF & _PWRTE_ON & _XT_OSC ;************************************************** **** ORG 0x00 goto Main ;************************************************** **** Main bSf STATUS,RP0 movlw 0xff movwf TRISA movlw 0x00 movwf TRISB ;************************************************** **** bcf STATUS,RP0 begin movf porta,0 movwf PORTB GOTO BEGIN MPLAB :020000040000FA :1000000001288316FF308500 003086008312050822 :040010008600072837 :02400E00F13F80 :00000001FF
5
General Record Format: Record Mark: each record begins with a Record Mark field containing 03AH,the ASCII code for the colon ' : ' character. Record Length: The number of bytes of information or data. Offset: By the offset we can arrive to the address. Record Type: It is used to interpret the remaining information within the record. Information or Data: It consists of zero or more bytes encoded as pairs of hexadecimal digits. The interpretation of this field depends on the Record Type field. Chick Sum: This field contains the check sum on the Record length, Load Offset, Record Type, and Information or Data. The hex file contains the machine language that deals with PIC microcontroller. HEX File
6
Record Type: It is used to interpret the remaining information within the record. The encoding for all the current record types are: HEX File
7
Information or Data: It consists of zero or more bytes encoded as pairs of hexadecimal digits. The interpretation of this field depends on the Record Type field. HEX File
8
Chick Sum: This field contains the check sum on the Record length, Load Offset, Record Type, and Information or Data. Therefore, the sum of all the ASCII pairs in a record after converting to binary, from the Record length field to and including the Chick Sum field, is zero. HEX File :020000040000FA :1000000001288316FF308500003086008312050822 :040010008600072837 :02400E00F13F80 :00000001FF 02 +0000 +04 +0000 =06 (checksum =ff-06+1=Fa)
9
HEX File :020000040000FA :1000000001288316FF308500003086008312050822 :040010008600072837 :02400E00F13F80 :00000001FF
10
HEX File :02 0000 04 0000 FA ;************************ PROCESSOR 16f84 #include "p16f84.inc" :020000040000FA :1000000001288316FF308500003086008312050822 :040010008600072837 :02400E00F13F80 :00000001FF
11
HEX File :02 400E 00 F13F 80 __CONFIG _CP_OFF & _WDT_OFF & _PWRTE_ON & _XT_OSC :020000040000FA :1000000001288316FF308500003086008312050822 :040010008600072837 :02400E00F13F80 :00000001FF Address =2007h*2 =400E
12
HEX File END :00 0000 01 FF :020000040000FA :1000000001288316FF308500003086008312050822 :040010008600072837 :02400E00F13F80 :00000001FF
13
HEX File :020000040000FA :1000000001288316FF308500003086008312050822 :040010008600072837 :02400E00F13F80 :00000001FF ORG 0x00 goto Main ;****************************************************** Main bSf STATUS,RP0 movlw 0xff movwf TRISA movlw 0x00 movwf TRISB ;****************************************************** bcf STATUS,RP0 begin movf porta,0 movwf PORTB GOTO BEGIN :10 0000 00 0128 8316 FF30 8500 0030 8600 8312 0508 22 :04 0010 00 8600 0728 37
14
PROGRAM MEMORY
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.