Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations KootK on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

NModbus4 - PLC Master to PC Slave listen event? 1

Status
Not open for further replies.

PaulDietz

Automotive
Mar 2, 2017
3
I have an Automation Direct DL06 setup in a peer to peer configuration. The PLC is the master and the PC is the slave. The ladder logic is straight forward, just sending a double word (4 bytes) from the master starting a V3000 to PC. I've set V3000 to "Test". See below:

DebugLadderLogic1_zo9dy8.png


When the ladder logic runs the DataStoreWrittento event fires and the code below is my attempt to get the value "Test" from the modbus data store. Instead of getting "Test", I get 25940 and 29811... I would appreciate any assistance getting the "Test" value out of memory.

NModbus4_data_capture_event_vpver1.png
 
Replies continue below

Recommended for you

My guess is that you're being confused by expecting text values, but are getting decimal number results.

i.e. 25940 is a decimal value. Converting to hex gives you 6554. Looking at these characters in an ASCII table indicates 65 is e, and 54 is T. I've not checked to see if your second value lines up.

Thus, you've probably got a big endian / little endian issue, and you're looking at raw data values but expecting them to be parsed into ASCII for you to read.

 
Thanks for the feedback Fred and itsmoked. The 25940 and 29811 are of data type ushort. Please see solution below:

NModbus4_data_capture_event_aacffc.png
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor