Home
JAQForum Ver 20.06
Log In or Join  
Active Topics
Local Time 01:28 03 May 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 : Port pins during editing- workaround?

Author Message
jwettroth

Regular Member

Joined: 02/08/2011
Location: United States
Posts: 70
Posted: 06:29am 24 Dec 2016
Copy link to clipboard 
Print this post

I built an instrument around a mmite that has a "soft" on/off switch- the user presses a button that pulls the gate of a PFET low which applies system power, one of the first things that the mmite does is to write a high to a port pin that keeps the system on through a small NPN transistor. I have a variation where the key is still readable for use as a backlight control. On is a quick tap, backlight is a press once on and off is to hold down the key. Its pretty simple- I can post the circuit if anyone is interested. The real feature is that after some period of inactivity- the mmite can turn off the unit by just writing the pin high. I feel like this auto power down is a necessity for any portable instrument.

This all works well and is a real battery saver. The problem is that during development, the mmite doesn't maintain its port pins when the editor is invoked. As soon as the editor is invoked, it drops the pins and the unit turns off. If I'm on a breadboard, I can just wire the gate low temporarily while debugging. When a unit is packaged though, its not possible to make temporary circuit changes. I can hold the on switch down which works in the simple case but if the swtich is used during operation, its more complicated.

One solution that I've considered would be to have the gate of the PFET come out on the console connector and use a pin like RTS to control the power, it grounds the PFET gate and keeps the system on. This takes an extra pin the gate of a mosfet is not the most robust connection to have coming out of the box.

Is there a better workaround or am I missing something? Would it be possible if the mmite only cleared port pins when run was invoked? Why does it clear pins on edit- could it be another option?

I mostly use the now ancient MX150 version in most of these little designs.

Thanks all.
John Wettroth
 
Andrew_G
Guru

Joined: 18/10/2016
Location: Australia
Posts: 840
Posted: 01:37pm 24 Dec 2016
Copy link to clipboard 
Print this post

Hi John,
Merry Christmas. I can't help you with your question but I guess that post-Christmas more learned folk will chime in. I would be very interested in your code as I am part way into a project where turning the display on/off would be very useful (both for power consumption and to retain night vision). A simple circuit schematic would be great if that is easy?
Cheers,

AndrewEdited by Andrew_G 2016-12-25
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9066
Posted: 02:46pm 24 Dec 2016
Copy link to clipboard 
Print this post

I had a similar problem back in the days of the Colour Maximite, when I was using a relay on COM1 to share it between two devices. As soon as you went into the editor, the I/O pins reset to a high-impedance state, and the relay would drop off.

This is indeed still the case even with the MM+ series of chips.

My workaround was to use a latching relay, that would stay in the state it was put in, no matter what the I/O pins did if you invoked the editor.

That approach needed two I/O pins though - one each to select which way the latching relay was to be in. You may not have enough pins for that.

For any assembled unit, you could just have a jumper on the PCB to effect your wire link solution you have now, or if the product would be inside a case when you need to do this, I would be inclined to use something like a DIN socket for programming, and when you plug in the ICSP lead - which is a custom one for your product - two spare pins on the DIN socket are shorted by a link on the PLUG of the lead, which effectively forces the FET gate low any time you have the programming lead plugged in, then the unit will stay powered up no matter what you do in the editor. When you pull out the DIN plug, this will remove the short on the pins that is provided by the plug on the lead, and allow the unit to function normally.
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