Home
JAQForum Ver 20.06
Log In or Join  
Active Topics
Local Time 21:14 29 Apr 2024 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 : CMM - Keeping a pin alive when...

Author Message
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9063
Posted: 12:40am 28 Nov 2014
Copy link to clipboard 
Print this post

Is there any way to keep a pin as set when you go to the editor?

In my case, it is pin 19 - I need this to stay high when you call the editor.
At the moment, pin 19(and all the other pins I expect) is going low when I call the editor.

I am remote controlling the CMM via the console on com1, and the relay that switches the COM port lines over to the network module(and also powers up the network module) is controlled by pin 19.

This is working fantastically across the network(and WAN too) to the CMM console, but if I type EDIT to go to the editor, everything goes cookoo!

Calling EDIT causes pin 19 to drop back to low, this shuts off the opto-coupler/transistor arrangement I have to switch over the COM port to the console, and liven up the network module. Once that has dropped off, goodbye connection.

Does anyone know if there is a way to stop that happening?
Poke-ing a memory value perhaps?
Smoke makes things work. When the smoke gets out, it stops!
 
bigmik

Guru

Joined: 20/06/2011
Location: Australia
Posts: 2870
Posted: 01:08am 28 Nov 2014
Copy link to clipboard 
Print this post

Grogs,

Maybe the pins revert to an input when in the editor?? If that is the case try a 4k7 ohm pullup..

If they dont set as an input do a change to set it as an input just before you enter the editor (with the pull up).

Mick


Mick's uMite Stuff can be found >>> HERE (Kindly hosted by Dontronics) <<<
 
WhiteWizzard
Guru

Joined: 05/04/2013
Location: United Kingdom
Posts: 2794
Posted: 01:26am 28 Nov 2014
Copy link to clipboard 
Print this post

The editor resets the pins state - I remember reading a post from Geoff sometime back where he says all resources are needed by the editor. I will continue looking but maybe Geoff can chime in here to confirm.

Is a hardware option acceptable by you?

WW
For everything Micromite visit micromite.org

Direct Email: whitewizzard@micromite.o
 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3165
Posted: 02:16am 28 Nov 2014
Copy link to clipboard 
Print this post

I am not near the source code at this time so, without checking, there are a number of events that reset the inputs (such as NEW) and I bet that EDIT is one of them.

A pullup to 3.3V will keep your I/O pin high while MMBasic is restarting or is reset by something like EDIT.

One thing to remember is that normally when SETPIN is used to set an output it will start off low but you can set the pin output high BEFORE you use SETPIN. So, if you use PIN(xx) = 1 before SETPIN it will ensure that the output starts high (so that you don't have a glitch when SETPIN takes effect).

I hope that makes sense...

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

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9063
Posted: 02:15pm 28 Nov 2014
Copy link to clipboard 
Print this post

Thanks for all that info, guys. I will have a play on the breadboard.

Because the CMM controls this line, it is normally low, only going high when remote-access is enabled. When network admin is not needed(most of the time), the line is low, and the network module is disabled. When the network is needed, the CMM sets this line high, which turns on the network side of things and swaps the COM port over for console use via the relay, which is controlled by an opto-coupler to ground, and a pass transistor.

SO, adding a pull-up resistor will permanently enable the network, which is not what I want or need, but I need to test on the breadboard, if pulling the line low with the likes of a 4k7 pull-up in place, will be enough to cause the optocoupler to drop off. Assuming there is enough current to light the LED in the optocoupler, the network will be switched on.

Like I say - I need to test this, which I will do later. One would HOPE that if the CMM pulls that line low, even with the 4k7 pull-up, the LED in the optocoupler will then be have more of a ground then the 4k7 can supply, holding it off, and the network side of things also.

A simple LED + resistor across a 3v3 supply, a 4k7 pullup and a jumper wire to jumper the pullup side of things to ground should prove it one way or the other, and so long as the test LED goes off.....
Smoke makes things work. When the smoke gets out, it stops!
 
Print this page


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

© JAQ Software 2024