Hot!HEX code PIC16F1704 - whats that

Page: 12 > Showing page 1 of 2
Author
vwt2a
New Member
  • Total Posts : 8
  • Reward points : 0
  • Joined: 2018/02/28 23:21:44
  • Location: 0
  • Status: offline
2018/03/05 00:16:42 (permalink)
0

HEX code PIC16F1704 - whats that

Hi guys,
 
I have a "interessting" file from a PIC16F1704 which is connected to a BeagleBoneBlackBoard, which
can be programmed with it. The file is attched, now the question, has anybody seen something
like that? What's that kind of code?
 
Thanks a lot for help and hints!
 
Bye, Alex
#1

23 Replies Related Threads

    coffee critic
    Super Member
    • Total Posts : 193
    • Reward points : 0
    • Status: online
    Re: HEX code PIC16F1704 - whats that 2018/03/05 11:46:58 (permalink)
    +1 (1)
    Google Intel HEX format.

    n_*$
    #2
    mbrowning
    Just a Member
    • Total Posts : 988
    • Reward points : 0
    • Joined: 2005/03/16 14:32:56
    • Location: Melbourne, FL
    • Status: online
    Re: HEX code PIC16F1704 - whats that 2018/03/05 13:35:27 (permalink)
    +1 (1)
    It's not Intel HEX format. It looks like just the contents of flash output as ASCII hex, one 14bit word per line, starting at address 0. But that's a guess.

    Can't remember. I've slept since then - Mark
    #3
    qɥb
    Monolothic Member
    • Total Posts : 2937
    • Reward points : 0
    • Joined: 2017/09/09 05:07:30
    • Location: Jupiter
    • Status: online
    Re: HEX code PIC16F1704 - whats that 2018/03/05 14:02:08 (permalink)
    0
    Indeed, it looks like a sequential dump of program memory.
    It's not the output of any Microchip compiler. Where did it come from?
     

    This forum is mis-configured so it only works correctly if you access it via https protocol.
    The Microchip website links to it using http protocol. Will they ever catch on?
    PicForum "it just works"
    #4
    coffee critic
    Super Member
    • Total Posts : 193
    • Reward points : 0
    • Status: online
    Re: HEX code PIC16F1704 - whats that 2018/03/05 14:03:03 (permalink)
    0
    I see what you mean. I reopened it in notepad++ and I see is a single column of 2 bytes. Nothing above 14bits.  

    n_*$
    #5
    jack@kksound
    code tags!
    • Total Posts : 2628
    • Reward points : 0
    • Joined: 2014/05/14 10:03:19
    • Location: 0
    • Status: online
    Re: HEX code PIC16F1704 - whats that 2018/03/05 14:17:55 (permalink)
    0
    mbrowning
    It's not Intel HEX format. It looks like just the contents of flash output as ASCII hex, one 14bit word per line, starting at address 0. But that's a guess.


    I agree, that's what that looks like (and dis-assembles like).
    #6
    1and0
    Access is Denied
    • Total Posts : 8106
    • Reward points : 0
    • Joined: 2007/05/06 12:03:20
    • Location: Harry's Gray Matter
    • Status: offline
    Re: HEX code PIC16F1704 - whats that 2018/03/05 18:15:13 (permalink)
    0
    The first few lines are:
    3186    movlp   6
    2E02    goto    0x0602
    3187    movlp   7
    2FD4    goto    0x07D4
    3010    movlw   0x10
    003D    movlb   29
    00A0    movwf   0xEA0

    #7
    qɥb
    Monolothic Member
    • Total Posts : 2937
    • Reward points : 0
    • Joined: 2017/09/09 05:07:30
    • Location: Jupiter
    • Status: online
    Re: HEX code PIC16F1704 - whats that 2018/03/05 18:37:20 (permalink)
    0
    It looks like valid code, but I doubt it's starting from address 0x0000 then.
     

    This forum is mis-configured so it only works correctly if you access it via https protocol.
    The Microchip website links to it using http protocol. Will they ever catch on?
    PicForum "it just works"
    #8
    1and0
    Access is Denied
    • Total Posts : 8106
    • Reward points : 0
    • Joined: 2007/05/06 12:03:20
    • Location: Harry's Gray Matter
    • Status: offline
    Re: HEX code PIC16F1704 - whats that 2018/03/06 00:39:36 (permalink)
    0
    That MOVLP/GOTO could be the reset vector, but those opcodes at the interrupt vector I am not so sure.
    post edited by 1and0 - 2018/03/06 00:41:34
    #9
    vwt2a
    New Member
    • Total Posts : 8
    • Reward points : 0
    • Joined: 2018/02/28 23:21:44
    • Location: 0
    • Status: offline
    Re: HEX code PIC16F1704 - whats that 2018/03/06 00:40:47 (permalink)
    0
    Hi guys,
     
    Thanks for help and support!
    No, this code is no dump/disasm. from the PIC16F1704, I attched the dump hex file.
     
    In the end, I "just", want to know what the PIC is doing...
     
    The programm "pic.txt" can be flashed via program (c++) at/via blackbeaglebone board, BUT which kind of code is this pic.txt?
    I also got the hex file from 1704 -> PICKit3 and MPLAB X IDE, but when I compare, it's different.
    So my question is, what's that pic.txt and how could I read/convert it?
     
    Attached is the code and address, etc... which are used to code/program the PIC - C code.
     
    Thanks a lot for recommendation and help!
     
    Bye, Alex


    post edited by vwt2a - 2018/03/06 00:45:28
    #10
    1and0
    Access is Denied
    • Total Posts : 8106
    • Reward points : 0
    • Joined: 2007/05/06 12:03:20
    • Location: Harry's Gray Matter
    • Status: offline
    Re: HEX code PIC16F1704 - whats that 2018/03/06 00:51:52 (permalink)
    0
    Just a guess, it looks like the opcodes in pic.txt are to be flashed into program memory locations 0x0600 to 0x0F7F of the PIC16F1704.
     
    Edit:
    address  opcode  instruction
    0600     3186    movlp 6
    0601     2E02    goto  0x0602
    0602     3187    movlp 7
    0603     2FD4    goto  0x07D4
    0604     3010    movlw 0x10
    0605     003D    movlb 29
    0606     00A0    movwf 0xEA0

    post edited by 1and0 - 2018/03/06 00:55:37
    #11
    jack@kksound
    code tags!
    • Total Posts : 2628
    • Reward points : 0
    • Joined: 2014/05/14 10:03:19
    • Location: 0
    • Status: online
    Re: HEX code PIC16F1704 - whats that 2018/03/06 08:44:14 (permalink)
    0
    The attached c code (PIC_flashing_sample_c_code.txt) looks like a bootloader and the file (PIC16F1704.hex.txt) is an application file to be loaded by the bootloader????
    #12
    vwt2a
    New Member
    • Total Posts : 8
    • Reward points : 0
    • Joined: 2018/02/28 23:21:44
    • Location: 0
    • Status: offline
    Re: HEX code PIC16F1704 - whats that 2018/03/06 10:34:41 (permalink)
    0
    The hex file is from the dump I have done. The pic.txt is loaded with the "c code", but only for updates, so normaly not used. My idea was to compare the pic.txt - available with the hexdump, but I don't know which format the pic.txt is. So how can I convert it like 1and0 has done it?
    Thanks
    #13
    jack@kksound
    code tags!
    • Total Posts : 2628
    • Reward points : 0
    • Joined: 2014/05/14 10:03:19
    • Location: 0
    • Status: online
    Re: HEX code PIC16F1704 - whats that 2018/03/06 11:33:47 (permalink)
    +1 (1)
    So how can I convert it like 1and0 has done it?

    It is referred to as "dis-assembly". You can do it "by hand" one instruction at a time by using the instruction opcode list from the data sheet, very long and tedeous. There are several "disassembers" available, some smarter and easier to use then others.
    #14
    vwt2a
    New Member
    • Total Posts : 8
    • Reward points : 0
    • Joined: 2018/02/28 23:21:44
    • Location: 0
    • Status: offline
    Re: HEX code PIC16F1704 - whats that 2018/03/07 00:41:53 (permalink)
    0
    Thanks for the info/hint, I used gpdasm and got the attched result.
    Now I "only" need to understand the code and compare it with the pic.txt but how?
    Can anybody help me in understanding the code?
     
    Also how can I convert pic.txt to ASM code (not by hand) I've tried with gpdasm but,
    this doesn't work.
     
    To compile the attched code is working and hex file is the same as hex dump.
     
    Thanks a lot!
    #15
    1and0
    Access is Denied
    • Total Posts : 8106
    • Reward points : 0
    • Joined: 2007/05/06 12:03:20
    • Location: Harry's Gray Matter
    • Status: offline
    Re: HEX code PIC16F1704 - whats that 2018/03/07 02:15:10 (permalink)
    +2 (2)
    I would not waste time on trying to understand a disassembled assembly code from someone's hex file. It will take less time to write a source code from scratch.
    #16
    vwt2a
    New Member
    • Total Posts : 8
    • Reward points : 0
    • Joined: 2018/02/28 23:21:44
    • Location: 0
    • Status: offline
    Re: HEX code PIC16F1704 - whats that 2018/03/07 04:00:18 (permalink)
    0
    hi 1and0,
     
    for sure, but then you have to know what the "old hex program" does?
     
    Is there a way to "convert" pic.txt to "normal" intel hex file/format like the dump file,
    so I can compare the pic.txt with the hex dump file?
     
    Thanks a lot!
    #17
    1and0
    Access is Denied
    • Total Posts : 8106
    • Reward points : 0
    • Joined: 2007/05/06 12:03:20
    • Location: Harry's Gray Matter
    • Status: offline
    Re: HEX code PIC16F1704 - whats that 2018/03/07 04:27:30 (permalink)
    0
    Program it into your PIC device and then read it off the PIC with your PICKit3, provided the PIC is not code protected.
    #18
    vwt2a
    New Member
    • Total Posts : 8
    • Reward points : 0
    • Joined: 2018/02/28 23:21:44
    • Location: 0
    • Status: offline
    Re: HEX code PIC16F1704 - whats that 2018/03/07 04:57:19 (permalink)
    0
    good idea!
    of course the "pic.txt" is already in the PIC. Why? because there is a routine in the c code / program which checks, PIC_update_needed and if the value x is there, it makes a update.(subroutine PIC_flashing_sample)
    It doesn't check the pic.txt for changes or something like that, it checks fixed PIC number/version in the program - x yes/no -> update with pic.txt, so far I'm quite sure pic.txt is already "in" the PIC.
     
    For my understanding, is the pic.txt the "same" / whole programm in the PIC like the hex dump or is the pic.txt just a part of it?
     
    Thanks and bye
    #19
    qɥb
    Monolothic Member
    • Total Posts : 2937
    • Reward points : 0
    • Joined: 2017/09/09 05:07:30
    • Location: Jupiter
    • Status: online
    Re: HEX code PIC16F1704 - whats that 2018/03/07 05:02:06 (permalink)
    0
    It will just be a part, because the bootloader code will be in there too.
    There's no way any of us can know if there's also something else in there that doesn't change.
     

    This forum is mis-configured so it only works correctly if you access it via https protocol.
    The Microchip website links to it using http protocol. Will they ever catch on?
    PicForum "it just works"
    #20
    Page: 12 > Showing page 1 of 2
    Jump to:
    © 2018 APG vNext Commercial Version 4.5