Search the Community

Showing results for tags 'modbus'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • News
    • Announcements
    • Suggestions
    • New users say Hi!
  • Spotlight!
    • Sponsor Spotlight
    • Sponsor Giveaways
  • Energia
    • Energia - MSP
    • Energia - TivaC/CC3XXX
    • Energia - C2000
    • Energia Libraries
  • MSP Technical Forums
    • General
    • Compilers and IDEs
    • Development Kits
    • Programmers and Debuggers
    • Code vault
    • Projects
    • Booster Packs
    • Energia
  • Tiva-C, Hercules, CCXXXX ARM Technical Forums
    • General
    • SensorTag
    • Tiva-C, Hercules, CC3XXX Launchpad Booster Packs
    • Code Vault
    • Projects
    • Compilers and IDEs
    • Development Kits and Custom Boards
  • Beagle ARM Cortex A8 Technical Forums
    • General
    • Code Snippets and Scripts
    • Cases, Capes and Plugin Boards
    • Projects
  • General Electronics Forum
    • General Electronics
    • Other Microcontrollers
  • Connect
    • Embedded Systems/Test Equipment Deals
    • Buy, Trade and Sell
    • The 43oh Store
    • Community Projects
    • Fireside Chat
  • C2000 Technical Forums
    • General
    • Development Kits
    • Code Vault
    • Projects
    • BoosterPacks

Calendars

There are no results to display.


Found 6 results

  1. Hi I am trying to do a MC to MC communication using modbus. I assigned static IP's to both my MC's. WiFiServer MbServer(MB_PORT); WiFiClient client = MbServer.available(); if(client.available()) { ///Do something////// } My question here is, Is there are way I can check the senders IP address before reading modbus packed data in the loop. Because the receiver MC can be jammed with high data throughput as its a open connection (i.e anyone can send data to the MC by knowing its IP address). I want to read the senders IP before doing any data processing. I know using UDP protocol we can use RemoteIP(). Is there anything similar in this case. For sending and receiving MODBUS, im using the attached libraries. MgsModbus.cpp MgsModbus.h
  2. 0down votefavorite Hi, I am trying to implement Modbus TCP on TIVA 1294 using the following code. I am using a modbus slave simulator on a pc to check the following code. However, the code doesn't seem to be working. I have downloaded the code & the libraries fromhttp://myarduinoprojects.com/modbus.html. Please suggest me corrections if necessary. Also is there another working example available for modbus tcp/ip for ethernet on TIVA energia? Please guide. #include <SPI.h> #include <Ethernet.h> #include "MgsModbus.h" MgsModbus Mb; int inByte = 0; // incoming serial byte // Ethernet settings (depending on MAC and Local network) byte mac[] = {0x00, 0x1A, 0xB6, 0x02, 0xD1, 0x14 }; IPAddress ip(192, 168, 0, 35); void setup() { // serial setup Serial.begin(9600); Serial.println("Serial interface started"); // initialize the ethernet device Ethernet.begin(mac, ip); // start etehrnet interface Serial.println("Ethernet interface started"); // print your local IP address: Serial.print("My IP address: "); for (byte thisByte = 0; thisByte < 4; thisByte++) { // print the value of each byte of the IP address: Serial.print(Ethernet.localIP()[thisByte], DEC); Serial.print("."); } Serial.println(); // slave address Mb.remSlaveIP = (192,168,0,1); // Fill MbData // Mb.SetBit(0,false); Mb.MbData[0] = 1; Mb.MbData[1] = 2; Mb.MbData[2] = 3; Mb.MbData[3] = 4; Mb.MbData[4] = 5; Mb.MbData[5] = 6; Mb.MbData[6] = 0; Mb.MbData[7] = 0; Mb.MbData[8] = 0; Mb.MbData[9] = 0; Mb.MbData[10] = 0; Mb.MbData[11] = 0; // print MbData for (int i=0;i<12;i++) { Serial.print("address: "); Serial.print(i); Serial.print("Data: "); Serial.println(Mb.MbData); } // print menu Serial.println("0 - print the first 12 words of the MbData space"); Serial.println("1 - FC 1 - read the first 5 coils from the slave and store them in the lower byte of MbData[1]"); Serial.println("2 - FC 2 - read the first 5 discrete inputs from the slave and store them in the higer of the MbData[1]"); Serial.println("3 - FC 3 - read the first 5 registers from the slave and store them in MbData[3..7"); Serial.println("4 - FC 4 - read the first 5 input registers from the slave and store them in MbData[8..12]"); Serial.println("5 - FC 5 - write coil 0 of the slave with the bit valeu of MbData[0.0]"); Serial.println("6 - FC 6 - write register 0 of the slave with MbData[2]"); Serial.println("7 - FC 15 - write 5 coils of the slave starting with coil 0 with GetBit(16..20"); Serial.println("8 - Fc 16 - write 5 registers of the slave starting on register 0 with MbData[0..4]"); Serial.println(Mb.remSlaveIP); } void loop() { if (Serial.available() > 0) { // get incoming byte: inByte = Serial.read(); if (inByte == '0') { // print MbData for (int i=0;i<12;i++) { Serial.print("address: "); Serial.print(i); Serial.print("Data: "); Serial.println(Mb.MbData); } } if (inByte == '1') {Mb.Req(MB_FC_READ_COILS, 6,6,6);} // 1 // ref, count, pos if (inByte == '2') {Mb.Req(MB_FC_READ_DISCRETE_INPUT, 6,6,6);} // 2 if (inByte == '3') {Mb.Req(MB_FC_READ_REGISTERS, 6,6,6);} // 3 if (inByte == '4') {Mb.Req(MB_FC_READ_INPUT_REGISTER, 6,6,6);} // 4 if (inByte == '5') {Mb.Req(MB_FC_WRITE_COIL, 0,0,0);} // 5 // count can be x if (inByte == '6') {Mb.Req(MB_FC_WRITE_REGISTER, 7,0,0);} // 6 // count can be x if (inByte == '7') {Mb.Req(MB_FC_WRITE_MULTIPLE_COILS, 0,6,0);} // 15 if (inByte == '8') {Mb.Req(MB_FC_WRITE_MULTIPLE_REGISTERS, 0,6,0);} // 16 } Mb.MbmRun(); // Mb.MbsRun(); } Thanks.
  3. Hi, I want to implement a code for Modbus RTU over TCP/IP usng TM4C1294NCPDT launchpad. Does anyone know a library which can be used to implement it. Also is it possible to obtain data from a PLC using modbus TCP/IP and send it to a Server on cloud using the same ethernet port? Please help. Thanks.
  4. I am using the Modbus RTU library for Arduino for TIVA TM4c1294ncpdt. Slave(Modbus_Slave Software on PC) is responding to master request but master somekind does not proccess informations that he gets. So I can not regulate LED on master side over potentiometer on slave side. Also master stops sending request to slave after 10 requests sended to slave (when retry_count is set to 5). Problem is: 1) master send request to slave, 2) slave gets request 3) slave process request, 4) slave returns answer to master 5) master gets answer 6) master do not process slave answer After 5 requests (10 actually: PRESET_MULTIPLE_REGISTERS - 5 times and READ_HOLDING_REGISTERS - 5 times), master stops sending request to slave, due to retry_count which is set to 5. If I set retry count to 5000000, it still stops sending requests.
  5. I want to make a connection Modbus TCP slave. For this I use a Arduino libraries. I am using the EK-TM4C1294XL Kit The could enter and take the example they have in the library, the example compiles correctly. Board is connected to a switch and a PC is connected also has disabled the Windows firewall. I use a Modbus TCP client program on the PC to read the records of the kit through Modbus. I can not read the values, tells me it can not connect to the target computer, the connection was denied. If I make ping the IP of the plate answer me well. Someone can help me solve the problem The code is as follows: #include <SPI.h> #include <Ethernet.h> #include "MgsModbus.h" MgsModbus Mb; int inByte = 0; // incoming serial byte // Ethernet settings (depending on MAC and Local network) byte mac[] = {0x90, 0xA2, 0xDA, 0x0E, 0x94, 0xB5 }; IPAddress ip(192, 168, 100, 109); IPAddress gateway(192, 168, 100, 1); IPAddress subnet(255, 255, 255, 0); void setup() { // serial setup delay(5000); Serial.begin(9600); Serial.println("Serial interface started"); // initialize the ethernet device Ethernet.begin(mac, ip, gateway, subnet); // start etehrnet interface Serial.println("Ethernet interface started"); // print your local IP address: Serial.print("My IP address: "); for (byte thisByte = 0; thisByte < 4; thisByte++) { // print the value of each byte of the IP address: Serial.print(Ethernet.localIP()[thisByte], DEC); Serial.print("."); } Serial.println(); // Fill MbData // Mb.SetBit(0,false); Mb.MbData[0] = 0; Mb.MbData[1] = 0; Mb.MbData[2] = 0; Mb.MbData[3] = 0; Mb.MbData[4] = 0; Mb.MbData[5] = 0; Mb.MbData[6] = 0; Mb.MbData[7] = 0; Mb.MbData[8] = 0; Mb.MbData[9] = 0; Mb.MbData[10] = 0; Mb.MbData[11] = 0; // print MbData for (int i=0;i<12;i++) { Serial.print("address: "); Serial.print(i); Serial.print("Data: "); Serial.println(Mb.MbData[i]); } // print menu Serial.println("0 - print the first 12 words of the MbData space"); Serial.println("1 - fill MbData with 0x0000 hex"); Serial.println("2 - fill MbData with 0xFFFF hex"); Serial.println("3 - fill MbData with 0x5555 hex"); Serial.println("4 - fill MbData with 0xAAAA hex"); } void loop() { if (Serial.available() > 0) { // get incoming byte: inByte = Serial.read(); if (inByte == '0') { // print MbData for (int i=0;i<12;i++) { Serial.print("address: "); Serial.print(i); Serial.print("Data: "); Serial.println(Mb.MbData[i]); } } if (inByte == '1') {for (int i=0;i<12;i++) {Mb.MbData[i] = 0x0000;}} if (inByte == '2') {for (int i=0;i<12;i++) {Mb.MbData[i] = 0xFFFF;}} if (inByte == '3') {for (int i=0;i<12;i++) {Mb.MbData[i] = 0x5555;}} if (inByte == '4') {for (int i=0;i<12;i++) {Mb.MbData[i] = 0xAAAA;}} } // Mb.MbmRun(); Mb.MbsRun(); } The files are: modbus_slave.rar The ModbusTCP Client PC program is:EasyModbusClient.rar modbus_slave.rar EasyModbusClient.rar
  6. Hi I am currently porting from Arduino to MSP430 platform. I want to port to attached Modbus Master and slave library to Energia. In modbus we have to set parity of serial communication, parity function is not there in MSP430 HardwareSerial.ccp library can anyone help me to add this function in energia library? Problem is not with modbus library but with Energia core library. Thanks SimpleModbusMasterV12.rar SimpleModbusSlaveV9.rar