Page 1 of 1
RS232 to RS485
Posted: Fri Aug 12, 2011 12:27 pm
by jollybv
Hi Guys
I need to use RS485 to communicate between to PIC's (PIC16f887 & PIC16f886) as I'm new to all this I was wondering has anyone got a diagram and some sample cod to help me get started as i really don't have a clue where to start
Brian

Re: RS232 to RS485
Posted: Fri Aug 12, 2011 12:59 pm
by Benj
Re: RS232 to RS485
Posted: Sat Aug 13, 2011 10:16 am
by jollybv
Thanks Ben i will have a look

Re: RS232 to RS485
Posted: Tue Sep 25, 2012 11:05 pm
by jollybv
Hi Guys
I'm really confused I am trying to send data Via RS485 but no luck I downloaded the examples and have written a small test program to see how it works but i cannot get it to work could you please have a look and tell me where I'm going wrong. I only need to send data from the master to the slave. what I really don't understand it the slave node (Node address 9th bit) and how you get it. You send 0x 101 from the master node and receive it in the slave node (RxVal AND 100) the result is 100 should this not be a 1 for the decision to be made
Re: RS232 to RS485
Posted: Wed Sep 26, 2012 9:49 am
by Benj
Hello Jolly,
In both your programs you had the RS232 component set to 8bit data mode. I have changed this in both the programs so hopefully the origram should work correctly on your hardware now. Let me know how you get on.
Re: RS232 to RS485
Posted: Wed Sep 26, 2012 1:20 pm
by jollybv
Hi Benj
Thanks for the reply I did notice that they were set to 8 bit mode and did change them to 9 bit but still doing the same in the simulation when I send a 0x101 (100000001) then data (123) from the master node, on the slave i get *123 but it just sits in a loop and dose nothing what am I doing wrong. I amuse that the * char is the 0x101(RxVal) and should be AND with 0x100 and the result must be a 1 so that the decision icon is yes but when i AND the 101 with 100 the answer is 100 not 1. Please help this is driving me mad
Brian
Re: RS232 to RS485
Posted: Wed Sep 26, 2012 5:05 pm
by Benj
Hi Brian,
You can use this in a decision icon to see if the most significant bit is set.
rxval & 0x100
If you need the result to be 1 then you need to do this.
(rxval & 0x100) >> 8
Re: RS232 to RS485
Posted: Thu Sep 27, 2012 6:38 pm
by jollybv
Hi Benj
Thanks I will try it..!! I just want to ask if I upgrade to V5 will the RS484 sort my problem out of not understanding how to send data..??
Brian
Re: RS232 to RS485
Posted: Fri Sep 28, 2012 3:33 pm
by jollybv
Hey Guys
I need help I am so lost with this RS232/485 My boards are working with the RS232 but when I connect the Max485 chip onto it it dose not work i have connected pins 2 & 3 together and to RB7 then pins 1 & 4 go to the Rx & TX of the chip i then pull RB7 high in the software and send the same string that i was sending when it was connected as RS232. On the receiving side I connect RC5 to Pins 2 & 3 and this is pulled low. I have set up some LED's to flash when it goes into the various macros I am getting some sort of data sent but it is not always right. What I don't understand is that it is working right in the simulation but not on the boards.
I can honestly say i have no idea how this RS485 is supposed to work
Please can someone help me as I have potential orders for my product but now this software problem is holding me back
I have noticed one thing I can send the the first and second string then i get a Char 255 a Y with 2 dots on top and then nothing works. I might need to clear something but i do not know what.