![]() |
Forum Index : Microcontroller and PC projects : Option PIN lock interrupt execution?
Author | Message | ||||
sagt3k![]() Guru ![]() Joined: 01/02/2015 Location: ItalyPosts: 313 |
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: AustraliaPosts: 3282 |
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: ItalyPosts: 313 |
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 ZealandPosts: 9588 |
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. Smoke makes things work. When the smoke gets out, it stops! |
||||
sagt3k![]() Guru ![]() Joined: 01/02/2015 Location: ItalyPosts: 313 |
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 ZealandPosts: 9588 |
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: ItalyPosts: 313 |
Sorry Grogster Yessssssss centered .... ![]() Yeahhhh |
||||
Geoffg![]() Guru ![]() Joined: 06/06/2011 Location: AustraliaPosts: 3282 |
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: ItalyPosts: 313 |
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 ZealandPosts: 9588 |
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! |
||||
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |