Hello,
I am Michel in the North of France.
Can you help me?
I allow requesting you for a problem Flowcode, more particularly: the interruptions.
In Flowcode as attachment, the interruption is activated by an outside sensor ( a switch).
What I wish to make and which raises me problem, I would like to replace this switch by one potentiometer.
I have the chain of the operations, but I do not know how to make, but:
1) Is this possible to activate an interruption by a tension treated in the pic with the ADC Macro?
2) What pic to choose ( 12Fxxx, 16Fxxx or 18Fxxx) ?
Then:
- I attribute an entry of Analog conversion and I affect a variable; U_Var
- I attribute a reference size; U_Seuil
- I compare U_Var and U_Seuil
- According to the result of this comparison, I continue in the main program or I parts in the program of interruption.
Thank you.
Regards
Michel
Interrupt / ADC / Voltage
Moderator: Benj
-
- 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: Interrupt / ADC / Voltage
Hi Michel,
Not sure how easy it would be.
Not sure if you can have ADC and IOC on the same pin at the same time.
Perhaps the way is not have pin set for ADC just set it as port IOC.
You can have a high value trimmer connected between IOC pin and GND,
trimmer can be preset so if voltage below required trigger value then voltage on pin is at logic 0
When voltage on pin rises then when i/p goes from logic 0 to logic 1, IOC is triggered.
You can perhaps consider using the comparator feature of microcontroller instead of pin as IOC input?
I don't believe there is a comparator component within Flowcode so for that you will need to use C code to enable comparator + interrupt.
Martin
Not sure how easy it would be.
Not sure if you can have ADC and IOC on the same pin at the same time.
Perhaps the way is not have pin set for ADC just set it as port IOC.
You can have a high value trimmer connected between IOC pin and GND,
trimmer can be preset so if voltage below required trigger value then voltage on pin is at logic 0
When voltage on pin rises then when i/p goes from logic 0 to logic 1, IOC is triggered.
You can perhaps consider using the comparator feature of microcontroller instead of pin as IOC input?
I don't believe there is a comparator component within Flowcode so for that you will need to use C code to enable comparator + interrupt.
Martin
Martin