Sonsivri
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
December 21, 2024, 04:54:00 16:54


Login with username, password and session length


Pages: [1]
Print
Author Topic: Little PIC Modbus project + code  (Read 4528 times)
0 Members and 1 Guest are viewing this topic.
Ljmnunes
Newbie
*
Offline Offline

Posts: 16

Thank You
-Given: 64
-Receive: 54


WWW
« on: November 11, 2020, 02:39:25 02:39 »

Hello!

First I wanted to clarify: When I registered for the forum, I wanted to share my knowledge by sharing my projects that I worked on for many years, but my boss warned me not to do this for legal reasons. He showed me the company rules and how I will be stuck with them for a few more years. Today I am retired, but still trapped by those rules. (I hope you understand me despite my poor English)

But I found my first project that I thought was lost and as this project has nothing to do with the company I worked for. So, I'm pleased to share it.

This is my first electronic project with PIC that I did many years ago to learn the C language. I know it's a very basic code, but I hope it helps someone to understand or get started with the Modbus protocol. It was written in C for PIC with the CCS compiler, but can be ported to another microcontroller easily.

Inside the zip file there are a schematic file for P-CAD 2006 and a pdf too. Sorry, there is no pcb file for the project because it is corrupted, But you see it is very simple.

Thanks!
Logged

pickit2
Moderator
Hero Member
*****
Online Online

Posts: 4671

Thank You
-Given: 835
-Receive: 4330


There is no evidence that I muted SoNsIvRi


« Reply #1 on: November 12, 2020, 09:32:51 09:32 »

May I say first 'you joined a forum, we don't want anything that you can't share' yes we sometimes bypass payment for software.
But that is not the idea behind a forum, the main rule is you must be active, it dont mean you must be active share stolen software.
you most like you joined to ask questions, or inteact with people having problems, with projects, or help with your projects.

there are some members who have been members (loose term as some think it's ok to spend 10, 15 years in a forum with zero postings)


Logged

Note: I stoped Muteing bad members OK I now put thier account in sleep mode
Ljmnunes
Newbie
*
Offline Offline

Posts: 16

Thank You
-Given: 64
-Receive: 54


WWW
« Reply #2 on: November 13, 2020, 01:02:56 01:02 »


pickit2,

I keep looking for an opportunity to help someone. But I don't spend a lot of time reading on the forum.

On a large forum like this, with many active users, I think it will take me a long time to be a useful member.

Thanks!
Logged

sphinx
Hero Member
*****
Offline Offline

Posts: 920

Thank You
-Given: 614
-Receive: 271



« Reply #3 on: November 13, 2020, 04:24:03 04:24 »

Hi.

Could you add some info/documentation for the project and how to use it, and what is intended use is for.

regards.
Logged

laws of physics are not laws at all, just assumptions and formulas that work as long as we don't figure something new that wrecks the calculations. the infinite onion try to peel that one
Fab66
Newbie
*
Offline Offline

Posts: 10

Thank You
-Given: 127
-Receive: 5


« Reply #4 on: November 13, 2020, 02:14:22 14:14 »

pickit2,

I keep looking for an opportunity to help someone. But I don't spend a lot of time reading on the forum.

On a large forum like this, with many active users, I think it will take me a long time to be a useful member.

Thanks!

You are very modest Smiley honnestly in my experience, every sharing can be usefull for some of us.
Anyway thank for you initiative.
Logged
metal
Global Moderator
Hero Member
*****
Offline Offline

Posts: 2420

Thank You
-Given: 862
-Receive: 678


Top Topic Starter


« Reply #5 on: November 13, 2020, 03:04:19 15:04 »

The code is well designed, thank you.
Logged
sadman
Hero Member
*****
Offline Offline

Posts: 710

Thank You
-Given: 1839
-Receive: 2907


Sow The Seeds of Love


« Reply #6 on: November 13, 2020, 03:21:31 15:21 »

It is great project and nice sharing Modbus is two wire communication protocol for industry and PLC control, it is a protocol that control multiple hardware like this on same line and you can monitor them from PC and every hardware have unique ID to identify them.

Sadman
« Last Edit: November 15, 2020, 08:15:25 08:15 by sadman » Logged
Gallymimu
Hero Member
*****
Offline Offline

Posts: 704

Thank You
-Given: 152
-Receive: 214


« Reply #7 on: November 14, 2020, 03:47:39 15:47 »

Thanks for this.  I'm a huge fan of MODBUS for multidevice communication.  It is so trim and simple (especially if you only implement multiword read/write functions).

We often talk customers out of using CAN, Ethernet/IP and other protocols that are pretty heavy from a microcontroller standpoint.
Logged
Ljmnunes
Newbie
*
Offline Offline

Posts: 16

Thank You
-Given: 64
-Receive: 54


WWW
« Reply #8 on: November 14, 2020, 04:44:59 16:44 »

Hi.

Could you add some info/documentation for the project and how to use it, and what is intended use is for.

regards.

documentation but this I give.

If you are interessed, I can explain it better later. Do you know about Modbus?

This project is resumed below:
It is a simple remote I/O with 5 digital inputs and 5 digital outputs.
The inputs are transfered to Modbus in the input status register.
The Modbus protocol can read the outputs (coils) and force its values too.
The slave address is changed in the first Hold Register - Address default == 0xFF

The implemented functions and it limits are:
Function 1 Read Coil Status - 5 outputs
Function 2 Read Input Status - 5 inputs
Function 3 Read Holding Register - 1 HR -> Slave address
Function 5 Force single coil - 5 coils
Function 6 Preset Single Register - 1 HR -> slave address

There is no error checking like functiona address, data size. there are only function exist checking.


Anyting else? Please, let me know

Best Regards.

Posted on: November 14, 2020, 04:36:59 16:36 - Automerged

Thanks for this.  I'm a huge fan of MODBUS for multidevice communication.  It is so trim and simple (especially if you only implement multiword read/write functions).

We often talk customers out of using CAN, Ethernet/IP and other protocols that are pretty heavy from a microcontroller standpoint.

I think that we must use the better solution for each problem.

I've used Modbus in the most project I've made. I think is insane to use heavy protocol for little devices without a good reason.

Best Regards.
Logged

Pages: [1]
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