No announcement yet.

MOVE?CB instruction in PBP generated ASM file

  • Filter
  • Time
  • Show
Clear All
new posts

  • MOVE?CB instruction in PBP generated ASM file

    Can someone explain the ?CB in the MOVE?CB instruction I see in a PBP generated ASM file? MOVE?CB is not listed by Microchip in their documentation. I see things listed like: movf, movwf, etc. What instruction listed by Microchip is MOVE?CB equivalent to? If it can be equivalent to any Microchip mov instruction how can I determine which mov instruction it is equivalent to?

  • #2
    It's not an assembly instruction at the lowest level but rather an assembly macro (which in turn consists of one or more instructions) and if I'm not mistaken what the MOVE?CB macro does is move (or copy) a [C]onstant into a [B]yte variable. If you want to see exactly what ASM instruction it (or any other) macro translates to you'll find all of them in the .mac file for the family of PICs you're targeting located in the PBP install folder.



    • #3
      Thank you, Henrik. That explains it for me. I would like to see what the macro translates to, but I can't find a .mac file for any devices. I see .mac files for projects I compiled (which don't show that particular translation) and .info files for devices containing default configurations, but no .mac files for devices.


      • #4
        i don't believe you will ever find them , i can't
        i too would love to see what these macros do also but they're location and content remain a mystery

        i have made some assumptions but i have been proved wrong in some cases


        • #5
          Seems my memory was a bit clouded.
          For the PIC18 series the the RST?RP, CHK?RP and the MOVE?CB macros can be found in pbppic18.lib - not pbppic18.mac which I initially thought. Both these files are available and readable (with Notepad for example) in the PBP3 folder.


          • #6
            thanks henrik , i had given up too soon it seems


            • #7
              Yes, thank you, Henrik. Actually, I did also find a pbppic18.mac file while searching for the pbppic18.lib file, in the same folder. I missed that somehow in my previous search for .mac files. I can't say I understand all I see in there yet, but, sure enough, there is the macro for MOVE?CB in that .lib file.

              What would be real useful is a single ASM file with everything in one place that MPASM uses to create the HEX file. But, I guess there is no such thing.


              • #8
                The lib and mac files for PBP3 have evolved a bit in recent years. To find the correct files, first refer to the PBPINC file for the PIC you're using. It will be in the DEVICES folder within the PBP installation folder. Within that file (example: PIC18F26K42.PBPINC), you'll find a LIBRARY directive that looks something like this:

                LIBRARY "pbp_pic18FxxK42"

                For PIC18 parts, there will two directives - one for a compile using LONGs and one for not-LONGs. Only one LIBRARY directive can be used. The lib and mac files in play will be the name shown with the appropriate extensions. In the example above, for a K42 device and a non-long compile, the files in play are "pbp_pic18FxxK42.lib" and "pbp_pic18FxxK42.mac" and the old generic files are not used (pbppic18.lib / pbppic18.mac).

                If you place your own .PBPINC file in the source folder alongside the .PBP file you are compiling, PBP will use it instead of the default file from the DEVICES folder. You can then modify the LIBRARY directive with your custom lib/mac file name and PBP will look for your new files in the PBP installation folder. This can be useful when you need to change the way a command works by modifying the assembly language.

                The .RAM files hold declarations for PBP's internal variables.

                The .HWLIB files are included for specific chips to handle peripheral-based commands like HPWM. (Mostly HPWM, in fact. The command from Hell.) These files are specified by a macro placed in the PBPINC file, which is then substituted into the .LIB file during assembly in order to include the HWLIB file. A flag is defined to disable the default command code. Simple, right?

                The .DEVICES files determine the parts that are shown in the dropdown list in Microcode Studio. You can't add devices to these files, but you can remove the ones you don't want to see in the list. There are four files with filenames 1,2,3 and 4. The number corresponds to the last number in the PBP3 version. If you use PBP Gold Edition, the PBP version will be 3.x.x.4. Silver will be 3.x.x.3. Gold will get its list from 4.DEVICES, Silver from 3.DEVICES. (2 is Student, 1 is the 2-week trial version.)
                Charles Leo
                ME Labs, Inc.


                • #9
                  Another post with some great information. I need to start collecting these as addendums to the manual.
                  Thanks Charles!