Jump to content
Sign in to follow this  

Asm, Lst, Hex

Recommended Posts

When I create a new project, I see three default files:






They are all missing (the compiler can't find them) and I can't build the project without them.


Can anyone help me?



Share this post

Link to post
Share on other sites

These files are located in the "Output" folder in project tree. This means that they are generated during compilation. A project is built when none of these files may be presend but once the project is built all these files will be created. When you compile .asm file gets generated, when this .asm is assembled .lst and .hex files get generated.




Share this post

Link to post
Share on other sites

You need to add to your project a .C file, like:

 int i;


Then, compile that. This will generate the .ASM file. (IF the 'C' program has good syntax. Otherwise, the ASM file won't be generated.)


Assemble that. This will generate the .LST and the .HEX file (IF you've downloaded the www.microchip.com MPLAB package, and gone in to 'Tools, Options' and set the assembler to point to the MPASM program.)


Note it helps if your are using MPLAB 5.7 or older, that you name your project an 8 character name. Any more than that, and the compiler can have a hard time finding the output files.

Share this post

Link to post
Share on other sites

I tried to build a simple hello program:


#include <stdio.h>


main() {




but I got an error:


Unable to open include file: stdio.h


1 errors detected

Preprocessor error

C:\PROGRA~1\SOURCE~1\c2c.exe -PPIC16F84 -SRC -ols -md -O2 -Ip16F84.inc -otest.asm test.c

C:\PROGRA~1\MPLABI~1\MCHIP_~1\MPASMWIN.EXE /aINHX8M /pPIC16F84 /rHEX /w2 /q test.asm

Exit code was -1 [invalid argument.]

Exit code was 1

Removing target: test.hex

The system cannot find the file specified.

Failed to locate the output file 'test.asm'




Share this post

Link to post
Share on other sites

That's because a PIC processor doesn't HAVE a 'stdio.h' file.

'stdio.h' is to support the Standard Input/Output model -- you know, disk drives, terminal screens. These don't apply well to a PIC microprocessor. No disk. No terminals.


And, C2C does not have a 'printf' statement -- though it is not hard to create. It does have a putc, though.


Create a new C2C Project.

Select '.C and .H file'.


Insert the 'int i' stuff I mentioned in my earlier post -- these ARE supported by the C2C compiler. THEN Compile. THEN Assemble.


Note I believe the standard file has something like:

#include <system.h>


This has a #define for each supported PIC processor. When you choose a processor in the IDE, the #define is defined. Then, the <system.h> file uses the processor #define to memory map the names of the processors registers.


Just please don't use <stdio.h>. Doesn't apply to this new small world of PICs.

Share this post

Link to post
Share on other sites

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Create New...