1 / 14

Microprocessor and Microcontroller Based Systems

بسم الله الرحمن الرحيم. The Islamic University of Gaza Faculty of Engineering Electrical Engineering Department. Microprocessor and Microcontroller Based Systems. ECOM 4315 — Fall 2008. Instructor: Eng.Moayed N. EL Mobaied. Lecture 10. HEX File.

bryony
Download Presentation

Microprocessor and Microcontroller Based Systems

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. بسم الله الرحمن الرحيم The Islamic University of Gaza Faculty of Engineering Electrical Engineering Department Microprocessor and Microcontroller Based Systems ECOM 4315 — Fall 2008 Instructor: Eng.Moayed N. EL Mobaied Lecture 10

  2. HEX File .ASM file “ to transfer 5 bits from portA to portB ;************************ 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

  3. HEX File .HEX file “ to transfer 5 bits from portA to portB :020000040000FA :1000000001288316FF308500003086008312050822 :040010008600072837 :02400E00F13F80 :00000001FF

  4. HEX File How to Generates 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 :020000040000FA :1000000001288316FF308500003086008312050822 :040010008600072837 :02400E00F13F80 :00000001FF MPLAB

  5. HEX File The hex file contains the machine language that deals with PIC microcontroller. 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.

  6. HEX File Record Type: It is used to interpret the remaining information within the record. The encoding for all the current record types are:

  7. HEX File 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.

  8. HEX File 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. :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 ;************************ PROCESSOR 16f84 #include "p16f84.inc" :020000040000FA :1000000001288316FF308500003086008312050822 :040010008600072837 :02400E00F13F80 :00000001FF :02 0000 04 0000 FA

  11. HEX File __CONFIG _CP_OFF & _WDT_OFF & _PWRTE_ON & _XT_OSC :020000040000FA :1000000001288316FF308500003086008312050822 :040010008600072837 :02400E00F13F80 :00000001FF Address =2007h*2 =400E :02 400E 00 F13F 80

  12. HEX File END :020000040000FA :1000000001288316FF308500003086008312050822 :040010008600072837 :02400E00F13F80 :00000001FF :00 0000 01 FF

  13. HEX File 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 :020000040000FA :1000000001288316FF308500003086008312050822 :040010008600072837 :02400E00F13F80 :00000001FF :10 0000 00 0128 8316 FF30850000308600 8312 0508 22 :04 0010 00 86000728 37

  14. PROGRAM MEMORY

More Related