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
RS232 to RS485
Moderator: Benj
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: RS232 to RS485
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
- jollybv
- Flowcode v5 User
- Posts: 374
- Joined: Thu Feb 12, 2009 5:20 am
- Location: Cape Town
- Has thanked: 81 times
- Been thanked: 25 times
- Contact:
Re: RS232 to RS485
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
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
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: RS232 to RS485
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.
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.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
- jollybv
- Flowcode v5 User
- Posts: 374
- Joined: Thu Feb 12, 2009 5:20 am
- Location: Cape Town
- Has thanked: 81 times
- Been thanked: 25 times
- Contact:
Re: RS232 to RS485
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
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
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: RS232 to RS485
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
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
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
- jollybv
- Flowcode v5 User
- Posts: 374
- Joined: Thu Feb 12, 2009 5:20 am
- Location: Cape Town
- Has thanked: 81 times
- Been thanked: 25 times
- Contact:
Re: RS232 to RS485
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
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
- jollybv
- Flowcode v5 User
- Posts: 374
- Joined: Thu Feb 12, 2009 5:20 am
- Location: Cape Town
- Has thanked: 81 times
- Been thanked: 25 times
- Contact:
Re: RS232 to RS485
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.
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.