Home
JAQForum Ver 20.06
Log In or Join  
Active Topics
Local Time 06:17 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 : SetPin "OC"

Author Message
palcal

Guru

Joined: 12/10/2011
Location: Australia
Posts: 1804
Posted: 12:22pm 20 Jul 2017
Copy link to clipboard 
Print this post

From the manual:
  Quote  The "OC" option on the SETPIN command makes the output pin open collector.

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.Edited by palcal 2017-07-21
"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: Australia
Posts: 5911
Posted: 01:41pm 20 Jul 2017
Copy link to clipboard 
Print this post

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: Australia
Posts: 1804
Posted: 01:47pm 20 Jul 2017
Copy link to clipboard 
Print this post

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: Australia
Posts: 1664
Posted: 11:33am 21 Jul 2017
Copy link to clipboard 
Print this post

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: Australia
Posts: 1804
Posted: 11:23am 22 Jul 2017
Copy link to clipboard 
Print this post

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: Australia
Posts: 2870
Posted: 06:18pm 22 Jul 2017
Copy link to clipboard 
Print this post

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)

MikEdited by bigmik 2017-07-24
Mick's uMite Stuff can be found >>> HERE (Kindly hosted by Dontronics) <<<
 
centrex

Guru

Joined: 13/11/2011
Location: Australia
Posts: 320
Posted: 08:19pm 22 Jul 2017
Copy link to clipboard 
Print this post

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: Australia
Posts: 1804
Posted: 10:52pm 22 Jul 2017
Copy link to clipboard 
Print this post

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


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

© JAQ Software 2024