PIC16F1508 Timer 2 and PWM Component Problem [Solved]
Moderator: Benj
- QMESAR
- Valued Contributor
- Posts: 1287
- Joined: Sun Oct 05, 2014 3:20 pm
- Location: Russia
- Has thanked: 384 times
- Been thanked: 614 times
- Contact:
PIC16F1508 Timer 2 and PWM Component Problem [Solved]
Hi All.
Happy New year to all ,I wish you all of the best for 2018 .
There seams to be 2 errors in the PWM component for PIC16F508
(1) The Timer 2 pre-scaler can only be set to 16 as maximum and the actual device has maximum pre-scaler of 64,
(2) when compiling the PWM results in an error when the PWM Enable function(makro) is called
Have good time
Happy New year to all ,I wish you all of the best for 2018 .
There seams to be 2 errors in the PWM component for PIC16F508
(1) The Timer 2 pre-scaler can only be set to 16 as maximum and the actual device has maximum pre-scaler of 64,
(2) when compiling the PWM results in an error when the PWM Enable function(makro) is called
Have good time
- Attachments
-
- 1.jpg (64.06 KiB) Viewed 4708 times
-
- 2.jpg (46.76 KiB) Viewed 4708 times
-
- 3.jpg (226.51 KiB) Viewed 4708 times
https://www.flowcodexchange.com/
Regards QMESAR
Regards QMESAR
- 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: PIC16F1508 Timer 2 and PWM Component Problem
Hi Peter,
The attached definitions now have the /64 prescaler for the Timer2 interrupt and PWM.
Simply extract the files into your "Flowcode 7/FCD/PIC" folder and restart Flowcode.
As for your compile errors it looks like you're out of memory on the device.
The attached definitions now have the /64 prescaler for the Timer2 interrupt and PWM.
Simply extract the files into your "Flowcode 7/FCD/PIC" folder and restart Flowcode.
As for your compile errors it looks like you're out of memory on the device.
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
- QMESAR
- Valued Contributor
- Posts: 1287
- Joined: Sun Oct 05, 2014 3:20 pm
- Location: Russia
- Has thanked: 384 times
- Been thanked: 614 times
- Contact:
Re: PIC16F1508 Timer 2 and PWM Component Problem
Hi Ben.
When I call the function set dutycycle for the PWM component it compiles fine ,when I add the PWM Enable it generates the error
as you will see below compiling with out the PWM Enable it compiles fine
It can not be! the Flowchart only blinks a led and I try to add a PWM pinAs for your compile errors it looks like you're out of memory on the device.
When I call the function set dutycycle for the PWM component it compiles fine ,when I add the PWM Enable it generates the error
as you will see below compiling with out the PWM Enable it compiles fine
- Attachments
-
- 12.jpg (69.01 KiB) Viewed 4694 times
https://www.flowcodexchange.com/
Regards QMESAR
Regards QMESAR
- QMESAR
- Valued Contributor
- Posts: 1287
- Joined: Sun Oct 05, 2014 3:20 pm
- Location: Russia
- Has thanked: 384 times
- Been thanked: 614 times
- Contact:
Re: PIC16F1508 Timer 2 and PWM Component Problem
Ben
I tested it again.
It compiles fine with the PWM component when I do not use the Enable call
when I call the PWM Enable the compiler throw an error
I tested it again.
It compiles fine with the PWM component when I do not use the Enable call
when I call the PWM Enable the compiler throw an error
- Attachments
-
- 12.jpg (36.79 KiB) Viewed 4692 times
https://www.flowcodexchange.com/
Regards QMESAR
Regards QMESAR
- QMESAR
- Valued Contributor
- Posts: 1287
- Joined: Sun Oct 05, 2014 3:20 pm
- Location: Russia
- Has thanked: 384 times
- Been thanked: 614 times
- Contact:
Re: PIC16F1508 Timer 2 and PWM Component Problem
Ben let me investigate this memeory story a bit will be back
https://www.flowcodexchange.com/
Regards QMESAR
Regards QMESAR
- QMESAR
- Valued Contributor
- Posts: 1287
- Joined: Sun Oct 05, 2014 3:20 pm
- Location: Russia
- Has thanked: 384 times
- Been thanked: 614 times
- Contact:
Re: PIC16F1508 Timer 2 and PWM Component Problem
Hi Ben.
attached the project it blinks only a LEd and Timer Interrupt
when using the enable PWM the compiler report errors and there is enough memory from what I can see from the compiler report
I have the feeling there is a component error some where
Thanks a million the Timer 2 prescaler is working well now
attached the project it blinks only a LEd and Timer Interrupt
when using the enable PWM the compiler report errors and there is enough memory from what I can see from the compiler report
I have the feeling there is a component error some where
Thanks a million the Timer 2 prescaler is working well now
- Attachments
-
- p1508.rar
- (66.44 KiB) Downloaded 179 times
https://www.flowcodexchange.com/
Regards QMESAR
Regards QMESAR
- LeighM
- Matrix Staff
- Posts: 2178
- Joined: Tue Jan 17, 2012 10:07 am
- Has thanked: 481 times
- Been thanked: 699 times
- Contact:
Re: PIC16F1508 Timer 2 and PWM Component Problem
Thanks for the investigations QMESAR,
The RET_VAL issue is just a warning, and will not stop compilation.
Without the original source it is difficult to know what exactly is going on, but I suspect that the addition of the call is just tipping the total RAM over the edge. Or, more importantly, the compiler cannot allocate all the various memory requirements into the space available. Fragmentation being the main issue.
It looks like the extra 6 bytes required for the Enable macro is stopping the compiler from finding the 39 bytes for text11
The RET_VAL issue is just a warning, and will not stop compilation.
Without the original source it is difficult to know what exactly is going on, but I suspect that the addition of the call is just tipping the total RAM over the edge. Or, more importantly, the compiler cannot allocate all the various memory requirements into the space available. Fragmentation being the main issue.
It looks like the extra 6 bytes required for the Enable macro is stopping the compiler from finding the 39 bytes for text11
-
- Matrix Staff
- Posts: 9520
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
- Contact:
Re: PIC16F1508 Timer 2 and PWM Component Problem
Just a guess.
As there is no issue with V6 :You can see there is plenty of RAM free,
Could the issue be an XC8 compiler bug in free mode?
Reason I suggest that is in pro mode, this is memory consumed :
With V7 pro you can see both Program and Data space used is under 4%
As there is no issue with V6 :
Code: Select all
Target folder: M:\Flowcode Testing
Source name: M:\Flowcode Testing\AC Module V1.fcfx
Title:
Description:
Device: PIC.16F.16F1508
Generated by: Flowcode v6.1.4.0
Date: Wednesday, January 03, 2018 13:46:07
Users: 1
Registered to: Martin <Removed>
Licence key: JQE1YE
http://www.matrixtsl.com
Launching the compiler...
C:\Program Files (x86)\Flowcode 6\compilers\pic\boostc\boostc_16F.exe -v -t PIC16F1508 "AC Module V1.c"
Launching BoostC...
BoostC Optimizing C Compiler Version 7.20 (for PIC16 architecture)
http://www.sourceboost.com
Copyright(C) 2004-2013 Pavel Baranov
Copyright(C) 2004-2013 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
AC Module V1.c
Starting preprocessor: "C:\Program Files (x86)\Flowcode 6\compilers\pic\boostc\pp.exe" "AC Module V1.c" -i "C:\Program Files (x86)\Flowcode 6\compilers\pic\boostc\include" -d _PIC16F1508 -la -c2 -o "AC Module V1.pp" -v -d _BOOSTC -d _PIC16 -d _PIC16x -d _CHAR_INDEX
......................
AC Module V1.c success
success
Completed BoostC compilation, return = 0
Launching the linker/assembler...
C:\Program Files (x86)\Flowcode 6\compilers\pic\boostc\boostlink_picmicro.exe -ld "C:\Program Files (x86)\Flowcode 6\compilers\pic\boostc\lib" libc_16F.lib rand_16F.lib float_16F.lib "AC Module V1.obj" -t PIC16F1508 -d "M:\Flowcode Testing" -p "AC Module V1" -swcs 6 2
BoostLink Optimizing Linker Version 7.20
http://www.sourceboost.com
Copyright(C) 2004-2013 Pavel Baranov
Copyright(C) 2004-2013 David Hobday
Warning unreferenced functions removed:
FC_CAL_Port_In__x in: C:\Program Files (x86)\Flowcode 6\CAL\PIC\PIC_CAL_IO.c
FC_CAL_Port_Out__x in: C:\Program Files (x86)\Flowcode 6\CAL\PIC\PIC_CAL_IO.c
FC_CAL_Port_Out_DDR__x in: C:\Program Files (x86)\Flowcode 6\CAL\PIC\PIC_CAL_IO.c
Wdt_Delay_S in: C:\Program Files (x86)\Flowcode 6\CAL\PIC\PIC_CAL_Delay.c
Wdt_Delay_Ms in: C:\Program Files (x86)\Flowcode 6\CAL\PIC\PIC_CAL_Delay.c
FCI_DELAYINT_US in: C:\Program Files (x86)\Flowcode 6\CAL\PIC\PIC_CAL_Delay.c
FCI_DELAYINT_MS in: C:\Program Files (x86)\Flowcode 6\CAL\PIC\PIC_CAL_Delay.c
FCI_DELAYINTWDT_MS in: C:\Program Files (x86)\Flowcode 6\CAL\PIC\PIC_CAL_Delay.c
FCI_DELAYINT_S in: C:\Program Files (x86)\Flowcode 6\CAL\PIC\PIC_CAL_Delay.c
FCI_DELAYINTWDT_S in: C:\Program Files (x86)\Flowcode 6\CAL\PIC\PIC_CAL_Delay.c
FCI_GETCHAR in: C:\Program Files (x86)\Flowcode 6\CAL\PIC\PIC_CAL_String.c
FCI_GETLENGTH in: C:\Program Files (x86)\Flowcode 6\CAL\PIC\PIC_CAL_String.c
FCI_MIDSTRING in: C:\Program Files (x86)\Flowcode 6\CAL\PIC\PIC_CAL_String.c
FCI_LEFTSTRING in: C:\Program Files (x86)\Flowcode 6\CAL\PIC\PIC_CAL_String.c
FCI_RIGHTSTRING in: C:\Program Files (x86)\Flowcode 6\CAL\PIC\PIC_CAL_String.c
FCI_TOSTRING in: C:\Program Files (x86)\Flowcode 6\CAL\PIC\PIC_CAL_String.c
FCI_TOSTRS16 in: C:\Program Files (x86)\Flowcode 6\CAL\PIC\PIC_CAL_String.c
FCI_TOSTRS32 in: C:\Program Files (x86)\Flowcode 6\CAL\PIC\PIC_CAL_String.c
FCI_TOSTRU16 in: C:\Program Files (x86)\Flowcode 6\CAL\PIC\PIC_CAL_String.c
FCI_TOSTRU32 in: C:\Program Files (x86)\Flowcode 6\CAL\PIC\PIC_CAL_String.c
FCI_TOLOWER in: C:\Program Files (x86)\Flowcode 6\CAL\PIC\PIC_CAL_String.c
FCI_TOUPPER in: C:\Program Files (x86)\Flowcode 6\CAL\PIC\PIC_CAL_String.c
FCI_COMPARE in: C:\Program Files (x86)\Flowcode 6\CAL\PIC\PIC_CAL_String.c
FCI_FLOAT_TO_STRING in: C:\Program Files (x86)\Flowcode 6\CAL\PIC\PIC_CAL_String.c
FCI_NUMBER_TO_HEX in: C:\Program Files (x86)\Flowcode 6\CAL\PIC\PIC_CAL_String.c
FCI_STRING_TO_INT in: C:\Program Files (x86)\Flowcode 6\CAL\PIC\PIC_CAL_String.c
FCI_STRING_TO_FLOAT in: C:\Program Files (x86)\Flowcode 6\CAL\PIC\PIC_CAL_String.c
FCI_STRREV in: C:\Program Files (x86)\Flowcode 6\CAL\PIC\PIC_CAL_String.c
FCI_STRMOV in: C:\Program Files (x86)\Flowcode 6\CAL\PIC\PIC_CAL_String.c
FCI_SHEAD in: C:\Program Files (x86)\Flowcode 6\CAL\PIC\PIC_CAL_String.c
FCI_SCOPY in: C:\Program Files (x86)\Flowcode 6\CAL\PIC\PIC_CAL_String.c
isinf in: C:\Program Files (x86)\Flowcode 6\CAL\PIC\PIC_CAL_Float.c
pow in: C:\Program Files (x86)\Flowcode 6\CAL\PIC\PIC_CAL_Float.c
flt_round in: C:\Program Files (x86)\Flowcode 6\CAL\PIC\PIC_CAL_Float.c
flt_floor in: C:\Program Files (x86)\Flowcode 6\CAL\PIC\PIC_CAL_Float.c
flt_ceil in: C:\Program Files (x86)\Flowcode 6\CAL\PIC\PIC_CAL_Float.c
flt_atan in: C:\Program Files (x86)\Flowcode 6\CAL\PIC\PIC_CAL_Float.c
cos in: C:\Program Files (x86)\Flowcode 6\CAL\PIC\PIC_CAL_Float.c
sin in: C:\Program Files (x86)\Flowcode 6\CAL\PIC\PIC_CAL_Float.c
tan in: C:\Program Files (x86)\Flowcode 6\CAL\PIC\PIC_CAL_Float.c
FCD_0ba71_PWM_Digital__ReadASCIILUT in: M:\Flowcode Testing\AC Module V1.c
FC_CAL_PWM_Disable_1 in: C:\Program Files (x86)\Flowcode 6\CAL\PIC\PIC_CAL_PWM.c
FC_CAL_PWM_SetDuty8Bit_1 in: C:\Program Files (x86)\Flowcode 6\CAL\PIC\PIC_CAL_PWM.c
FC_CAL_PWM_SetDuty10Bit_1 in: C:\Program Files (x86)\Flowcode 6\CAL\PIC\PIC_CAL_PWM.c
FCD_0df41_PWM1__ChangePeriod in: M:\Flowcode Testing\AC Module V1.c
FCD_0df41_PWM1__Disable in: M:\Flowcode Testing\AC Module V1.c
FCD_0df41_PWM1__SetDutyCycle in: M:\Flowcode Testing\AC Module V1.c
FCD_0df41_PWM1__SetDutyCycle10Bit in: M:\Flowcode Testing\AC Module V1.c
Building CASM file
Memory Usage Report
===================
RAM available:256 bytes, used:40 bytes (15.7%), free:216 bytes (84.3%),
Heap size:216 bytes, Heap max single alloc:95 bytes
ROM available:4096 words, used:197 words (4.9%), free:3899 words (95.1%)
success
FINISHED
Could the issue be an XC8 compiler bug in free mode?
Reason I suggest that is in pro mode, this is memory consumed :
Code: Select all
Memory Summary:
Program space used 86h ( 134) of 1000h words ( 3.3%)
Data space used Ah ( 10) of 100h bytes ( 3.9%)
EEPROM space None available
Data stack space used 0h ( 0) of F0h bytes ( 0.0%)
Configuration bits used 2h ( 2) of 2h words (100.0%)
ID Location space used 0h ( 0) of 4h bytes ( 0.0%)
Launching the linker/assembler...
C:\Program Files (x86)\Flowcode 7\tools\DoNothing\DoNothing.exe
FINISHED
Martin
- QMESAR
- Valued Contributor
- Posts: 1287
- Joined: Sun Oct 05, 2014 3:20 pm
- Location: Russia
- Has thanked: 384 times
- Been thanked: 614 times
- Contact:
Re: PIC16F1508 Timer 2 and PWM Component Problem
Guys
It something strange but see my other post just adding the pwm component the memory usage increase by 50% ,I will now run the PWM with a normal C code function and see the memory usage ,
I am confused here
It something strange but see my other post just adding the pwm component the memory usage increase by 50% ,I will now run the PWM with a normal C code function and see the memory usage ,
I am confused here
https://www.flowcodexchange.com/
Regards QMESAR
Regards QMESAR
- QMESAR
- Valued Contributor
- Posts: 1287
- Joined: Sun Oct 05, 2014 3:20 pm
- Location: Russia
- Has thanked: 384 times
- Been thanked: 614 times
- Contact:
Re: PIC16F1508 Timer 2 and PWM Component Problem
@martin
I dought it is the free mode causing the issue the exacty same Flowchart just in C Code in MPLAB pleanty of memory left.
I am confused
I dought it is the free mode causing the issue the exacty same Flowchart just in C Code in MPLAB pleanty of memory left.
I am confused
- Attachments
-
- 15.jpg (117.14 KiB) Viewed 4678 times
https://www.flowcodexchange.com/
Regards QMESAR
Regards QMESAR
- QMESAR
- Valued Contributor
- Posts: 1287
- Joined: Sun Oct 05, 2014 3:20 pm
- Location: Russia
- Has thanked: 384 times
- Been thanked: 614 times
- Contact:
Re: PIC16F1508 Timer 2 and PWM Component Problem
Guys Thanks any how I have it now in C code I will just carry on there ,
Edit,
may be we are on something I will give it ago again
Have good time
Edit,
may be we are on something I will give it ago again
Have good time
https://www.flowcodexchange.com/
Regards QMESAR
Regards QMESAR