The MIAC dsPIC Interrup reset

For MIAC users to discuss projects, applications, and any other issues related to the MIAC unit.

Moderators: Benj, Mods

Post Reply
Monie Jacobsen
Posts: 484
Joined: Mon Jul 30, 2012 3:39 pm
Has thanked: 17 times
Been thanked: 46 times
Contact:

The MIAC dsPIC Interrup reset

Post by Monie Jacobsen »

Hello everyone
When simulated in the Flowcode program, the codes work.
I am working to get MAC sdPIC with the attached codes to work in the real world?
Works to get attached codes to work with MAC sPICE Interrup reset function, but without success.
Have tried a lot ;-)
Would you like to help make the codes work?

Attach file:
MIAC dsPIC Interrup Induktiv Stop.fcfx
(76.08 KiB) Downloaded 294 times
Best Regard
Monie

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: The MIAC dsPIC Interrup reset

Post by Benj »

Hi Monie,

Can you explain what currently isn't working. I've had a look through your program and can spot a couple of things but not sure if they are related to the problem your having.

1) The timer interrupt is firing quite fast > 1000Hz, is this correct?

2) In TvangRunOstWest the only decision for Reset_Noed = 1 is directly after the variable is populated from the input. The other Reset_Noed = 0 clears will be overwritten before the decision. Maybe move the input icon to the no branch so the no branch gets at least one time to run every cycle?

As I say these could be unrelated.

Monie Jacobsen
Posts: 484
Joined: Mon Jul 30, 2012 3:39 pm
Has thanked: 17 times
Been thanked: 46 times
Contact:

Re: The MIAC dsPIC Interrup reset

Post by Monie Jacobsen »

Hi Benj

1: The timer interrupt is firing quite fast> 1000Hz, is this correct?
Answer: Do not know where to set the timer interrupt ??

2: Wishes that when the reset button is activated, East or West can be run again

3: Attempted to move the input icon to the no branch, but unsuccessfully.

I agree that I ignore any procedure ;-)
But can not see how it can correct to get the Reset button to work correctly.

The Reset button is a manual function.

Please help with your proposal to correct the codes so they work as desired.

Thank you very much in advance
Best Regard
Monie

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: The MIAC dsPIC Interrup reset

Post by Benj »

1: The timer interrupt is firing quite fast> 1000Hz, is this correct?
Answer: Do not know where to set the timer interrupt ??
Double click the Timer Interrupt enable icon in Main.
Then click the Properties... button.

Monie Jacobsen
Posts: 484
Joined: Mon Jul 30, 2012 3:39 pm
Has thanked: 17 times
Been thanked: 46 times
Contact:

Re: The MIAC dsPIC Interrup reset

Post by Monie Jacobsen »

Hi Benj

Have tried The timer interrupt is firing quite fixed> 1000Hz;-)
EgenskaberInterrup.JPG
EgenskaberInterrup.JPG (46.83 KiB) Viewed 7670 times
Have tried the following file. But does not work in the real world
Attached file:
MIAC dsPIC Interrup Induktiv Stop.fcfx
(76.08 KiB) Downloaded 319 times
Would you be helpful. These codes would I be able to use in other projects!
Best Regard
Monie

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: The MIAC dsPIC Interrup reset

Post by Benj »

Hi Monie,

Can you explain what you need the program to do. it might be that the timer interrupt is not needed and we can simplify things.

Currently it looks like you have a timer interrupt that enables a flag, this interrupt is firing so fast that the flag might as well just be fixed to be 1.

You then have a edge triggered interrupt that fires based on a switch which allows you to go into different branches of the EastWest macro.

You also have a reset switch that is sampled as part of one of the EastWest branches that resets the state of the EastWest branch.

Monie Jacobsen
Posts: 484
Joined: Mon Jul 30, 2012 3:39 pm
Has thanked: 17 times
Been thanked: 46 times
Contact:

Re: The MIAC dsPIC Interrup reset

Post by Monie Jacobsen »

Hello everyone
I underestimate much when I can not make myself understandable.
Action Description:
The program must stop interrupting East or West by Interrup when an Inductive Sensor is activated.
And by switch, stop reset to run again.
I want to use Interrupt as I want a global stop for ongoing action such as East - West - Up - Down.
I understand that I'm jammed in the codes ;-)
Best Regard
Monie

Monie Jacobsen
Posts: 484
Joined: Mon Jul 30, 2012 3:39 pm
Has thanked: 17 times
Been thanked: 46 times
Contact:

Re: The MIAC dsPIC Interrup reset

Post by Monie Jacobsen »

Hello everyone
If there is no one here that will help to make an example of a learning code example that Interrup resets with the device MIAC dsPIC.
I would like to welcome you with a code example of the above wish.
Last edited by EtsDriver on Fri Jun 22, 2018 5:15 pm, edited 1 time in total.
Reason: Instead of double posting, you can make your topic seen as unread for all after certain time has passed, button is called "Bump topic"!
Best Regard
Monie

User avatar
LeighM
Matrix Staff
Posts: 2178
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 481 times
Been thanked: 699 times
Contact:

Re: The MIAC dsPIC Interrup reset

Post by LeighM »

Hi Monie

I think we have done an interrupt example in the past or could do another one, but I don't think this will necessarily help you.

You would still need to change the action of the main processing.
So in any loop that is running the motors you need to check for the Inductive Sensor and stop inputs, either directly or via an interrupt flag change.

Alternatively the best way to do this is via a "state machine" approach to programming.
Have a state variable that holds the current state of the process,
that is, a number that indicates what you are currently doing, nothing, moving left, right etc.
Use the main loop to monitor your various inputs (limit switch, stop etc) and the keypad.
Action is then taken on the various inputs depending upon the state, and moves to a new state.

This should also help to make the program more readable, and also avoid getting stuck in time consuming loops, which I think is causing the problems.

It is difficult to "fix" things in your current programs as it is not always obvious what you are trying to achieve.
Hope the above helps, but if you need any more specific help, ask again.
Best regards,
Leigh

Post Reply