Help with 16F722

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 4.
To post in this forum you must have a registered copy of Flowcode 4 or higher. To sign up for this forum topic please use the "Online Resources" link in the Flowcode Help Menu.

Moderator: Benj

Post Reply
Dan
Posts: 17
Joined: Thu Sep 20, 2007 4:43 pm
Location: Canada

Help with 16F722

Post by Dan »

Hello everyone

wondering if anyone has a fix for the ADC on the 16F722

as soon as the ADC is added it will not compile.

here is the previous info I posted in another forum......
Hello I was wondering if someone could help figure out why my code won't compile for the 16f722.

only seems to be a problem with the adc component.

thx in advance.D
Last edited by Dan on Sun Mar 07, 2010 6:35 pm, edited 1 time in total.

User avatar
Steve
Matrix Staff
Posts: 3434
Joined: Tue Jan 03, 2006 3:59 pm
Has thanked: 114 times
Been thanked: 422 times

Re: Help with 16F722

Post by Steve »

I just tried to compile an ADC program for this chip and it worked fine. I have attached a recent FCD file, just in case the original one has a bug.
Attachments
16F722.fcd
(9.72 KiB) Downloaded 486 times

Dan
Posts: 17
Joined: Thu Sep 20, 2007 4:43 pm
Location: Canada

Re: Help with 16F722

Post by Dan »

Hi Steve

I used the attached file from your post and it fixed the compile error however the the code freezes at the adc macro.... as soon as I delete the adc macro the program runs fine.

Attached is my

Thx
Dan
Attachments
Flowcodedebug.fcf
(12 KiB) Downloaded 361 times

User avatar
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: Help with 16F722

Post by Benj »

Hello Dan,

Which version of Flowcode are you using? V4.2 is the current release and V4.3 should be available in the near future.

If you are already using v4.2 then would you mind posting up your compiled C code so we can compare the outputs Flowcode is generating.

Dan
Posts: 17
Joined: Thu Sep 20, 2007 4:43 pm
Location: Canada

Re: Help with 16F722

Post by Dan »

Hi Steve

I'm using FC V4.2.3.58

See attached C file.

Thx
Dan
Attachments
Flowcodedebug.c
(23.29 KiB) Downloaded 331 times

User avatar
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: Help with 16F722

Post by Benj »

Thanks Dan,

Right I have compared the C code files with a version generated here and they are almost identical. However with the ADC ReadAsInt function present the file is still compiling correctly on my version of Flowcode.

Are you using the standard BoostC compiler or have you modified Flowcode to use the Hi Tech compiler?

Do you get any error messages in the compilation messages window when you try to compile with the ADC present. If so could you post these up.

Also might help if you specify which OS you are using and if you are using any intensive antivirus or firewall applications. Though hopefully this is not the cause of the problem.

Dan
Posts: 17
Joined: Thu Sep 20, 2007 4:43 pm
Location: Canada

Re: Help with 16F722

Post by Dan »

I'm using using boostc included with FC4...I tried hitech C same result......

-Tried W7 ultimate w/o antivirus----same result
-tried vista w/o antivirus------same result
-tried XP pro w/o antivirus-------same result

-No Compile error See below...

Launching the linker/assembler...
C:\Program Files\Matrix Multimedia\Flowcode V4\BoostC\boostlink.pic.exe -ld "C:\Program Files\Matrix Multimedia\Flowcode V4\BoostC\lib" libc.pic16.lib flowcode.pic16.lib rand.pic16.lib float.pic16.lib "Flowcodedebug.obj" -t PIC16F722 -d "C:\Documents and Settings\Dan\Desktop\Updated FCD files" -p "Flowcodedebug"
BoostLink Optimizing Linker Version 6.95
http://www.sourceboost.com
Copyright(C) 2004-2009 Pavel Baranov
Copyright(C) 2004-2009 David Hobday


Caution: argument of 'delay_us' calls must have a value of 1 or more
Warning unreferenced functions removed:
FCI_FLOAT_TO_STRING in: C:\Program Files\Matrix Multimedia\Flowcode V4\FCD\internals.h
FCI_NUMBER_TO_HEX in: C:\Program Files\Matrix Multimedia\Flowcode V4\FCD\internals.h
FCI_STRING_TO_INT in: C:\Program Files\Matrix Multimedia\Flowcode V4\FCD\internals.h
FCI_STRING_TO_FLOAT in: C:\Program Files\Matrix Multimedia\Flowcode V4\FCD\internals.h
Wdt_Delay_S in: C:\Program Files\Matrix Multimedia\Flowcode V4\FCD\internals.h
isinf in: C:\Program Files\Matrix Multimedia\Flowcode V4\FCD\internals.h
FCD_ADC0_ReadAsByte in: C:\Documents and Settings\Dan\Desktop\Updated FCD files\Flowcodedebug.c
FCD_ADC0_ReadAsVoltage in: C:\Documents and Settings\Dan\Desktop\Updated FCD files\Flowcodedebug.c
FCD_ADC0_ReadAsString in: C:\Documents and Settings\Dan\Desktop\Updated FCD files\Flowcodedebug.c
FCD_PWM0_Disable in: C:\Documents and Settings\Dan\Desktop\Updated FCD files\Flowcodedebug.c
FCD_PWM0_ChangePeriod in: C:\Documents and Settings\Dan\Desktop\Updated FCD files\Flowcodedebug.c
FCD_PWM0_SetDutyCycle10bit in: C:\Documents and Settings\Dan\Desktop\Updated FCD files\Flowcodedebug.c
FCD_LCDDisplay0_PrintASCII in: C:\Documents and Settings\Dan\Desktop\Updated FCD files\Flowcodedebug.c
FCD_LCDDisplay0_Command in: C:\Documents and Settings\Dan\Desktop\Updated FCD files\Flowcodedebug.c
FCD_LCDDisplay0_ScrollDisplay in: C:\Documents and Settings\Dan\Desktop\Updated FCD files\Flowcodedebug.c
FCD_LCDDisplay0_ClearLine in: C:\Documents and Settings\Dan\Desktop\Updated FCD files\Flowcodedebug.c
FCD_LCDDisplay0_RAM_Write in: C:\Documents and Settings\Dan\Desktop\Updated FCD files\Flowcodedebug.c

Building CASM file
Memory Usage Report
===================
RAM available:128 bytes, used:64 bytes (50.0%), free:64 bytes (50.0%),
Heap size:64 bytes, Heap max single alloc:31 bytes
ROM available:2048 words, used:982 words (48.0%), free:1066 words (52.0%)



success

Return code = 0

FINISHED

User avatar
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: Help with 16F722

Post by Benj »

Hello,

The compiler message you posted up is saying that compilation went ok.

Is the problem that the programmer is not being automatically called?
If so then are you using the compile to hex button or the compile to chip button?

You should be able to manually program the hex file onto the device by manually running PPP from the "Flowcode v4\Tools\PPP" folder.

This will confirm if the compilation happened correctly.

Dan
Posts: 17
Joined: Thu Sep 20, 2007 4:43 pm
Location: Canada

Re: Help with 16F722

Post by Dan »

programming is not the problem....

I can program the 886 no problem

I'm compiling to hex in FC...then inporting the hex into MPLAB then progrmming....same way I have always done it with FC3 and FC4

I'm sure it's a problem with configuration of the adc

Dan
Posts: 17
Joined: Thu Sep 20, 2007 4:43 pm
Location: Canada

Re: Help with 16F722

Post by Dan »

Just an update.

I tested programming using the ICD3 and still the same thing...no go with the ADC....no problem without adc in the program.

So programming is not an issue

Switched the device in FC4 from 16F722 to the 886 and programmed and operated as expected with no problem.

User avatar
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: Help with 16F722

Post by Benj »

Hello

If you go into the "Flowcode v4\FCD" directory and open the 16F722.FCD file in a text editor and then change the following line.

ADCType=6

to

ADCType=18

and then recompile hopefully the code should now work correctly on the hardware for you.

Let me know how you get on.

Dan
Posts: 17
Joined: Thu Sep 20, 2007 4:43 pm
Location: Canada

Re: Help with 16F722

Post by Dan »

OK, I figured it all out after my last post....................that little 722 is working keeping my beer cold as I type this!

I Found the problem you mentionned below after comparing the other FCD files for 72X parts >>>>this is how I got it working.....switched to ACD to 18 then got compile erros, I edited the ADC18 component file to fix compile errors and things are all good now.

I noticed some of the other 72X parts are messed up in different ways so I started fixing them.....I'll post them when I have time to test each one in case they are of use to the next release.

Steve...Benj...thx for trying to fix it for me...........must say I like V4...........but this little bug in V4 really showed how lazy and spoiled I got using V3, it even gave me a chance to break out the new ICD3...........night and day between the ICD2

Best regards
Dan

Post Reply