|
|
View previous topic :: View next topic |
Author |
Message |
jackhab
Joined: 03 Apr 2019 Posts: 6
|
GPIO bridge |
Posted: Tue Aug 25, 2020 11:54 am |
|
|
Hi,
What is the fastest way to bridge between two pins so that one pin outputs the value of other?
Currently I'm using:
#use fast_io(a)
output_bit(PIN_A1, input(PIN_A5));
Is there a better way?
Thanks. |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9243 Location: Greensville,Ontario
|
|
Posted: Tue Aug 25, 2020 1:59 pm |
|
|
Piece of wire ?
Hey, it's hot here....
Though really what's the purpose, unless the program has to control WHEN the output pin follows the input pin ?? |
|
|
jackhab
Joined: 03 Apr 2019 Posts: 6
|
|
Posted: Thu Aug 27, 2020 7:24 am |
|
|
temtronic wrote: | Piece of wire ?
Hey, it's hot here....
Though really what's the purpose, unless the program has to control WHEN the output pin follows the input pin ?? |
Piece of wire is exactly what I am trying to avoid to allow different hardware configurations and this is basically my question - how to "short-circuit" two PIC pins in software with best possible performance, where one pin is always input and the other is output. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19539
|
|
Posted: Thu Aug 27, 2020 7:37 am |
|
|
There is not a really good way.
Problem is any software solution, is only going to work, if the code is being
called. If the processor is off doing something else (delaying, or servicing
an interrupt), the code will stop working.
Even if you use an interrupt to make sure the signal is 'serviced', there
will be a long delay in the response.
Now, there are chips with hardware to do this. Chips with the CLC, allow you
to program 'logic' between specific pins. Consider switching to a chip with
this feature.
Also, if (for instance) the need is to be able to invert a signal, or feed it to
different locations, something like an external multiplexer chip could be
used with the PIC specifying the address to determine where the signal
goes, or an external XOR gate to allow the signal to be inverted. |
|
|
jackhab
Joined: 03 Apr 2019 Posts: 6
|
|
Posted: Thu Aug 27, 2020 9:36 am |
|
|
Ttelmah wrote: | There is not a really good way.
Problem is any software solution, is only going to work, if the code is being
called. If the processor is off doing something else (delaying, or servicing
an interrupt), the code will stop working. |
In my case this is not an issue as I'm building a special "bypass" SW version to make the PIC appear transparent. In order to keep the hardware backward compatible, we cannot bridge pins with wires.
I have no interrupts, and main() only has:
Code: |
while (1) {
output_bit(PIN_A1, input(PIN_A5));
output_bit(PIN_A0, input(PIN_C3));
output_bit(PIN_B5, input(PIN_C4));
output_bit(PIN_C5, input(PIN_B4));
} |
|
|
|
|
|
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
|