Loading C or ASM into PIC
- Jan Lichtenbelt
- Posts: 797
- Joined: Tue Feb 17, 2009 8:35 pm
- Location: Haren GN, the Netherlands
- Has thanked: 128 times
- Been thanked: 264 times
- Contact:
Loading C or ASM into PIC
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?
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?
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: Loading C or ASM into PIC
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.
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.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
- Jan Lichtenbelt
- Posts: 797
- Joined: Tue Feb 17, 2009 8:35 pm
- Location: Haren GN, the Netherlands
- Has thanked: 128 times
- Been thanked: 264 times
- Contact:
Re: Loading C or ASM into PIC
Is there a description how to load a hex file by means of EB006 into my microcontroller?
Kind reagrds
Jan Lichtenbelt
Kind reagrds
Jan Lichtenbelt
- DavidA
- Matrix Staff
- Posts: 1076
- Joined: Fri Apr 23, 2010 2:18 pm
- Location: Matrix Multimedia Ltd
- Has thanked: 58 times
- Been thanked: 258 times
- Contact:
Re: Loading C or ASM into PIC
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.
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.
- Jan Lichtenbelt
- Posts: 797
- Joined: Tue Feb 17, 2009 8:35 pm
- Location: Haren GN, the Netherlands
- Has thanked: 128 times
- Been thanked: 264 times
- Contact:
Re: Loading C or ASM into PIC
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
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
- Jan Lichtenbelt
- Posts: 797
- Joined: Tue Feb 17, 2009 8:35 pm
- Location: Haren GN, the Netherlands
- Has thanked: 128 times
- Been thanked: 264 times
- Contact:
Re: Loading C or ASM into PIC
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
Kind regards
Jan Lichtenbelt
- JohnCrow
- Valued Contributor
- Posts: 1367
- Joined: Wed Sep 19, 2007 1:21 pm
- Location: Lincolnshire
- Has thanked: 364 times
- Been thanked: 716 times
Re: Loading C or ASM into PIC
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.
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.
1 in 10 people understand binary, the other one doesn't !
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: Loading C or ASM into PIC
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"
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"
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
- Jan Lichtenbelt
- Posts: 797
- Joined: Tue Feb 17, 2009 8:35 pm
- Location: Haren GN, the Netherlands
- Has thanked: 128 times
- Been thanked: 264 times
- Contact:
Re: Loading C or ASM into PIC
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.
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.
- JohnCrow
- Valued Contributor
- Posts: 1367
- Joined: Wed Sep 19, 2007 1:21 pm
- Location: Lincolnshire
- Has thanked: 364 times
- Been thanked: 716 times
Re: Loading C or ASM into PIC
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.
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.
1 in 10 people understand binary, the other one doesn't !
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: Loading C or ASM into PIC
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.
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.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
- JohnCrow
- Valued Contributor
- Posts: 1367
- Joined: Wed Sep 19, 2007 1:21 pm
- Location: Lincolnshire
- Has thanked: 364 times
- Been thanked: 716 times
Re: Loading C or ASM into PIC
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
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
1 in 10 people understand binary, the other one doesn't !
-
- Flowcode V4 User
- Posts: 25
- Joined: Thu Feb 22, 2007 3:20 pm
- Has thanked: 1 time
- Been thanked: 5 times
Re: Loading C or ASM into PIC
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.
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.
- Jan Lichtenbelt
- Posts: 797
- Joined: Tue Feb 17, 2009 8:35 pm
- Location: Haren GN, the Netherlands
- Has thanked: 128 times
- Been thanked: 264 times
- Contact:
Re: Loading C or ASM into PIC
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. .
The original flowcode and assembler file have been attached. What to do?
Kind regards
Jan Lichtenbelt
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. .
The original flowcode and assembler file have been attached. What to do?
Kind regards
Jan Lichtenbelt
- Attachments
-
- Sinus generator_ladder_V2.fcf
- (9.5 KiB) Downloaded 478 times
-
- Sinus generator_ladder_V2.asm
- (13.98 KiB) Downloaded 484 times
-
- Flowcode V4 User
- Posts: 25
- Joined: Thu Feb 22, 2007 3:20 pm
- Has thanked: 1 time
- Been thanked: 5 times
Re: Loading C or ASM into PIC
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.
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.
- Jan Lichtenbelt
- Posts: 797
- Joined: Tue Feb 17, 2009 8:35 pm
- Location: Haren GN, the Netherlands
- Has thanked: 128 times
- Been thanked: 264 times
- Contact:
Re: Loading C or ASM into PIC
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
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
- JohnCrow
- Valued Contributor
- Posts: 1367
- Joined: Wed Sep 19, 2007 1:21 pm
- Location: Lincolnshire
- Has thanked: 364 times
- Been thanked: 716 times
Re: Loading C or ASM into PIC
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.
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.
1 in 10 people understand binary, the other one doesn't !
-
- Flowcode V4 User
- Posts: 25
- Joined: Thu Feb 22, 2007 3:20 pm
- Has thanked: 1 time
- Been thanked: 5 times
Re: Loading C or ASM into PIC
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.
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.
- Jan Lichtenbelt
- Posts: 797
- Joined: Tue Feb 17, 2009 8:35 pm
- Location: Haren GN, the Netherlands
- Has thanked: 128 times
- Been thanked: 264 times
- Contact:
Re: Loading C or ASM into PIC
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
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