Pulse Width Timing

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
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:

Pulse Width Timing

Post by Benj »

Hi Benj,

Would you have a flowcode example, for measuring an incoming signal pulse width(In seconds) and displaying it on a LCD please. Thank you.

Regards

Ben

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: Pulse Width Timing

Post by Benj »

Hello

I moved your topic from the v4 Forum posts topic into the main v4 forum area. Please be sure to create future posts in a valid thread or start your own thread topic.

Here is an example that will measure the mark of a pulse and give you the time measured in seconds.

In future if you have program requests maybe you could have a go and then post what you came up with. This way we can spot what your doing wrong (if anything) and learn from your mistakes.
Attachments
Pulse Width Timer.fcf
(7.5 KiB) Downloaded 509 times

ben
Flowcode V4 User
Posts: 18
Joined: Thu Sep 24, 2009 5:02 pm
Been thanked: 1 time

Re: Pulse Width Timing

Post by ben »

Hi Benj
Thank you very much and I am sorry for misplacing my request. I will in future post my own program for correction.
Cheers
Ben

ben
Flowcode V4 User
Posts: 18
Joined: Thu Sep 24, 2009 5:02 pm
Been thanked: 1 time

Re: Pulse Width Timing

Post by ben »

Hi Benj
I did try your program, but I kept on receiving error code 37. I also receive error code 34, when I try to use very simple programs from the flowcode4 example file. To make matters worse, after receiving the code 34, I can not use the PICs anymore. Please advice. Thank you.

ps:- I am using PICkid2, XP OS.

ile name: C:\Program Files\Matrix Multimedia\Pulse Width Timer.c
Generated by: Flowcode v4.2.3.58
Date: Tuesday, December 01, 2009 15:07:04
Licence: Professional
Registered to: Ben


http://www.matrixmultimedia.com


Launching the compiler...
C:\Program Files\Matrix Multimedia\Flowcode V4\BoostC\boostc.pic16.flowcode.exe -v -t PIC16F88 "Pulse Width Timer.c"
BoostC Optimizing C Compiler Version 6.95 (for PIC16 architecture)
http://www.sourceboost.com
Copyright(C) 2004-2009 Pavel Baranov
Copyright(C) 2004-2009 David Hobday

Licensed to FlowCode User under Single user Pro License for 1 node(s)
Limitations: PIC12,PIC16 max code size:Unlimited, max RAM banks:Unlimited


Pulse Width Timer.c
Starting preprocessor: C:\PROGRA~1\MATRIX~1\FLOWCO~2\BoostC\pp.exe "C:\Program Files\Matrix Multimedia\Pulse Width Timer.c" -i C:\PROGRA~1\MATRIX~1\FLOWCO~2\BoostC\include -d _PIC16F88 -la -c2 -o "C:\Program Files\Matrix Multimedia\Pulse Width Timer.pp" -v -d _BOOSTC -d _PIC16


......................

Pulse Width Timer.c success

success

Return code = 0

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 "Pulse Width Timer.obj" -t PIC16F88 -d "C:\Program Files\Matrix Multimedia" -p "Pulse Width Timer"
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
Caution: Delay inaccurrate: 'delay_us', Delay overhead:0.01ms, Unit delay:0.001ms, Delay resolution:4 units
Caution: argument of 'delay_10us' 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_LCDDisplay0_Command in: C:\Program Files\Matrix Multimedia\Pulse Width Timer.c
FCD_LCDDisplay0_Cursor in: C:\Program Files\Matrix Multimedia\Pulse Width Timer.c
FCD_LCDDisplay0_PrintString in: C:\Program Files\Matrix Multimedia\Pulse Width Timer.c
FCD_LCDDisplay0_ScrollDisplay in: C:\Program Files\Matrix Multimedia\Pulse Width Timer.c
FCD_LCDDisplay0_ClearLine in: C:\Program Files\Matrix Multimedia\Pulse Width Timer.c
FCD_LCDDisplay0_RAM_Write in: C:\Program Files\Matrix Multimedia\Pulse Width Timer.c

Building CASM file
Memory Usage Report
===================
RAM available:368 bytes, used:55 bytes (15.0%), free:313 bytes (85.0%),
Heap size:313 bytes, Heap max single alloc:110 bytes
ROM available:4096 words, used:729 words (17.8%), free:3367 words (82.2%)



success

Return code = 0

Launching the programmer...
C:\PK2CMD_MTX\pk2cmd_mtx.exe -PPIC16F88 -FPULSEW~2.hex -M -A5 -H

Hex file not found.


Return code = 37

Flowcode was unable to transfer the flowchart to the microcontroller. Check the programmer options and physical connections.

FINISHED

medelec35
Matrix Staff
Posts: 9521
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times

Re: Pulse Width Timing

Post by medelec35 »

If you look at the file name generated ':\PK2CMD_MTX\pk2cmd_mtx.exe -PPIC16F88 -FPULSEW~2.hex -M -A5 -H'
It not the same as your original file name.
Take a look here: http://www.matrixmultimedia.com/mmforum ... kit#p14006

Especially post dated Fri July 03, 2009 9:12am
Maybe that would help?
Martin

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

Re: Pulse Width Timing

Post by Steve »

One thing that may fix this issue is to alter the -F%F.hex part of the command line parameters to -F%f.hex or -F"%f.hex".

It seems that your system is set up so that newly-created filenames do not have their legacy 8.3 alternative filenames created automatically. Certain optimizers do this, but in truth the saving from this feature is negligible.

ben
Flowcode V4 User
Posts: 18
Joined: Thu Sep 24, 2009 5:02 pm
Been thanked: 1 time

Re: Pulse Width Timing

Post by ben »

Hi Steve,
Thank you very much for your help. Ever since I changed the command parameters to -F"%f.hex", but not -F%f.hex, I am able to program my PICs and so far so good.

Regards

Ben

Eric
Posts: 99
Joined: Tue Nov 06, 2007 11:04 pm
Been thanked: 1 time

Re: Pulse Width Timing

Post by Eric »

Hi Ben,

I was looking at your example and I noticed that in the panel this message was given:
snap0329.jpg
snap0329.jpg (50.74 KiB) Viewed 7265 times
I wasn't aware that Flowcode doesn't look at the owner of Flowcode but at the author of the program.
Am I in violation of piracy rules now :lol:

Rgds,

Eric

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: Pulse Width Timing

Post by Benj »

Hi Eric

Ah yes sorry about that. The text is automatically added when creating a new program and I must have forgotten to remove it.

Maybe the message should be changed to "this file was created by" instead of "this copy of flowcode belongs to"

medelec35
Matrix Staff
Posts: 9521
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times

Re: Pulse Width Timing

Post by medelec35 »

Ben, If it's a piracy thing, then the way flowcode 3 displayed the name on the main grey window was good.
Taking your point, there could be an editable field in options menu. Then whatever name is entered in this field will then be transferred to flowchart in the form of 'This file was created by: name here'
Would be better if name in this field is retained, unless you manually change it.

Alternatively the owner of the Flowcode always appears on the flowchart or control panel when it is opened or created, irrespective of the name of creator.
So If I loaded someone else’s Flowcode then my name would appear on the flowchart or control panel as the owner of Flowcode, but the creators name could appear as 'This file was created by: name here'
Martin

Post Reply