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 CCS Technical Support

Hi anyone has a sample code

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Jakin
Guest







Hi anyone has a sample code
PostPosted: Tue Aug 15, 2006 6:52 pm     Reply with quote

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

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

MODBUS
PostPosted: Tue Aug 15, 2006 7:05 pm     Reply with quote

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
PostPosted: Wed Aug 16, 2006 2:54 pm     Reply with quote

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

View user's profile Send private message Send e-mail

PostPosted: Wed Aug 16, 2006 3:06 pm     Reply with quote

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

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

Re: ModBUS
PostPosted: Wed Aug 16, 2006 3:34 pm     Reply with quote

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







PostPosted: Wed Aug 16, 2006 4:05 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Wed Aug 16, 2006 6:14 pm     Reply with quote

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







PostPosted: Thu Aug 17, 2006 1:26 pm     Reply with quote

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







PostPosted: Thu Aug 17, 2006 3:46 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Thu Aug 17, 2006 4:16 pm     Reply with quote

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

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

PostPosted: Thu Aug 17, 2006 4:27 pm     Reply with quote

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

View user's profile Send private message Send e-mail

PostPosted: Thu Aug 17, 2006 5:01 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Fri Aug 18, 2006 3:59 pm     Reply with quote

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

View user's profile Send private message Send e-mail

PostPosted: Fri Aug 18, 2006 9:11 pm     Reply with quote

I suggest that you get yourself some C manuals and books on programming micros and start reading.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
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