The Godfather talking
You think I am funny guy huh?
Sonsivri
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
April 16, 2024, 06:37:59 18:37


Login with username, password and session length


Pages: 1 2 [All]
Print
Author Topic: What kind of protocol do you prefer?  (Read 8136 times)
0 Members and 1 Guest are viewing this topic.
luca_l
Guest
« on: December 13, 2007, 08:51:28 20:51 »

 Undecided I’m looking for a communication protocol between 2 or more pic, expect can bus,  Undecided
What protocol do you use? And why?
Logged
Trump
Guest
« Reply #1 on: December 14, 2007, 10:16:12 22:16 »

Hi, I use the ModBus protocol from Modicon... The CCS compiler have a driver for this protocol and you find the details here: http://www.eecs.umich.edu/~modbus/documents/PI_MBUS_300.pdf
Logged
LuoPan19770708
Junior Member
**
Offline Offline

Posts: 81

Thank You
-Given: 20
-Receive: 11


« Reply #2 on: December 15, 2007, 12:15:16 00:15 »

Mr. Trump, Can you upload some examples?
Logged
Trump
Guest
« Reply #3 on: December 17, 2007, 10:41:10 22:41 »

Mr. Trump, Can you upload some examples?
Hm... The link above have all the info... The data frames are very simple and the CRC is in the end of the paper, in C... With the CCS driver (use the project Wizard) the work is only asign the variables and pins for the Input Registers, coils, Holding Registers and Input status... I have the master anda the slave software for protocol tests and Monday I upload both...

Posted on: December 15, 2007, 08:39:33 20:39 - Automerged

Hm... Here is the link: http://rapidshare.com/files/77291978/Modbus.rar.html

The Modscan and Modsim software (master and slave). with the paper and this 2 softwares you have all the tools for start the work... Run the softwares in a PC with 2 serial ports, plug a serial cable and see all the packages in the Modscan...
Logged
luca_l
Guest
« Reply #4 on: December 19, 2007, 02:02:32 14:02 »

many thanks for the link,  I have done the question but I'm not able to see answer   Huh because
in place of the suggestion; as Inactive   Sad  I read: 'You are not allowed to view links' 

 Cry can you  help me?

regards

 luca_l
« Last Edit: December 23, 2007, 02:03:09 14:03 by luca_l » Logged
phu_thanh
Guest
« Reply #5 on: December 20, 2007, 12:37:41 12:37 »

If you want to communicate among Pic or other microcontroller. Then I should suggest you to use CAN bus protocols. which is multi-nodes commucation and require only  3 wires (Line+,Line- and Common). This protocol is very flexible in which it can transfer data at a very fast rate and immune to noisy environment. The errors checking is done in the hardware itself so there is not need to write codes for it.
Logged
luca_l
Guest
« Reply #6 on: December 20, 2007, 03:37:40 15:37 »

about CAN bus protocols is interesting,  I am studying it, but reading on:


http://en.wikipedia.org/wiki/Controller_Area_Network

'Bit rates up to 1 Mbit/s are possible at network lengths below 40 m.
 Decreasing the bit rate allows
longer network distances (e.g. 125 kbit/s at 500 m).'
     Cry

it would serve me an easy protocol that transmits on greater lengthes.

thanks

Luca
Logged
kcid
Guest
« Reply #7 on: December 20, 2007, 09:42:57 21:42 »

I recommend you use Can with CCS compiler its very easy to work in any project.
Logged
vmax
Newbie
*
Offline Offline

Posts: 11

Thank You
-Given: 7
-Receive: 0


« Reply #8 on: December 21, 2007, 01:29:14 01:29 »

Luca_l

The first thing that you need to have in mind, before you choose the communication protocol that you will use is define what are you intending to do.

Sometimes, the USART fits all your needs

Keep in mind that CAN, as well as LIN, were developed to automotive use, in a poluted (in terms of noise) environment.

Anyway, you have 1-wire protocol, I2C, USART, SPI, PSP among others.

Again, the better wolution will depend on what are your needs.

Success!
Logged
Trump
Guest
« Reply #9 on: December 21, 2007, 02:40:27 02:40 »

about CAN bus protocols is interesting,  I am studying it, but reading on:
    Cry

it would serve me an easy protocol that transmits on greater lengthes.

thanks

Luca

For greater lenghts use the RS485 (1.5 Km on twisted pair 120 Ohm balanced). I use RS485 with up to 30 Freescale microcontollers (9S12) whith high noise environment at 57.6K with Modbus protocol. For the RS485 I use the MAX3483 (250Kbps max.), but in the MAX3486 the baud rate is 2.5Mbps.
Logged
luca_l
Guest
« Reply #10 on: December 21, 2007, 07:52:14 19:52 »

First of all many Thanks to all, for the answers!

Quote
   Anyway, you have 1-wire protocol, I2C, USART, SPI, PSP among others.

I will go to read the documentation with ccs for these protocols.


But currently the more interesting thing is:

Modbus protocol

managing 255 devices it is enough for me

The hardware using the MAX3486 is easy, but

 understanding some example code on ccsinfo.com is different matter.

 thanks sincerely
Logged
Connection
Guest
« Reply #11 on: December 22, 2007, 05:33:13 05:33 »

I am using SPI and I2C protocol.
Logged
luca_l
Guest
« Reply #12 on: December 22, 2007, 12:21:59 12:21 »

I recommend you use Can with CCS compiler its very easy to work in any project.

 Huh Which PIC do you Use? 18F458 or the better 18F4580,
or what do you suggest?  Huh
Logged
ucanturk
Newbie
*
Offline Offline

Posts: 15

Thank You
-Given: 17
-Receive: 6


« Reply #13 on: December 22, 2007, 01:24:38 13:24 »

I suggest Modbus protocol because this is an open source protocol, for more information about protocol details please visit www.modicon.com/techpubs/toc7.html
Logged
luca_l
Guest
« Reply #14 on: December 22, 2007, 05:47:15 17:47 »

if I understood  Undecided

I can  use the  MODBUS driver on  USART of my Pic but
   Huh  there is a specific library in css for that?  Huh
« Last Edit: December 23, 2007, 02:06:44 14:06 by luca_l » Logged
Trump
Guest
« Reply #15 on: December 22, 2007, 10:35:26 22:35 »

if I have understanded correct   Undecided

I can  use the  MODBUS driver on  USART of my Pic but
   Huh  there is a specific library in css for that?  Huh
Yes... The CCS Compiler have a full driver for ModBus. You have only to use the Project Wizard in CCS. Select "Use Modbus Protocol" and define the pins of the serial, Buffer size, Master or slave, Address, etc... And CCS build all the code.
Logged
luca_l
Guest
« Reply #16 on: December 23, 2007, 02:33:06 14:33 »

 Smiley   Perhaps ...  Smiley   close to 2008 is the time to change my actual ccs version (  Cry 3.2)

thanks and

MERRY CHRISTMAS
Logged
siwat2
Guest
« Reply #17 on: December 25, 2007, 03:10:34 15:10 »

I used SPI to communication with 8 dsPIC30f2010. It's work great(If u don't set baud rate too much).
Logged
micropar
Active Member
***
Offline Offline

Posts: 173

Thank You
-Given: 44
-Receive: 13


« Reply #18 on: December 27, 2007, 07:12:26 19:12 »

Hi all,

If you want to use CAN bus, I suppose it would be better if you use CANopen library of higher application layer than lower CAN plain messages type.

Does any one know good library routines of CANopen on PICmicro?
or CANopen development on PC side which we can latter on port it to PIC?

If not, where can we get good CANopen documents so that we may develop it ourselves?

Thanks in advance,

Regards,
--micropar--
Logged
narc60
Newbie
*
Offline Offline

Posts: 17

Thank You
-Given: 12
-Receive: 1


« Reply #19 on: December 28, 2007, 06:50:30 06:50 »

luca_l,

Any luck on the Modbus protocol using CCS? I was reading something in the CCS forum and I think it requires a Modbus.c file that can only be downloaded by sending a formal request to CCS.
Logged
luca_l
Guest
« Reply #20 on: December 28, 2007, 03:26:08 15:26 »

Quote
Any luck on the Modbus protocol using CCS

  Huh but Modbus.c is not integrated with a CCS recent version ? Huh

‎I am only at the beginning with ccs but if you use the Project Wizard it writes:

Code:
#define MODBUS_BUS SERIAL
#define MODBUS_TYPE MASTER
#include "modbus.c"

in the circumstances
I hope my ccs compile correctly!!   Embarrassed


regards

Luca


P.S.

if you  like, I send you the  modbus.c code from my CCS version.
« Last Edit: December 28, 2007, 03:49:37 15:49 by luca_l » Logged
graywolf
Newbie
*
Offline Offline

Posts: 13

Thank You
-Given: 0
-Receive: 19


« Reply #21 on: December 29, 2007, 03:15:52 03:15 »

I prefer rs485, you can create your own packet protocal but you can use twiested wire nad go very far distance and it is very cheap. We used it on 100 pics at once. It all depends on your header to access 255 or 64K pics and useht first 2 as address.
Logged
luca_l
Guest
« Reply #22 on: December 29, 2007, 03:58:35 15:58 »

dear  Graywolf

creating a personal protocol is one of the first things  comes in my mind!  Grin
the doubt is correct to invent the wheel again?  Embarrassed
for this reason I  began this Topic...

can you explain the reason of your choice?

cheers
Luca
« Last Edit: December 30, 2007, 07:58:57 19:58 by luca_l » Logged
arvind
Guest
« Reply #23 on: December 30, 2007, 04:02:15 16:02 »

CAN bus is wat we found to be easy...particularly because of very good documentation...
Logged
graywolf
Newbie
*
Offline Offline

Posts: 13

Thank You
-Given: 0
-Receive: 19


« Reply #24 on: December 30, 2007, 08:02:53 20:02 »

Hi luca_l

When you are looking at cost factor, pics have onboard uarts so you dont need a can controller, all you need is the rs485 voltage converter. Then you datapacket is what you design and keep it simple. As you know with rs485 you have 9 bits of data and not 8 with uart. So I designed my packet header very simple. I am using less than 255 devices so the first byte is the chip id. Here is my packet design

1. address
3. command
4. flags
5+6. data size
7. header crc
8..... data to follow
?..... data crc

So the first byte is address to talk to the device, then the next byte is the command for exmaple read AD etc.. The 3rd byte is any flags you want to send to the device. The next 3 bytes holds the size of data to receive or send. Then have a crc for the header only. The data bytes are sent and a crc for the data.

Graywolf/
Logged
luca_l
Guest
« Reply #25 on: December 31, 2007, 05:04:32 17:04 »

I ' m looking for a 'Tutorial by Example'  for Modbus!

  Roll Eyes or any suggestion are  welcomeRoll Eyes

Many Thanks in advance  Cry

Luca
Logged
lrom
Guest
« Reply #26 on: December 31, 2007, 07:10:25 19:10 »

Hi, I use I2C prtocol.Its fast and requires only 2 pins, and in future you can connect more devices.Configure one pic in master mode and other one in slave mode.

Most PIC's has it as a hardware peripherial.
Logged
narc60
Newbie
*
Offline Offline

Posts: 17

Thank You
-Given: 12
-Receive: 1


« Reply #27 on: January 04, 2008, 05:15:28 17:15 »

luca_l,

After reading your post, I looked in the C:\Program Files\PICC\Drivers folder and Modbus.c is indeed included. I should have tried to write a program first. I was trying to gather as much info as possible as I have a project in mind that's why I was searching the CCS forum. Thanks for sharing the info.
Logged
luca_l
Guest
« Reply #28 on: January 04, 2008, 08:59:41 20:59 »

            Dear  Narc60

We are going to  the    same direction, Shocked
if you like we can  share our first steps on modbus worldCheesy
 
cheer
Luca
Logged
tenir
Newbie
*
Offline Offline

Posts: 8

Thank You
-Given: 1
-Receive: 0


« Reply #29 on: January 06, 2008, 12:07:55 12:07 »

I use cab bus. its works perfect in noisy environment. it also works good with ccs can driver
Logged
xirix
Newbie
*
Offline Offline

Posts: 15

Thank You
-Given: 0
-Receive: 1


« Reply #30 on: January 16, 2008, 09:05:09 09:05 »

Can you suggest a serial bus with followings:
 - master + n slaves
 - large nr. of slaves (~128)
 - master to slaves up to 100-200m
 - power over net (slaves powered by bus; aprox 1mA/slave)
 - small speed (10-50kbps)
 - error checking for noisy environment
 - easy debug in case of failure

Thanks
Logged
vsmGuy
Junior Member
**
Offline Offline

Posts: 35

Thank You
-Given: 11
-Receive: 7


« Reply #31 on: January 27, 2008, 10:21:39 10:21 »

What about SMBus ?
Logged
xirix
Newbie
*
Offline Offline

Posts: 15

Thank You
-Given: 0
-Receive: 1


« Reply #32 on: January 28, 2008, 06:22:09 06:22 »

SMBus is slow speed serial bus derived from i2c. I don't think is usefull for long distances.
Logged
crastoverkill
Guest
« Reply #33 on: January 28, 2008, 12:05:39 12:05 »

Hello, i've coded an PID temperature controller, with some codes i've learned on books, and i've some dificulties to tunning it. system error becomes greater more and more. has one technik in especial for tuning PID for temperature controls? (sorry by my poor english)
Logged
dreamwithin
Guest
« Reply #34 on: February 05, 2008, 02:58:25 02:58 »

I use rs232 for short distance, it is simple but not reliable, I still prefer CAN bus. If you use CCS C ,CAN will be the best and simple way to do communications.
Logged
lillbear
Senior Member
****
Offline Offline

Posts: 276

Thank You
-Given: 223
-Receive: 182



« Reply #35 on: February 05, 2008, 04:26:03 04:26 »

Hi check S.N.A.P - Scaleable Node Address Protocol -> http://www.hth.com/snap/

S.N.A.P is an free and open network protocol. The protocol was primary developed for PLM-24 based
home automation and control systems but it is a generic protocol and not limited to this. S.N.A.P can be
used in any type of applications where an easy to learn and light weighted network protocol is needed.
Features.
   
   - Easy to learn, use and implement.
   - Free and open network protocol.
   - Free development tools available.
   - Scaleable binary protocol with small overhead.
   - Requires minimal MCU resources to implement.
   - Up to 16.7 million node addresses.
   - Up to 24 protocol specific flags.
   - Optional ACK/NAK request.
   - Optional command mode.
   - 8 different error detecting methods (Checksum, CRC, FEC etc.).
   - Can be used in master/slave and/or peer-to-peer.
   - Supports broadcast messages.
   - Media independent (power line, RF, TP, IR etc.).
   - Works with simplex, half-, full- duplex links.
   - Header is scaleable from 3-12 bytes.
   - User specified number of preamble bytes (0-n).
   - Works with synchronous and asynchronous communication.
   - Works with our free PLM-24 < > TCP/IP Gateway software.

yours
Logged
alichan
Junior Member
**
Offline Offline

Posts: 94

Thank You
-Given: 28
-Receive: 88


« Reply #36 on: February 06, 2008, 09:17:08 21:17 »

You should take in consideration:

Max speed required.
Ammount of data to be transmited
Max length of wires (distance between MCUs)

These are the main issues to be taken in consideration, of course there're others.
Just can use custom protocols, parallel communication (ppl), rs232, rs482, spi, i2c, field protocols (modbus, iec)... tcp/ip  (why not? it only depends on your needs).

Hard question to be answered with so less information.

Always try the simpliest protocol that solves your needs.
Logged
Pages: 1 2 [All]
Print
Jump to:  


DISCLAIMER
WE DONT HOST ANY ILLEGAL FILES ON THE SERVER
USE CONTACT US TO REPORT ILLEGAL FILES
ADMINISTRATORS CANNOT BE HELD RESPONSIBLE FOR USERS POSTS AND LINKS

... Copyright © 2003-2999 Sonsivri.to ...
Powered by SMF 1.1.18 | SMF © 2006-2009, Simple Machines LLC | HarzeM Dilber MC