Page 1 of 1

Loading C or ASM into PIC

Posted: Mon Oct 25, 2010 2:48 pm
by Jan Lichtenbelt
I use Flowcode 4 and the E-block USB multiporgrammer EB-006. Downloading the program from Flowcode is easy with a click on the IC-icon.
It should be possible to download a C-program or an assembler program directly into the PIC microcontroller using the same E-block. But how?

Re: Loading C or ASM into PIC

Posted: Tue Oct 26, 2010 9:27 am
by Benj
Hello,

You can load any pre compiled PIC hex file using the PPP software. This is available from the "Flowcode v4\Tools\PPP" directory. We also offer it as a stand alone download available from the E-blocks datasheets support page.

Re: Loading C or ASM into PIC

Posted: Tue Mar 08, 2011 4:25 pm
by Jan Lichtenbelt
Is there a description how to load a hex file by means of EB006 into my microcontroller?

Kind reagrds

Jan Lichtenbelt

Re: Loading C or ASM into PIC

Posted: Tue Mar 08, 2011 4:42 pm
by DavidA
Hello Jan,

There is no documented description that i know of, but its as simple as loading up PPP, clicking on the Open button, loading the hex file you wish to program and clicking "Send to PIC micro", if there are any problems, PPP should tell you.

Unless i am misunderstanding the question.

Re: Loading C or ASM into PIC

Posted: Tue Mar 08, 2011 10:28 pm
by Jan Lichtenbelt
Dear David,

Thanks a lot. That is exactly what I need. In the PPP program there is a HELP. I will try it soon.

Kind regards

Jan

Re: Loading C or ASM into PIC

Posted: Sat Jul 23, 2011 11:54 am
by Jan Lichtenbelt
I changed some lines not in Flowode but in the asm file itself. How can I turn the asm file into a hex file?

Kind regards

Jan Lichtenbelt

Re: Loading C or ASM into PIC

Posted: Sun Jul 24, 2011 4:19 pm
by JohnCrow
Hi Jan

If you just have a normal asm file (I assume you have changed it using something like notepad)
You can recompile it using either

MPLAB - The full development package (Overkill for what you need)
MPASM - A simple assembler program (Also much smaller and simpler then MPLAB Though not sure if still available)
These can be downloaded for free from the Microchip website.

Once you have installed MPLAB
Run the program
File
Open and double click the asm file you need to complile
Another window will open with asm listing
Project
Qucikbuild
This will create the hex file

MPASM is a lot simpler but I just looked on Microchips site and I do not see it anymore.

Re: Loading C or ASM into PIC

Posted: Mon Jul 25, 2011 11:06 am
by Benj
Hello,

MPASM is now installed as part of MPLAB.

You can find the stand alone executable inside the "C:\Program Files\Microchip\MPASM Suite" directory named "MPASMWIN.exe"

Re: Loading C or ASM into PIC

Posted: Mon Jul 25, 2011 4:35 pm
by Jan Lichtenbelt
Both John and Ben thanks for the information.

But it will take me more puzzeling, what I need to use e.g. a flowcode procuded asm file? Using this file with MPASM and MPLAB gives errors.

Re: Loading C or ASM into PIC

Posted: Mon Jul 25, 2011 9:47 pm
by JohnCrow
Hi Jan

Just tried it myself with a flowcode ASM file and it gives me errors too. So its not something you are doing

It does compile correctly using

1) An asm file I wrote myself in a text editor.
2) The asm file produced in JAL while compiling ( JAL is a high level language for PICs )

My thoughts are maybe flowcode adds some type formatting codes to the asm file that MPLAB does not understand. Though I've never tried recompiling the asm file this way. I'm sure Benj will have the answer.

Re: Loading C or ASM into PIC

Posted: Tue Jul 26, 2011 10:04 am
by Benj
Hello,

Hm I'm not too sure on this one myself. I think it's because BoostC does not use the Microchip MPASM when converting code from C to Hex it uses it's own technique. Maybe if you switch to the HiTech compiler this will generate MPASM compatible Assembler code.

Re: Loading C or ASM into PIC

Posted: Tue Jul 26, 2011 9:54 pm
by JohnCrow
Hi

Just tried a few more tests on this problem with flowcode generated asm files

I found MPASM will not work if the file name has a space in it.
Remove the space and it compiles without errors.
Dash and underscores both work though

LM35-Temperature Monitor.asm - this fails.
LM35-TemperatureMonitor.asm - compiles without error.
LM35-Temperature_Monitor.asm - compiles without error

I've checked the generated hex files with a text edit and they look the same

This is on windows 7x 64
MPASM 5.39
MPLAB 8.63

Re: Loading C or ASM into PIC

Posted: Wed Jul 27, 2011 6:32 am
by Rosenbaum
If you post a screenshot of the error maybe it is possible to say what is wrong.
Which version of MPlab you have installed?
In 8.x there is a new option for absolut or relcoatible Code. Here you have to use the "Absolut"-Code with a flowcode asm-file. When you are not sure which option you use look at Project -> Build Options -> Project: MPASM/C17/C18 Suite -> Single File Assembly Projekt (in the middle of the "card").

Edit: Funny thing. I tested a file with spaces in the name and it compiled perfectly.
When you have a lot of lins of code you will see the warning 302 and maybe the 306 as well. This warnings are no problem.

Re: Loading C or ASM into PIC

Posted: Wed Jul 27, 2011 10:32 am
by Jan Lichtenbelt
Dear Rosenbaum,

I tried your setup with MPLAB IDE V8.73 and set the code to absolute. Building the assembler file results in the following error message.
Build.jpg
Build.jpg (130.94 KiB) Viewed 18497 times
.
The original flowcode and assembler file have been attached. What to do?

Kind regards

Jan Lichtenbelt

Re: Loading C or ASM into PIC

Posted: Wed Jul 27, 2011 12:14 pm
by Rosenbaum
Hi Jan.
The Error shown in the screenshot say's that there is no "END" at the and of the file (ERORR[129]). At the moment I don't know why because there is an "END". I compiled your asm in MPLab 8.60 and 8.73a and it worked without any problem.
Maybe there is a problem in your projekt, please explain the way you creat the MPLab Project.

Re: Loading C or ASM into PIC

Posted: Wed Jul 27, 2011 6:03 pm
by Jan Lichtenbelt
Hi Rosenbaum,

I'm sorry, but the assembler file attached was correct, but the used file (slightly different name) was empty.
With the correct file the hex files has been maked correctly.
I used the project, because I though it has to.

Kind regards

Jan Lichtenbelt

Re: Loading C or ASM into PIC

Posted: Wed Jul 27, 2011 6:13 pm
by JohnCrow
Hi Jan
Ive just tried you asm file on my system
It will compile correctly using MPASM if i remove the space in the file name.
Still gives errors using your file name

Though it doesnt compile using MPLAB/quick build with either file name

It does say in the microchip documentation that the later versions of the software have stricter error checking.

Re: Loading C or ASM into PIC

Posted: Thu Jul 28, 2011 8:57 am
by Rosenbaum
Hi Jan.
When your posted asm-file is ok, taht will be the reasen getting no problem.
That you have to use a project is corrcet. Without a project and a workingspace you are not able to compile a file.

I remeber another problem I had in the past after changing the ASM-Code.
BoostC create ASM-Code with fixed adresses. So when you add new lines it is possible that the old adresses getting wrong. The Error that will come is the "Error[118]". My solution was to delete all "ORG 0xXXX...X" lines behind my changed code. It is importend to have the ORG 0x00000000 and ORG 0x00000004. These are the adresses for startup and interupt-handling.

Re: Loading C or ASM into PIC

Posted: Thu Jul 28, 2011 6:53 pm
by Jan Lichtenbelt
Hi John,

There was some mixing of files. So I tried the attached file above "Sinus generator_ladder_V2.asm" again with MPLAB IDE v8.73 and the hex file will be maked/build without problems.


Kind regards

Jan

Re: Loading C or ASM into PIC

Posted: Thu Jul 28, 2011 7:05 pm
by JohnCrow
Hi Jan
Ok good to hear you have got it working.