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 : SetPin "OC"
Author | Message | ||||
palcal Guru Joined: 12/10/2011 Location: AustraliaPosts: 1804 |
From the manual: However in the COMMANDS section there is no mention of its use. So do I use SETPIN(pin),OC. If so can I use it with the command SETPIN(pin),0 on a 5v tolerant pin to sink 5v. from a reed relay that draws 10mA. If that is OK how do I return the pin to OFF do I use SETPIN(pin),OFF or SETPIN(PIN),1 Paul. "It is better to be ignorant and ask a stupid question than to be plain Stupid and not ask at all" |
||||
TassyJim Guru Joined: 07/08/2011 Location: AustraliaPosts: 5911 |
SETPIN(mypin),DOUT,OC to configure the pin PIN(mypin) = 1 and PIN(mypin) = 0 to turn it on and off SETPIN(mypin),OFF to return the pin to unconfigured state (high impedance). VK7JH MMedit MMBasic Help |
||||
palcal Guru Joined: 12/10/2011 Location: AustraliaPosts: 1804 |
Thanks Jim, I'll see if I can activate the relay. Paul. "It is better to be ignorant and ask a stupid question than to be plain Stupid and not ask at all" |
||||
Phil23 Guru Joined: 27/03/2016 Location: AustraliaPosts: 1664 |
Hi Paul, I'm driving a stack of relays which are all OC & Opto coupled, 5V & with 8 on one particular controller, they don't all end up on 5V pins, but have still all worked fine for over 18 months. I configure my pins with a line like this, simply so the relays default to the off state. [Code]SetPin(Fan1L),DOUT,OC : Pin(Fan1L)=1[/code] Cheers Phil. |
||||
palcal Guru Joined: 12/10/2011 Location: AustraliaPosts: 1804 |
Thanks for that Phil, I could no get mine to operate so I ordered a 3 volt relay. I will test the relay first and have another try. Paul. "It is better to be ignorant and ask a stupid question than to be plain Stupid and not ask at all" |
||||
bigmik Guru Joined: 20/06/2011 Location: AustraliaPosts: 2870 |
Hi Paul, Silly question. You are using a PULL-UP resistor on your OC pin aren't you? Kind Regards, Mick EDIT*** You should also be driving the pin LOW to activate your relays (ie. supplying the GND not the Source) Mik Mick's uMite Stuff can be found >>> HERE (Kindly hosted by Dontronics) <<< |
||||
centrex Guru Joined: 13/11/2011 Location: AustraliaPosts: 320 |
Sorry Mick If the relay is connected to plus 5 volts and the other side of the relay to the open collector pin, when the pin is pulled low the relay will operate. Please don't forget the back emf diode across the relay coil or you could kill the chip. Regards Cliff |
||||
palcal Guru Joined: 12/10/2011 Location: AustraliaPosts: 1804 |
Thanks to all, I have the back emf diode in place and it is working OK now. Paul. @ Centrex I think that is what Mick said. "It is better to be ignorant and ask a stupid question than to be plain Stupid and not ask at all" |
||||
Print this page |