• Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

comments about Tx/Rx in C simutaneouly

Status
Not open for further replies.

tuanvoi

New Member
Hi all,

I'm doing the project about Tx/Rx signalling. I have 2 PICs, these 2 PICs will use USART to transmit/receive the signal.

Each PIC will check the signal on PORTB pin0 (whether 5V or 0V in digital) and send this signal to the other PIC to inform that it is high or low. And the same procedure for the other PIC.

I want to write the code C that will transmit the condition of PORTB to one PIC and receive the condition at the other PIC sent at almost the same time (I know that it is impossible to do this, so one has to happen before the other. Because the time the PIC runs so quick that we feel like it is parallelly running).

Would you please give me some idea about the source code!

Thanks
 

Sceadwian

Banned
USART's are bidirectional, two way simultaneous transmitions are possible, as long as the USART is hardware. Search google or look at Nigel's tutorials athttp://www.winpicprog.co.uk/pic_tutorial.htm
There is an exaustive amount of code for doing serial transmision out there.
 

felis

New Member
If you have hardware USARTs you can use interrupts on receive. Something like that( C18 syntax ):

Code:
#pragma interruptlow lowPriorityISR
void lowPriorityISR(void)
{
/* USART handler start */
	if(PIR1bits.RCIF) 
		data = RCREG;           
}
'data' has to be declared as global volatile.
 
Status
Not open for further replies.

Latest threads

EE World Online Articles

Loading

 
Top