Good day all,
I am trying to make 2 pic's talk using the usart. I used two easypic board to make the test. The TX and RX line of the first pic are wired to the RX and TX lines of the second by a twisted pair of about 30cm. The first pic talks, the second listen. The problem is that the second listen... nothing ! If I use the serial communicator to check each pic, there is no problem. The first one send once per second a "Hello word", and if I send an "Hello word" with the serial communicator to the second one, it is received without difficulty. But when connected together, nothing!
So I guess that perhaps wiring two pic is not so simple than crossing their TX-RX pins.
Can somebody point me in the right direction?
By advance thanks,
Robert
Wiring two pics together
Moderators: David Barker, Jerry Messina
Serial communications can be tricky to get right, do not make any assumptions that things are correct, it will always find a way to fail!!!
First silly question, do you also have the ground connected?
Obviously there needs to be a return, as you did not mention this I thought I would!
Second post the code, it may be a very simple reason in the code.
I do communicate very often between PICs and PC so its not too hard, it needs to be perfect every time or it will fail.
Timing, timing, timing is the watch word!
First silly question, do you also have the ground connected?
Obviously there needs to be a return, as you did not mention this I thought I would!
Second post the code, it may be a very simple reason in the code.
I do communicate very often between PICs and PC so its not too hard, it needs to be perfect every time or it will fail.
Timing, timing, timing is the watch word!
Hi Doj,
thanks for your answer...
Your question about the ground is not so silly... In fact it was one of the first thing wich came to my mind... but unfortunatly, they are grounded together...
Here is the code for the "listener" :
and the code of the sender:
As I said previously, each one works when used with the serial communicator, but no more when wired directly...
Regards,
Robert
PS: Standard Pic's (18F452 - 20Mhz)
thanks for your answer...
Your question about the ground is not so silly... In fact it was one of the first thing wich came to my mind... but unfortunatly, they are grounded together...
Here is the code for the "listener" :
Code: Select all
#option LCD_DATA = PORTB.0
#option LCD_RS = PORTB.4
#option LCD_EN = PORTB.5
Include "Lcd.bas"
Include "usart.bas"
Dim chaine As String(10)
SetBaudrate(br19200)
Cls
WriteAt(1,1, "Ready")
While 1=1
If USART.DataAvailable Then
USART.Read(chaine)
WriteAt(2,1, chaine)
EndIf
Wend
Code: Select all
Include "usart.bas"
SetBaudrate(br19200)
While 1 = 1
USART.Write("Hello World") // string
DelayMS(1000)
Wend
Regards,
Robert
PS: Standard Pic's (18F452 - 20Mhz)