Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 18:31 05 Jul 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : Option PIN lock interrupt execution?

Author Message
sagt3k

Guru

Joined: 01/02/2015
Location: Italy
Posts: 313
Posted: 08:13pm 08 Nov 2016
Copy link to clipboard 
Print this post

Hi Geoff
When I use "option pin" in code, after that micromite wait to input code, all interrupt locks execution.
I think that if the user digit code, in meantime the interrupt should follow the code declared in "settick".If right code is correct break execution.
Thanks
Sagt3k
 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3282
Posted: 11:01pm 08 Nov 2016
Copy link to clipboard 
Print this post

Sorry Antonio but I don't understand what you are saying.

Regardless, OPTION PIN was not intended to be used in a program - perhaps using it that way should throw an error.

Geoff
Geoff Graham - http://geoffg.net
 
sagt3k

Guru

Joined: 01/02/2015
Location: Italy
Posts: 313
Posted: 11:49pm 08 Nov 2016
Copy link to clipboard 
Print this post

Hi Geoff
My code is
Option pin 123456
Settick 250,LED2
Sub LED2
Pin(2)=not pin(2)
Pause 250
End sub

When I connect with uart pin code is request and all interrupts are blocked. Ok
I have not possibility to control interrupts or watchdog.So the user remains on PIN input without typing anything block forever the correct flow. I think than on "option pin" would be appropriate set a maxtimeout, o for example 20second. After no input, you could redo the Reset of CPU
sorry if i'm not clear
sagt3k

 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9588
Posted: 12:36am 09 Nov 2016
Copy link to clipboard 
Print this post

Geoff is right - you should NOT be using OPTION PIN in code. You issue that at the command prompt only.

That done, any attempt to access the code must use the following procedure:

1) CTRL+C to attempt to stop the running code
2) Enter the PIN number

Perhaps you are not issuing a CTRL+C first?

In any event, having this command inside the code, and in a sub which could be called many times, is not really a good idea.

If I am correct in understanding you, what you want is a timeout for entering the PIN number. My guess is that you have an issue whereby if prompted for the PIN, the code stops running waiting for the PIN, and if you never enter one, the code never resumes.

Yes?

WATCHDOG should still get you around that problem, as even if the code stops, the WATCHDOG timer runs in the background and does not need the main code to be running to work. When that timer runs out, the PIC32 core will be restarted, and if OPTION AUTORUN ON has been entered, then your code will restart, getting you out of that problem.

Perhaps I also do not understand what you are trying to do?

EDIT: I have just been having a bit of a read about this, and you are correct and I am wrong on this one. If you use CTRL+C to break the program, you WILL be prompted for the PIN number, but this will also stop the watchdog timer. Standard manual, page 73. Therefore, I think the only way around that would be to use an external watchdog timer circuit, which is pulsed(and therefore reset) by a pin and the running code. The external watchdog could then reset the PIC32 if it timed out.Edited by Grogster 2016-11-10
Smoke makes things work. When the smoke gets out, it stops!
 
sagt3k

Guru

Joined: 01/02/2015
Location: Italy
Posts: 313
Posted: 12:53am 09 Nov 2016
Copy link to clipboard 
Print this post

Hi Geoff
I'm working with esp8266 + firmware Esp-Link.
I have micromite on internet and console on esp8266's uart.
So with portforwarding and my smartphone I can control or edit the code. My problem is security. If I have a code in running and I have set pin option, I would prefer restart the code if pin code it was non entered on time.
Thanks
Geoff You are the best
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9588
Posted: 12:58am 09 Nov 2016
Copy link to clipboard 
Print this post

I am not Geoff, but......

OK, I think that is your problem.

1) Your program running normally
2) You enter CTRL+C at the console(via the ESP8266)
3) You are prompted for the PIN code
4) IF you never enter a PIN code, the program never resumes running.

Does that sound right?

So in other words, if you don't enter something at the PIN code prompt, the program is effectively stopped forever at that point, yes?
Smoke makes things work. When the smoke gets out, it stops!
 
sagt3k

Guru

Joined: 01/02/2015
Location: Italy
Posts: 313
Posted: 01:05am 09 Nov 2016
Copy link to clipboard 
Print this post

Sorry Grogster
Yessssssss centered ....
Yeahhhh
 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3282
Posted: 07:07am 09 Nov 2016
Copy link to clipboard 
Print this post

Good try Grogs but this still does not make sense.

As far as I can see Antonio, this request is to fix a special problem that is specific to you. As I said in another thread, I don't want to implement features in MMBasic that would not have wide usage.

BTW, it is easy to disable CTRL-C if you wanted to.

Geoff
Geoff Graham - http://geoffg.net
 
sagt3k

Guru

Joined: 01/02/2015
Location: Italy
Posts: 313
Posted: 09:08am 09 Nov 2016
Copy link to clipboard 
Print this post

Hi to everybody
I agree with Geoff. It is impossible to consider all requests from users. But the forum does just that, make their own experiences and make them available to all.
Thanks
Geoff
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9588
Posted: 11:58am 09 Nov 2016
Copy link to clipboard 
Print this post

I still think that IF I understand you correctly, you could get around your problem with an external watchdog circuit - they have been tossed around the forums before.

I and other members developed one based on a 555 timer, which worked well, but then the WATCHDOG command came into the language and I did not use it anymore, but it might suit your problem.

555 Watchdog thread
Smoke makes things work. When the smoke gets out, it stops!
 
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025