Hi, i am still a novice in pic devices. i made a few nice projects but not the level i have a question about. i am looking for a way to put a exsiting c code in a C-block into Flowcode. i'm using a pic16F88. i searched a weekend and evenings on the net and watched many examples in the tutorials but i cant get it done. it looks like it is written in a 'old' style code (i think) but i found the exact same way of older exactly the same written examples on the microchip site. this freeware project is from 2007 and i cant contact the Original writer. i changed lines and removed and/or changed the remark from ; to // but nothing works. the codes look plausible to me... i can find a lot of it back in the datasheet.
I have the text file of the c code and i borrowed a working processor from someone in the USA i need to ship back eventually. i want to make a working copy first and if i get it working i can search in the c code for changes to make because i want to adapt it and also learn in that way to understand C better. i wished i'm that good yet to convert it into a flowcode .
I cant simply copy the Original pic (and is not as much fun) because the writer did put the MCLR as internal and my PICKIT3 programmer warns i cannot use this function in collaboration with a other function.
My last resort is to ask it..really... hope i find a enthusiast here that can find or point out what i'm doing wrong.
Thanks!
here a small piece of the code. i took most lead comments off...
The comments i placed // before the ;
The ERRORLEVEL i cant find in the datasheet.
Trying to get a C code in
-
- Valued Contributor
- Posts: 2045
- Joined: Wed Aug 27, 2008 10:31 pm
- Location: Netherlands
- Has thanked: 553 times
- Been thanked: 1081 times
Re: Trying to get a C code in
This is not C code so embedding it in a C code block will not work. The code only contains chip settings and variable declarations in assembly, no instructions to execute.
“Integrity is doing the right thing, even when no one is watching.”
― C.S. Lewis
― C.S. Lewis
- 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: Trying to get a C code in
Hello,
I would suggest that you spend some time with the code and then replicate using Flowchart icons. Flowcode should do a lot of the heavy lifting so for example you can use one of the ADC components rather then trying to talk directly to the ADC registers like the assembler is doing.
Your ambient RAM block looks ideal for use with an array variable.
If you want to use the assembler then you can wrap assembler code inside a C icon like this.
asm
{
ASM CODE
ASM CODE
ASM CODE
}
Note that the Flowcode program is already past the ORG 0 reset vector point when you call the C icon so your definitions etc from your current assembler commands might cause issues.
If you want to simply compile the ASM program as is then why not use the free Microchip MPASM compiler?
I would suggest that you spend some time with the code and then replicate using Flowchart icons. Flowcode should do a lot of the heavy lifting so for example you can use one of the ADC components rather then trying to talk directly to the ADC registers like the assembler is doing.
Your ambient RAM block looks ideal for use with an array variable.
If you want to use the assembler then you can wrap assembler code inside a C icon like this.
asm
{
ASM CODE
ASM CODE
ASM CODE
}
Note that the Flowcode program is already past the ORG 0 reset vector point when you call the C icon so your definitions etc from your current assembler commands might cause issues.
If you want to simply compile the ASM program as is then why not use the free Microchip MPASM compiler?
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
-
- Valued Contributor
- Posts: 2045
- Joined: Wed Aug 27, 2008 10:31 pm
- Location: Netherlands
- Has thanked: 553 times
- Been thanked: 1081 times
Re: Trying to get a C code in
Hi Ben,
We continued the conversation in (dutch) PMs. The code is assembly for MPASM, as I have an older version of it around I generated HEX code.
Best regards,
Jac
We continued the conversation in (dutch) PMs. The code is assembly for MPASM, as I have an older version of it around I generated HEX code.
Best regards,
Jac
“Integrity is doing the right thing, even when no one is watching.”
― C.S. Lewis
― C.S. Lewis