Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Using flowcode to program my PIC18F452

Status
Not open for further replies.
Hi,

I have flowocde and used it to generate code for my project but the programmer installed with flowcode is some PPPv3 which does not support the PIC18 family of microcontrollers...

I tried transferring the generated code from flowcode to MPLAB in order to try and program the PIC18F452 but was getting an error: Can't find system.h file. When i looked for the system.h file in google, saved it and added it to the MPLAB C18 h folder, i get further errors.

Could anyone suggest a programmer that i could use to program the PIC18F452 chip using this code i generated from flowcode please please please and where i could get it to download from :confused:

Thanks.
 
hi,
If you can assemble the code into a hex file using Flowcode, you can import the hex file into MPLAB and then program the PIC.
 
You need to download and install the free C18 compiler from Microchip. **broken link removed** - you have to register to download the free version.

Mike.
 
Programming PIC18F452

Hi,

I compiled the code to hex using flowcode and imported it to mplab...but when i try compiling the following error appears:

Build aborted. The project contains no source files.

So i added the .asm file as the source file and still got the error:

Error - could not find definition of symbol 'main' in file 'C:\MCC18\lib/c018i.o'.

Please help.
Thanks.
 
I compiled the code to hex using flowcode and imported it to mplab...but when i try compiling the following error appears:

Build aborted. The project contains no source files.
You can't compile it twice. If it's already hex then it's already compiled. Attempting to compile already compiled code will not work. What was suggested was that you take your already compiled hex, import it into MPLAB and use MPLAB to control your programmer and program (burn to Flash) your PIC. All this assumes that you have a PIC programmer that is MPLAB compatible. If yours isn't then you would use whatever software works with it rather than MPLAB.

So i added the .asm file as the source file and still got the error:

Error - could not find definition of symbol 'main' in file 'C:\MCC18\lib/c018i.o'.
If you want to assemble asm source code generated by a high level language you'll have to go through the code very carefully and make changes where necessary to suit standalone assembly. Probably it will be difficult and might be easier to just write asm code to start with. If your flowcode language can compile/assemble to hex then this should be unnecessary anyway.
 
Last edited:
Pic18f452

I already have the C18 compiler installed.

This is the entire output when i try to compile the HEX file:

----------------------------------------------------------------------
Debug build of project `C:\Darrell\Flowcode Asm test.mcp' started.
Preprocessor symbol `__DEBUG' is defined.
Sat Mar 28 13:45:56 2009
----------------------------------------------------------------------
Make: The target "C:\Darrell\Darrell Test.o" is out of date.
Executing: "C:\MCC18\mpasm\mpasmwin.exe" /q /p18F452 "C:\Users\Darrell\Desktop\Darrell Test.asm" /l"Darrell Test.lst" /e"Darrell Test.err" /o"Darrell Test.o" /d__DEBUG=1
Make: The target "C:\Darrell\Flowcode Asm test.cof" is out of date.
Executing: "C:\MCC18\bin\mplink.exe" /l"C:\MCC18\lib" "..\MCC18\lkr\18f452.lkr" "Darrell Test.o" /u_DEBUG /z__MPLAB_BUILD=1 /z__MPLAB_DEBUG=1 /o"Flowcode Asm test.cof" /M"Flowcode Asm test.map" /W
MPLINK 4.30.01, Linker
Copyright (c) 2009 Microchip Technology Inc.
Error - could not find definition of symbol 'main' in file 'C:\MCC18\lib/c018i.o'.
Errors : 1

Link step failed.
----------------------------------------------------------------------
Debug build of project `C:\Darrell\Flowcode Asm test.mcp' failed.
Preprocessor symbol `__DEBUG' is defined.
Sat Mar 28 13:46:07 2009
----------------------------------------------------------------------
BUILD FAILED
 
I already have the C18 compiler installed.

This is the entire output when i try to compile the HEX file:
You CAN NOT compile a hex file! It's already compiled and ready to program into the PIC.

Why on earth are you using C18? Flowcode already compiles using BoostC. C18 is not necessary, and it just going to cause more confusion, as you've found out now.

If you're already able to use Flowcode to compile to hex then that's it. Hex is the file you Flash the PIC with. It's the final output of any PIC assembler or compiler. Get that hex output file imported into whatever software you use to run your PIC programmer and program the chip.

What programmer do you use? ICD2, PICkit 2, other? What software do you use to operate it?
 
Last edited:
Importing HEX file

Futz,

So all i have to do is when i open MPLAB > File > Import > Programmer > Select Programmer > MPLAB ICD2 > Connect to ICD > then program target device?
 
So all i have to do is when i open MPLAB > File > Import > Programmer > Select Programmer > MPLAB ICD2 > Connect to ICD > then program target device?
If you're using an ICD2 then I guess that's how you'd do it. There might be some small details of that description that might need diddling, but ya, that sounds right.

If you can't get that to work, ask. I could plug in one of my ICD2's and write down the exact sequence.
 
Programming PIC18F452

Sorry i forget to mention the importing of the HEX file from flowcode

So all i have to do is when i open MPLAB > File > Import > HEX file generated from flowcode > Programmer > Select Programmer > MPLAB ICD2 > Connect to ICD > then program target device?

So this is without any source files and linker scripts etc...

I feel like a real newbie right now.
 
Thanks Futz

I will update you on my progress...My ICD giving an error of cannot find target device and failing the self test at the moment for some strange reason when it was working perfectly fine a few moments ago.
 
Sorry i forget to mention the importing of the HEX file from flowcode

So all i have to do is when i open MPLAB > File > Import > HEX file generated from flowcode > Programmer > Select Programmer > MPLAB ICD2 > Connect to ICD > then program target device?
Sounds right. Do it! :D

So this is without any source files and linker scripts etc...
Well, ya! That's why you're using Flowcode, right? So you don't have to learn any of that stuff. Flowcode does it all for ya.
 
I keep getting this error:

Auto-connect not enabled - Not connecting (Try enabling auto-connect on the ICD2 settings pages.)
Connecting to MPLAB ICD 2
...Connected
Setting Vdd source to target
Target Device PIC18F452 found, revision = c0
...Reading ICD Product ID
Running ICD Self Test
...Passed
MPLAB ICD 2 ready for next operation
Programming Target...
...Erasing Part
...Programming Program Memory (0x0 - 0xEDF)
Verifying...
...Program Memory
ICD0161: Verify failed (MemType = Program, Address = 0x0, Expected Val = 0xEF58, Val Read = 0xFFFF)
ICD0275: Programming failed.
MPLAB ICD 2 ready for next operation

I opened MPLAB...went to File > Import > Imported the HEX file that flowcode generated > went to programmer > select device > MPLAB ICD2 > connected ICD > then program target device ... am i still doing something wrong?
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top