0x2007 x 2 == 0x400E The addresses in the hex file are byte addresses. Bob Ammerman RAm Systems (contract development of high performance, high function, low-level software) ----- Original Message ----- From: "Brandon Fosdick" To: Sent: Saturday, June 30, 2001 11:48 PM Subject: [PIC]:HEX file question > I'm sure this is a stupid question, but I can't find the answer. > > I'm trying to decipher the hex file format (so the unix pocket software > can load it). The configuration word is giving me problems. > > Compiling this asm file... (with either mpasm or gpasm) > > ;; test.asm > radix hex > list p=PIC16F877 > include "p16f877.inc" > __CONFIG _HS_OSC & _CP_OFF & _WDT_OFF > > org 0x0 > ; Initialize PORTA, Digital Input<0:7>(Default) > bsf STATUS, RP0 ; Select Bank 1 > movlw 0x06 ; Configure all pins > movwf ADCON1 ; as digital inputs > movlw 0x01 ; 0:input, 1-7:output > movwf TRISA > ; Initialize PORTB: Digital Inputs<0:7>(Default), No Pullups(Default) > ; Power-up defaults > movlw 0x0 > movwf TRISB > ; Initialize PORTC: Digital Inputs<0:5>, USART<6,7> > ; Set PORTC pin directions > bcf TRISC, 6 ;<0:5,7> Input, <6> Output > ; Initialize the USART > ; movlw CALC_HIGH_BAUD(9600) ;9600bps when BRHG=1 > movlw 0x81 > movwf SPBRG > bsf TXSTA, TXEN ; Enable transmit > bsf TXSTA, BRGH ; High baud rate > bcf STATUS, RP0 ; Bank 0 > bsf RCSTA, SPEN ; Enable the serial port > main > movlw b'11110000' > movwf PORTB > goto main > end > > produces this hex file... > > :10000000831606309F0001308500003086000713FC > :10001000813099009816181583129817F0308600D1 > :020020000E28A8 > :02400E00FA3F77 > :00000001FF > > The line in question being... > > :02400E00FA3F77 > > ...which as far as I can tell says to put 0x3FFA at address 0x400E. > 0x3FFA is the configuration word for this file and all the other lines > reference space in program memory, so I'm fairly certain this line is > talking about the config word. Looking at the 16F87X datasheet > (DS30292B) tells me that the config word is at 0x2007. Now I know that > the 0x2000 space wraps at 0x3FFF so 0x400E is effectively 0x200E, but > thats still not the right address. What am I missing? > > -- > http://www.piclist.com hint: PICList Posts must start with ONE topic: > [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads > > -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads