View previous topic :: View next topic |
Author |
Message |
Jakin Guest
|
Hi anyone has a sample code |
Posted: Tue Aug 15, 2006 6:52 pm |
|
|
Hi, All:
Do you have a sample code for RS485 Master and slave ?
Could you please post it if you have one ? Thank you very much ~!
Regards,
Jakin |
|
|
kender
Joined: 09 Aug 2004 Posts: 768 Location: Silicon Valley
|
MODBUS |
Posted: Tue Aug 15, 2006 7:05 pm |
|
|
Look for MODBUS protocol in this forum. MODBUS is a higher level protocol designed to operate on the RS485 physical layer. The MODBUS spec is free.
For example:
http://www.ccsinfo.com/forum/viewtopic.php?t=18412 |
|
|
Jakin Guest
|
ModBUS |
Posted: Wed Aug 16, 2006 2:54 pm |
|
|
Hi,All:
what does ModBus stands for ? I am new on this type of term. Please give some information. Thank you very much
Regards,
Jakin |
|
|
rwyoung
Joined: 12 Nov 2003 Posts: 563 Location: Lawrence, KS USA
|
|
Posted: Wed Aug 16, 2006 3:06 pm |
|
|
There is code for 9-bit RS485 type transmissions in the examples or driver directory of a full compiler install. May not be there for the student edition.
http://www.modbus.org/, Google is your friend... _________________ Rob Young
The Screw-Up Fairy may just visit you but he has crashed on my couch for the last month! |
|
|
kender
Joined: 09 Aug 2004 Posts: 768 Location: Silicon Valley
|
Re: ModBUS |
Posted: Wed Aug 16, 2006 3:34 pm |
|
|
Jakin wrote: | what does ModBus stands for ? I am new on this type of term. Please give some information. Thank you very much |
You can find a brief description of Modbus and a bunch of related links here
http://en.wikipedia.org/wiki/Modbus |
|
|
Jakin Guest
|
|
Posted: Wed Aug 16, 2006 4:05 pm |
|
|
Well, I do not know that I am using ModBus or not. I do know I will use MPLab to be my complier. So do you know where I can find any sample code for RS485? Thank you very much.
Thanks again,
Jakin |
|
|
ckielstra
Joined: 18 Mar 2004 Posts: 3680 Location: The Netherlands
|
|
Posted: Wed Aug 16, 2006 6:14 pm |
|
|
Jakin wrote: | I do know I will use MPLab to be my complier. | MPLAB is not a compiler but what's called an Integrated Development Environment (IDE). Here you edit and debug your code, it also calls an compiler but as an external application. You can integrate the CCS compiler in MPLAB, but also other compilers like Microchip C18, IAR or Bytecraft are possible compilers.
When you are asking for an example it matters which compiler you are using. C is a standardized language but for the small embedded processors like the PIC is the compiler vendors have added some library functions to access the hardware that are not standardized. Porting code from one compiler to the other is sometimes more difficult than starting from scratch.
Why are you insisting on using RS485? It is only a standard for hardware interconnection and you can run any protocol on it you like. You were given the MODBUS example code, tell us why it isn't good for you so we know what direction to point you. Is it too complex? Do you have multiple devices connected to your RS485 or is it just point-to-point connection? |
|
|
Jakin Guest
|
|
Posted: Thu Aug 17, 2006 1:26 pm |
|
|
Hi,All:
The problem is how to use RS 485 to be multi-masters and slaves connection. In order to get my job done, I just do not know how I should use rabbit BL2500 to communicate with PIC16F648A. I know that I need to develop a C programming to drive the Masters and slaves. But what else I need to consider. |
|
|
Jakin Guest
|
|
Posted: Thu Aug 17, 2006 3:46 pm |
|
|
Hi, All;
Does anyone know that PIC can support RS 485 ? I did not see any Library which is used for RS485. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Thu Aug 17, 2006 4:16 pm |
|
|
Bookmark the following page. It shows a list of all examples, drivers,
and ".H" files for CCS. Look at this page if you have questions about
what files CCS provides. Do a search of this page for "RS485":
http://www.ccsinfo.com/devices.php?page=exlist
In addition to that, use http://www.google.com
Bookmark Google. Make it your home page. Do a search on Google
for these keywords: PIC RS485
You will got lots of hits. |
|
|
kender
Joined: 09 Aug 2004 Posts: 768 Location: Silicon Valley
|
|
Posted: Thu Aug 17, 2006 4:27 pm |
|
|
Jakin wrote: | Does anyone know that PIC can support RS 485 ? |
Please correct me if I'm wrong, but none of the PICs directly support RS 485. RS485 is connected to the PIC's uart through an interface chip such as MAX485
There are PICs with hardware support for CAN. If you are designing a system from scratch (as opposed to interfacing to an existing RS485 bus), consider CAN. |
|
|
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
|
Posted: Thu Aug 17, 2006 5:01 pm |
|
|
Jakin wrote: | Hi,All:
The problem is how to use RS 485 to be multi-masters and slaves connection. In order to get my job done, I just do not know how I should use rabbit BL2500 to communicate with PIC16F648A. I know that I need to develop a C programming to drive the Masters and slaves. But what else I need to consider. |
Are you to do the BL2500 code as well, or is it already done? If it is done, then you must get the protocol for the other device. RS485 is not a protocol and there are an infinite number of ways to communicate using RS485. |
|
|
jakin
Joined: 17 Aug 2006 Posts: 6
|
|
Posted: Fri Aug 18, 2006 3:59 pm |
|
|
Hi, Mark
I just want to know how to develop the C code . Do you have any sample code. If you do, please post it. Thank you so much |
|
|
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
|
Posted: Fri Aug 18, 2006 9:11 pm |
|
|
I suggest that you get yourself some C manuals and books on programming micros and start reading. |
|
|
|