CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

RS485 between two PIC problem!
Goto page Previous  1, 2, 3  Next
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
musti463



Joined: 19 Sep 2013
Posts: 66

View user's profile Send private message

PostPosted: Sun Aug 24, 2014 11:10 am     Reply with quote

thank you i fix it
_________________
M.Emir SADE
musti463



Joined: 19 Sep 2013
Posts: 66

View user's profile Send private message

PostPosted: Sun Aug 24, 2014 1:19 pm     Reply with quote

When i use following codes. System working corretly.

MASTER:

Code:
char data[9]="12345678";
 


SLAVE:

Code:
char data[12];
 


But !!! When i use following codes. System working but i see errors. I don't know Is there a limit for sending data length?

MASTER:

Code:
char data[64]="mustafaemirsade-mersin-463-1925-1905-galatasaray";
 


SLAVE:

Code:
char data[64];
 



You can see sorting is wrong. And data[10]-data[25] is empty. Why?

ERRORS:


_________________
M.Emir SADE
Ttelmah



Joined: 11 Mar 2010
Posts: 19186

View user's profile Send private message

PostPosted: Sun Aug 24, 2014 1:59 pm     Reply with quote

Look at my original reply.

Look at items 1, and 3.

Realise if these are _not_ done, the receiver, can/will receive garbage, or NULL characters (your \0), when the bus is not driven....
musti463



Joined: 19 Sep 2013
Posts: 66

View user's profile Send private message

PostPosted: Sun Aug 24, 2014 2:42 pm     Reply with quote

@Ttelmah

can you give me schematics and values?
_________________
M.Emir SADE
temtronic



Joined: 01 Jul 2010
Posts: 9073
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Sun Aug 24, 2014 3:26 pm     Reply with quote

sorting ???? I don't see anything in your code that 'sorts' !

Also as MR. T points out you MUST get the RS485 tranceivers properly configured.Consult the datasheet or Google, there are even BOOKS written about the subject !

If you ONLY have one master and one slave you do not need RS485, rather RS232( using a MAX232 chip) will work without any problems.Simple wire them up and you're done. If PICs are on the same bench ,ONE MAX232 will work for both PICs making the wiring even easier.


The other detail is. Is all done under Proteus/ISIS and not real hardware ???

That question needs to be answered fast.

hth
jay
musti463



Joined: 19 Sep 2013
Posts: 66

View user's profile Send private message

PostPosted: Sun Aug 24, 2014 5:19 pm     Reply with quote

Firstly proteus hardware and later real hardware
_________________
M.Emir SADE
temtronic



Joined: 01 Jul 2010
Posts: 9073
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Sun Aug 24, 2014 6:10 pm     Reply with quote

hmm.. Proteus.... Please acknowledge that it is FULL of bugs, errors and faulty DRCs. It is NOT reliable as a 'simulator'. In fact, EVERY 'schematic' presented here will NEVER work in the real world.

Please look at any RS485 transceiver datasheet and reconfigure your 'project' As others have said, your 'schematic' is not correct.

recode/recompile/retest/report back

jay
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sun Aug 24, 2014 6:39 pm     Reply with quote

Post your latest schematic so they can review it.
musti463



Joined: 19 Sep 2013
Posts: 66

View user's profile Send private message

PostPosted: Mon Aug 25, 2014 5:46 am     Reply with quote

I found only these schematics:







and my last shematic:



@temtronic i am learning RS485 communication now. i can't use rs232 because i will use 1 master 5 slave, when i learn rs485 communication tottally
_________________
M.Emir SADE


Last edited by musti463 on Mon Aug 25, 2014 8:06 am; edited 1 time in total
asmallri



Joined: 12 Aug 2004
Posts: 1630
Location: Perth, Australia

View user's profile Send private message Send e-mail Visit poster's website

PostPosted: Mon Aug 25, 2014 7:18 am     Reply with quote

Look at the figure 9 you posted. See that 'A' on the 485 of the transceiver goes to a pull-up resistor on the safe-bias configuration. Your schematic has A going to a pulled down instead.

However - be aware that some vendors label the inverting input as A and others label the non inverting input as A. They are electrically pin-for-pin compatible but use A and B nomenclature differently. You need to ensure the specific 485 transceiver you are using is the same as the one in the application note to ensure your A and the applications A both refer the the same input.
_________________
Regards, Andrew

http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!!
musti463



Joined: 19 Sep 2013
Posts: 66

View user's profile Send private message

PostPosted: Mon Aug 25, 2014 8:07 am     Reply with quote

asmallri wrote:
Look at the figure 9 you posted. See that 'A' on the 485 of the transceiver goes to a pull-up resistor on the safe-bias configuration. Your schematic has A going to a pulled down instead.

However - be aware that some vendors label the inverting input as A and others label the non inverting input as A. They are electrically pin-for-pin compatible but use A and B nomenclature differently. You need to ensure the specific 485 transceiver you are using is the same as the one in the application note to ensure your A and the applications A both refer the the same input.


i made a mistake i changed
_________________
M.Emir SADE
musti463



Joined: 19 Sep 2013
Posts: 66

View user's profile Send private message

PostPosted: Mon Aug 25, 2014 9:42 am     Reply with quote

Can we send directly float values? else we have to use sprintf for float to string and send data by rs485 ?
_________________
M.Emir SADE
Ttelmah



Joined: 11 Mar 2010
Posts: 19186

View user's profile Send private message

PostPosted: Mon Aug 25, 2014 10:59 am     Reply with quote

You can send the bytes that comprise float values, and then re-assemble these at the other end.
Easiest way is a union.

This is fine PIC-PIC, but will give difficulties PIC-PC, since the PIC internally stores the values in a different format to the PC. There are routines in the supplied examples that include the conversion (search for IEEE).
musti463



Joined: 19 Sep 2013
Posts: 66

View user's profile Send private message

PostPosted: Mon Aug 25, 2014 12:46 pm     Reply with quote

@Ttelmah can you give me some example codes about it
_________________
M.Emir SADE
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Aug 25, 2014 1:36 pm     Reply with quote

Use the forum's search page. Example:
http://www.ccsinfo.com/forum/viewtopic.php?t=42199
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page Previous  1, 2, 3  Next
Page 2 of 3

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group