Page 1 of 1

Trying to get a C code in

Posted: Mon Jun 01, 2015 7:01 pm
by Dutch
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.
GPI original.txt
(3.32 KiB) Downloaded 632 times

Re: Trying to get a C code in

Posted: Mon Jun 01, 2015 7:05 pm
by Dutch
here a screenshot of the code i placed in a block..
Knipsel.JPG
Knipsel.JPG (80.42 KiB) Viewed 11955 times

Re: Trying to get a C code in

Posted: Mon Jun 01, 2015 7:13 pm
by kersing
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.

Re: Trying to get a C code in

Posted: Mon Jun 01, 2015 7:26 pm
by Dutch
Thanks Kersing :? :wink:
the total is a text of 1000 lines comments included. so what can i do with this 'assembly' text

can i somhow convert it?

Re: Trying to get a C code in

Posted: Tue Jun 02, 2015 2:11 pm
by Benj
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?

Re: Trying to get a C code in

Posted: Tue Jun 02, 2015 9:35 pm
by kersing
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