|
|
View previous topic :: View next topic |
Author |
Message |
Einly
Joined: 10 Sep 2003 Posts: 60
|
How to convert 8 24 volts input into pic16f876 pin? |
Posted: Thu Jul 22, 2004 9:45 pm |
|
|
Dear all,
I am using PIC16f876.
1) My input signal into Port B (8 pins) consists of 24 volts input. Since PIC receives 5V inputs, how should I convert all the 24 volts input into 5 volts?
2) I am using the port C to output signal to cypress chip. However, Cypress chip requires 3.3Volts input. May I know should I use a buffer/ any other components to convert it into 3.3 Volts? Any suggestion of any components?
Thanks a lot _________________ Einly |
|
|
Ttelmah Guest
|
Re: How to convert 8 24 volts input into pic16f876 pin? |
Posted: Fri Jul 23, 2004 2:34 am |
|
|
Einly wrote: | Dear all,
I am using PIC16f876.
1) My input signal into Port B (8 pins) consists of 24 volts input. Since PIC receives 5V inputs, how should I convert all the 24 volts input into 5 volts?
2) I am using the port C to output signal to cypress chip. However, Cypress chip requires 3.3Volts input. May I know should I use a buffer/ any other components to convert it into 3.3 Volts? Any suggestion of any components?
Thanks a lot |
The first, depends on what you want to 'do' with the signal. The simplest solution (assuming there is not perhaps some nasty 'noise' on the signal), is just a resistive divider. If there is the possibility of noise spikes, consider adding clamp diodes, and possibly some capacitive filtering, depending on the 'required' frequency involved. A more complex solution (assuming digital signals are involved), is a comparator chip.
The second can be done (crudely), using a similar divider. The 'better' solution, is a level shifter IC, like perhaps the MAX3374. If the Cypress chip 'talks back', then a bidirectional verson, is the MAX3372. The noise margins, and signalling reliability is a lot better using this type of chip, than trying to do it in a cruder manner. For output 'only', a resistive divider, with a clamp diode to the 3.3v supply, is pretty safe.
Best Wishes |
|
|
Paolino
Joined: 19 Jan 2004 Posts: 42
|
|
Posted: Fri Jul 23, 2004 3:03 am |
|
|
We have a very similar situation and we solved it in a different way. It can be a little bit expansive than what has been suggested before.
The 24 V inputs reach optocouplers via a LED+DIODE+RESISTOR (in series) network, for each input. The resistor is there to reduce the current, to avoid the LED in the optocoupler to burn... It should be choosen with correct power dissipation factor (we put 500 mW resistor), in accordance with the other components you put. In the output stage of the optocouplers we have pull-up resistors. Do not forget that in general PICs pins can not source/sink more than 25 mA: if you follow my suggestion I think that 10 kohms pull-up resistors can be good.
Hope this help.
Best regards.
Paolo. |
|
|
Ttelmah Guest
|
|
Posted: Fri Jul 23, 2004 5:21 am |
|
|
Paolino wrote: | We have a very similar situation and we solved it in a different way. It can be a little bit expansive than what has been suggested before.
The 24 V inputs reach optocouplers via a LED+DIODE+RESISTOR (in series) network, for each input. The resistor is there to reduce the current, to avoid the LED in the optocoupler to burn... It should be choosen with correct power dissipation factor (we put 500 mW resistor), in accordance with the other components you put. In the output stage of the optocouplers we have pull-up resistors. Do not forget that in general PICs pins can not source/sink more than 25 mA: if you follow my suggestion I think that 10 kohms pull-up resistors can be good.
Hope this help.
Best regards.
Paolo. |
Yes.
Funnily enough, a lot of my circuitry has this type of approach. For example, you are connecting to 'industrial' 24v equipment, and need a 'general purpose' input, that may need to operate as an active low device with some sensors, and 'active high' with others. For these, I use optocouplers, with a suitable resistor in series, and have connectors with 0v, ip1, ip2, and 24v on them. Then for signals needing 'active low', you put a jumper between ip2, and 24v, and the input will operate when ip1 is pulled to ground, while for those needing 'active high', you short 0v to ip1, and the input will operate when ip2, is pulled up to 24v. In some cases where it is only necessary to sense 'power' being present, an AC rated opto is used instead, with a suitable sense resistor.
Optocoupling like this is very much the 'best' way to go, if the signals are from a harsh enviroment...
Best Wishes |
|
|
Einly
Joined: 10 Sep 2003 Posts: 60
|
Internal resistor? |
Posted: Fri Jul 23, 2004 5:57 am |
|
|
Dear all,
Just a bit confused why we need to use external 10k pull up resistor for each input. Because PIC16F876 comes with internal pull up resistor.
Anyway, Thanks... _________________ Einly |
|
|
rwyoung
Joined: 12 Nov 2003 Posts: 563 Location: Lawrence, KS USA
|
|
Posted: Fri Jul 23, 2004 8:13 am |
|
|
Many optocouplers are open-collector output so you need a pull-up resistor on the output transistor's collector.
However there are optocouplers with either built-in pull-ups or some with CMOS compatible output gates. Generally the ones with output gates are a bit faster and more expensive.
Browse around on the ON semiconductor web site and also Fairchild semiconductor's web site for optocoupler application notes. Google for "optocoupler application notes" and then you can spend the afternoon sorting through the 10 jillion hits it will give... _________________ Rob Young
The Screw-Up Fairy may just visit you but he has crashed on my couch for the last month! |
|
|
dyeatman
Joined: 06 Sep 2003 Posts: 1941 Location: Norman, OK
|
24V Connections to a PIC |
Posted: Fri Jul 23, 2004 9:35 am |
|
|
We have a lot of 24V signal equipment here and in all my designs I use the PS2501-4 Optocoupler with 4.7K in series with the input low side so I dont get signal inversion.
I use a 10Kx8 SIP resistor pack for pullups on the outputs of the PS2501 going to the PIC. This way I can use two PS2501-4s for an 8 bit input port.
I use the ULN2803 or ULN2804 for output drivers. |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|