Fixed frequency timed output

An area to discuss 8-bit PIC specific problems and examples

Moderator: Benj

medelec35
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: Fixed frequency timed output

Post by medelec35 »

Hi Bob,
maybe best to try on hardware.
I can see where there would be a stack issue.
Unless the I2C backpack is causing an issue with the stack?
Perhaps matrix staff would know the answer?
I'm note sure how to increase software stack with XC8?
Martin

siliconchip
Posts: 392
Joined: Wed Jan 05, 2011 11:24 am
Has thanked: 101 times
Been thanked: 24 times
Contact:

Re: Fixed frequency timed output

Post by siliconchip »

hi martin
thanks for your help again, with regards stack would using a different chip help ?? i agree i need to use hardware to test i thought using proteus would be quicker and easier for now, if any matrix staff are looking it would be great for any explanation. As always martin thanks for your help but ive got a feeling i will be back lol

bob

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: Fixed frequency timed output

Post by Benj »

Hello,

I'm fairly sure the compiler in v7 and v8 will automatically use a software stack if required so it could be either proteus is throwing a warning that isn't a problem or there is a serious stack issue in your program and you have function A calling function B calling function A etc.

If you post your latest program we can have a look for this.

siliconchip
Posts: 392
Joined: Wed Jan 05, 2011 11:24 am
Has thanked: 101 times
Been thanked: 24 times
Contact:

Re: Fixed frequency timed output

Post by siliconchip »

Hi benj
Thanks for the reply my program is the one a couple of posts ago 60Hz freq v2 i would appreciate any input from you cheers

Bob

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: Fixed frequency timed output

Post by Benj »

Make sure the Sim property is set to No before compiling. That's the only thing I can spot.

siliconchip
Posts: 392
Joined: Wed Jan 05, 2011 11:24 am
Has thanked: 101 times
Been thanked: 24 times
Contact:

Re: Fixed frequency timed output

Post by siliconchip »

hi benj
how would i set sim property to no ???

bob

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: Fixed frequency timed output

Post by Benj »

Hello,

With nothing selected just look at the properties window.
SimProp.jpg
SimProp.jpg (9.63 KiB) Viewed 4664 times

siliconchip
Posts: 392
Joined: Wed Jan 05, 2011 11:24 am
Has thanked: 101 times
Been thanked: 24 times
Contact:

Re: Fixed frequency timed output

Post by siliconchip »

hi benj
i clicked on the properties and sim already there as a No ???,i clicked on yes then back to no and recompiled but no change therefore i guess hardware testing is the only option now in case proteus is over reacting ? just out of curiosity ive added what proteus is displaying when it fails if this helps


[PIC16 CORE] PC=0x04C0. Stack overflow executing CALL instruction. [U1]

in the source code this comes back as - FCV_FREQ=FCV_TIMERTICK/2

[PIC16 CORE] PC=0x04D5. Stack underflow executing RETURN instruction. [U1]

in source code box this comes back as, - FCV_SQUAREWAVEENABLE=0,

[PIC16 CORE] PC=0x04D8. Stack underflow executing RETURN instruction. [U1]

in source code = FCP SET(B, A, 0X01, 0, (0) ),

[PIC16 CORE] PC=0x070F. Stack underflow executing RETFIE instruction. [U1]

in source code = void FCD_0c591_lcd_I2C1__Cursor(MX_UINT8 FCL_X,MX_UINT8, FCL_Y)

The above flag multiple times if left running

bob

siliconchip
Posts: 392
Joined: Wed Jan 05, 2011 11:24 am
Has thanked: 101 times
Been thanked: 24 times
Contact:

Re: Fixed frequency timed output

Post by siliconchip »

hi all
quick up date with the issues ive been having while trying to simulate my code within proteus, i was using the pic16f877 but proteus software kept flagging stack underflow etc and failed to simulate after a few seconds of running, the ultimate solution would of been too build the circuit in hardware but it turned out i didn't have an 877 :oops: :oops: anyways i opted for a 16f1825 changed my code and proteus now runs the simulation with no issues, next step using hardware i built the circuit with the 1825 and had no issues it ran perfectly, flowcode also when compiling with the 1825 gave me no stack warnings as it did with the 877, so there is obviously differences with the stack of the 2 chips, and upon reflection maybe the 877 was the wrong choice anyway as the 1825 is only a 14 pin device compared to the physically larger 877, thanks to everyone who helped with this issue

bob

Post Reply