Newbie Question - Info Please


Closed Thread
Results 1 to 5 of 5
  1. #1
    Join Date
    Sep 2006
    Posts
    10

    Default Newbie Question - Info Please

    Just starting to get involved with programming PICS, actually first time programming anything and dived in to start work with PIC Basic. (If I tried working in Assembler I would be sure to fail. That stuff is total gobbledegook to me). So here's the question. I have an understanding of the process of going from BASIC a high level language to an Assembler file that gets assembled and converted into an object file (Intel Hex). But what are all the different files you can get that are associated with the assembler? You get an ASM file, a LST file and a MAC file. I'm I correct that the LST file is what a programmer would type in if he was programming in Assembler level language? So what do the ASM and MAC files do? Sorry to be so dense but I really am new at this and want to learn so if someone is willing to spend a little time giving the background on these definitions it would be appreciated.
    TIA

  2. #2
    Join Date
    Jan 2006
    Location
    Istanbul
    Posts
    1,185


    Did you find this post helpful? Yes | No

    Default

    Hi ehoskins,

    I have been using only HEX file and never ever needed to know about the others; and I have been able to accomplish quite succesfull projects without knowing anything about them. I do not think that I will also ever need to know about them.

    But, if of course someone explains what they are, the information will be somewhere in my mind.
    "If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte

  3. #3
    Join Date
    Jul 2005
    Posts
    78


    Did you find this post helpful? Yes | No

    Default

    OK, ready? Here we go:

    The compiler (PBP itself) makes:

    The .asm file is how the program would look if you wrote it in assembler yourself. That's one thing the compiler generates for you. The next is:

    The .mac file, basically a collection of macros that the .asm file needs. A macro is a canned set of insteuctions that an assembler can use to look up sections of code.

    These are then handed off to the assembler. I use Microchips assembler, I understand that ME Labs provides one also (that may be faster), but I like to be extra careful and use the manufacturer's (as some of my work gets used in patient connected medical devices, I need to be extra sure).

    The .hex file is a map of the program memory, plus any special locations (such as config bits), and EEPROM values if you used any.

    The .lst file is the listing of the .asm and .mac code, every line of memory and every register used in the machine code program.

    The .cod file contains symbol and debug info. You can use that in MPLAB along with the .hex file to get a pretty good picture of the maching code itself. IMPORT both those files and the simulator in MPLAB will then run a simulation of your code and let you know the lables and register names you're using.

  4. #4
    Join Date
    Sep 2006
    Posts
    10


    Did you find this post helpful? Yes | No

    Default

    ErnieM. That's terrific. What a great summary!
    So at the end when you mention you can do importing into MPLABS to get a pretty good picture of the machine code, the machine code I presume is the binary 1's and 0's? I always thought the HEX code was a hexadecimal notation version of the binary info the machine runs on. NO? I must be missing something then? After all the HEX code gets transferred to the chip memory but is that not the binary program the machine runs on?

  5. #5
    Join Date
    Jul 2005
    Posts
    78


    Did you find this post helpful? Yes | No

    Default

    [quote]I always thought the HEX code was a hexadecimal notation version of the binary info the machine runs on. NO? I must be missing something then? After all the HEX code gets transferred to the chip memory but is that not the binary program the machine runs on?[quote]

    YES! They are two ways of saying the same thing.

    HEX notation is usefull to humans who don't read binary very efficiently, but can read HEX fairly well. HEX numbers and binary numbers have a 1 to 1 corrospondance, so they are two ways of saying the same thing.

    HEX can only express binary digits 4 bits at a time, so one hex represents 4 binary digits, 2 hex digits represent 8 binary digits, and so on

    The only exception to this is PIC instructions are 14 bits long, so they need a 4 digit hex number to represent them; 4 hex digits is 4x4=16 bits for 2 extra bits at the top end, so any instruction in hex will never be larger then 7FFF

    (The actual largest instruction is 7EFF, which is ADDLW H'FF', or add literal to W. The instruction set actually gives the 7th bit as a don't care (1 or 0), but also says 0 is prefered there, and that is what the compiler will give.) (I know cause I just tried it.)

Similar Threads

  1. Newbie 74hc595 question
    By manjero in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 22nd January 2008, 22:22
  2. newbie with serial com question...
    By kevlar129bp in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 16th December 2006, 05:34
  3. Greetings from Newbie and a question
    By ChrisHelvey in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 24th July 2006, 15:52
  4. Newbie question
    By senojlr in forum General
    Replies: 7
    Last Post: - 11th April 2006, 21:23
  5. Replies: 4
    Last Post: - 8th September 2005, 15:42

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts