Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
01/10/05 23:45
Read: times


 
#84701 - Modbus
Responding to: ???'s previous message

I've implemented many modbus nodes and use only 8bits no parity 1 stop bit. The PLCs I also use (TWIDO & Schneider) accept this also. You might wish to check the equipment you want to connect to. To receive modbus rtu I reload timer2 with the required timeout (3 char times) each time I receive a char. When timer2 times out, I have it activate a task to process the received packet. This task checks the CRC (use the table driven crc check it's much faster) and then checks for the slave address then the command. For each of the commands (I only support two - read regs and write regs) I then check the register number and number of registers then do what is required. I create a structure of 'modbus registers' and access them through read and write routines. Therefore in my application code to read or write a modbus register I write something like a= read_modbus_reg(MB_LEVEL);
MB_LEVEL being one of my defined modbus registers. I've never got around to polishing my code for publication but I can post the code if you wish.

List of 7 messages in thread
TopicAuthorDate
MODBUS on UART (parity & stop bits?)            01/01/70 00:00      
   parity and stop            01/01/70 00:00      
      parity and stop            01/01/70 00:00      
         2 Stop Bits            01/01/70 00:00      
         stop bit            01/01/70 00:00      
            Beware - early ti/ri flags!            01/01/70 00:00      
               Modbus            01/01/70 00:00      

Back to Subject List