CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

GPIO bridge

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
jackhab



Joined: 03 Apr 2019
Posts: 6

View user's profile Send private message

GPIO bridge
PostPosted: Tue Aug 25, 2020 11:54 am     Reply with quote

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: 9225
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Tue Aug 25, 2020 1:59 pm     Reply with quote

Piece of wire ? Confused
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

View user's profile Send private message

PostPosted: Thu Aug 27, 2020 7:24 am     Reply with quote

temtronic wrote:
Piece of wire ? Confused
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: 19506

View user's profile Send private message

PostPosted: Thu Aug 27, 2020 7:37 am     Reply with quote

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

View user's profile Send private message

PostPosted: Thu Aug 27, 2020 9:36 am     Reply with quote

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));
    }
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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