Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

dual communication option problem

Status
Not open for further replies.

smart_e

Newbie level 1
Joined
Jun 20, 2011
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,289
i am uses the two uart0 and uart1.
only one uart is active at a same time.
i implementing both uart in my application.
individually both are working fine.
but the next part is the optional part for communication so that if uart0 is active uart1 is disabled and viseversa.
and i want to use the same buffer for both.
the my concept is that there is a one function in which decision will take place either uart0 or uart1 will active.
then the uart0_tx buffer(),uart1_tx_buffer() function will be select is uart0 or uart1
but how to implement this in my code.
i am using C language.
so how to do this any guide.
 

if you have two hardware UARTs you initialise both and in your communications function have a variable which selects which UART to use, e.g.
Code:
int selectUART 0;   // global variable - if 0 use UART 0 else UART 1

void sendData(char data[])
{
  if(selectUART) uart1_tx buffer(data);
  else           uart0_tx buffer(data);
}
where selectUART will be set/cleared elsewhere
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top