Delay problem!
Moderator: Benj
-
electronix
- Posts: 58
- Joined: Sat Aug 22, 2009 5:45 pm
- Has thanked: 17 times
- Been thanked: 7 times
Delay problem!
I have a problem when craeting a delay, for example if i would like to have a 36KHz signal output on RB3(16F628A), When compiling to *.HEX i get this issue:
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\Matrix Multimedia\Flowcode V4\FCD\internals.h
FCI_NUMBER_TO_HEX in: C:\Program\Matrix Multimedia\Flowcode V4\FCD\internals.h
FCI_STRING_TO_INT in: C:\Program\Matrix Multimedia\Flowcode V4\FCD\internals.h
FCI_STRING_TO_FLOAT in: C:\Program\Matrix Multimedia\Flowcode V4\FCD\internals.h
Wdt_msDelay in: C:\Program\Matrix Multimedia\Flowcode V4\FCD\internals.h
Wdt_Delay_S in: C:\Program\Matrix Multimedia\Flowcode V4\FCD\internals.h
Wdt_Delay_Ms in: C:\Program\Matrix Multimedia\Flowcode V4\FCD\internals.h
isinf in: C:\Program\Matrix Multimedia\Flowcode V4\FCD\internals.h
Building CASM file
Memory Usage Report
===================
RAM available:224 bytes, used:36 bytes (16.1%), free:188 bytes (83.9%),
Heap size:188 bytes, Heap max single alloc:94 bytes
ROM available:2048 words, used:178 words (8.7%), free:1870 words (91.3%)
success
Return code = 0
FINISHED
It simply doesnΒ΄t matter what value i put in the delay... If i make the delay in ms instead then itΒ΄s working just fine.
The strange thing about this is that if i use an older version of this testprogram(36KHz output on RB3) that i made several months ago, itΒ΄s working great.
I have also installed the latest version of Flowcode but there is still no change...
So..what to do??
*EDIT* The PIC is running at 20MHz.
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\Matrix Multimedia\Flowcode V4\FCD\internals.h
FCI_NUMBER_TO_HEX in: C:\Program\Matrix Multimedia\Flowcode V4\FCD\internals.h
FCI_STRING_TO_INT in: C:\Program\Matrix Multimedia\Flowcode V4\FCD\internals.h
FCI_STRING_TO_FLOAT in: C:\Program\Matrix Multimedia\Flowcode V4\FCD\internals.h
Wdt_msDelay in: C:\Program\Matrix Multimedia\Flowcode V4\FCD\internals.h
Wdt_Delay_S in: C:\Program\Matrix Multimedia\Flowcode V4\FCD\internals.h
Wdt_Delay_Ms in: C:\Program\Matrix Multimedia\Flowcode V4\FCD\internals.h
isinf in: C:\Program\Matrix Multimedia\Flowcode V4\FCD\internals.h
Building CASM file
Memory Usage Report
===================
RAM available:224 bytes, used:36 bytes (16.1%), free:188 bytes (83.9%),
Heap size:188 bytes, Heap max single alloc:94 bytes
ROM available:2048 words, used:178 words (8.7%), free:1870 words (91.3%)
success
Return code = 0
FINISHED
It simply doesnΒ΄t matter what value i put in the delay... If i make the delay in ms instead then itΒ΄s working just fine.
The strange thing about this is that if i use an older version of this testprogram(36KHz output on RB3) that i made several months ago, itΒ΄s working great.
I have also installed the latest version of Flowcode but there is still no change...
So..what to do??
*EDIT* The PIC is running at 20MHz.
- 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: Delay problem!
Hello
I cant really see how the us delays are failing unless
a) you have flowcode v4.0 - in which case you will need to download and install v4.1
b) the clock speed in the view -> project options window is set incorrectly.
If you want to attach your flowcode file and the C code generated by the file then I will check this for you.
I cant really see how the us delays are failing unless
a) you have flowcode v4.0 - in which case you will need to download and install v4.1
b) the clock speed in the view -> project options window is set incorrectly.
If you want to attach your flowcode file and the C code generated by the file then I will check this for you.
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
-
electronix
- Posts: 58
- Joined: Sat Aug 22, 2009 5:45 pm
- Has thanked: 17 times
- Been thanked: 7 times
Re: Delay problem!
Hi Benj.
I did install V4.1 but still the same problem.
I have attached the C codefile.
/Stefan
I did install V4.1 but still the same problem.
I have attached the C codefile.
/Stefan
- Attachments
-
- testRB3_16f628a.c
- (2.08 KiB) Downloaded 315 times
- 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: Delay problem!
Hello Stefan
Ok the C code all looks correct. All of the delay_us commands have values. I think that the message in your compilation window is just a message that is generated when micro second delays are included in your program. What is your hardware doing that makes you think this is not working correctly?
If you are measuring the output signal with an oscilloscope then you might need to remove the 9ms delay near the end of your program to allow you to see a constant oscillating output.
Ok the C code all looks correct. All of the delay_us commands have values. I think that the message in your compilation window is just a message that is generated when micro second delays are included in your program. What is your hardware doing that makes you think this is not working correctly?
If you are measuring the output signal with an oscilloscope then you might need to remove the 9ms delay near the end of your program to allow you to see a constant oscillating output.
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
-
electronix
- Posts: 58
- Joined: Sat Aug 22, 2009 5:45 pm
- Has thanked: 17 times
- Been thanked: 7 times
Re: Delay problem!
Hi Benj.
The problem is when i run the hardware Nothing happens at all...
But if i instead of using delays, create loops that count the corresponding time then everything works just great.
The problem is when i run the hardware Nothing happens at all...
But if i instead of using delays, create loops that count the corresponding time then everything works just great.
- 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: Delay problem!
Hello
Are you sure that the program is not simply running too fast to see the LED flashing.
The output is off for the 9ms delay which would consume the majority (approx 99%) of the time.
The output is only ever on for 5us which would be undetectable by the human eye. Are you measuring the output pin with an oscilloscope?
Are you sure that the program is not simply running too fast to see the LED flashing.
The output is off for the 9ms delay which would consume the majority (approx 99%) of the time.
The output is only ever on for 5us which would be undetectable by the human eye. Are you measuring the output pin with an oscilloscope?
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
-
electronix
- Posts: 58
- Joined: Sat Aug 22, 2009 5:45 pm
- Has thanked: 17 times
- Been thanked: 7 times
Re: Delay problem!
Hi Benj.
Yes iΒ΄m measuring with oscilloscope and frequencymeter, and when i try with delays....nothing, dead, not even a glitc.
If you calculate the delays there should be an approx 36KHz signal on RB3, if i perform the same thing with numerous loops instead of the delay function everything works fine.
Yes iΒ΄m measuring with oscilloscope and frequencymeter, and when i try with delays....nothing, dead, not even a glitc.
If you calculate the delays there should be an approx 36KHz signal on RB3, if i perform the same thing with numerous loops instead of the delay function everything works fine.
- 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: Delay problem!
Hm that seems very strange
Have you tried creating a simple program to create a 50% on 50% off cleaner waveform eg.
switch on the output
wait 14us
switch off the output
wait 14us
repeat
This should give you approximatley a 36KHz frequency on the output pin. This will also confirm if if is your program at fault or something to do with the us delays.
It might also be worth changing the output pin to see if that makes any difference on your results.
Have you tried creating a simple program to create a 50% on 50% off cleaner waveform eg.
switch on the output
wait 14us
switch off the output
wait 14us
repeat
This should give you approximatley a 36KHz frequency on the output pin. This will also confirm if if is your program at fault or something to do with the us delays.
It might also be worth changing the output pin to see if that makes any difference on your results.
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
-
electronix
- Posts: 58
- Joined: Sat Aug 22, 2009 5:45 pm
- Has thanked: 17 times
- Been thanked: 7 times
Re: Delay problem!
I have already tried both ports and differnt bits, have also changed the PIC a couple of times,I tried too make the same kind of program for a 16F88 but with the same result unfortunattely.......
Strange as it seems, if i set the dutycycle to 50% as you suggested, its working.
Strange as it seems, if i set the dutycycle to 50% as you suggested, its working.
-
electronix
- Posts: 58
- Joined: Sat Aug 22, 2009 5:45 pm
- Has thanked: 17 times
- Been thanked: 7 times
Re: Delay problem!
Ok...This is really weird, When i change the values back again to the original ones(17us, 5us)....ItΒ΄s all...just working fine.
This is most remarkable, I have been trying these steps over and over several times the past 14 hours.
This is most remarkable, I have been trying these steps over and over several times the past 14 hours.
- 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: Delay problem!
Hello
I wonder if the bugs from the programs you created in V4.0 were still in effect even though you were since running v4.1.
Recreating the programs or even modifying the values in the delay icons may have been enough to allow them to work correctly with v4.1.
Glad its all working correctly for you now anyway.
I wonder if the bugs from the programs you created in V4.0 were still in effect even though you were since running v4.1.
Recreating the programs or even modifying the values in the delay icons may have been enough to allow them to work correctly with v4.1.
Glad its all working correctly for you now anyway.
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
-
electronix
- Posts: 58
- Joined: Sat Aug 22, 2009 5:45 pm
- Has thanked: 17 times
- Been thanked: 7 times
Re: Delay problem!
Hello Ben.
That seems most likely, because now that i have re-made all the delays in all of my programs, everything seems too be working just fine.
Thanks a lot for helping me sort this out Ben.
Best regards
/Stefan
That seems most likely, because now that i have re-made all the delays in all of my programs, everything seems too be working just fine.
Thanks a lot for helping me sort this out Ben.
Best regards
/Stefan