Help
  • Explore Community
  • Get Started
  • Ask the Community
  • How-To & Best Practices
  • Contact Support
Notifications
Login / Register
Community
Community
Notifications
close
  • Forums
  • Knowledge Center
  • Events & Webinars
  • Ideas
  • Blogs
Help
Help
  • Explore Community
  • Get Started
  • Ask the Community
  • How-To & Best Practices
  • Contact Support
Login / Register
Sustainability
Sustainability

Read input register with M340, via READ_VAR

Modicon PAC Forum

A forum for topics related to the scope of Modicon PAC offers and ecosystem along the whole lifecycle: Modicon M580 and 340, EcoStruxure Control Expert, EcoStruxure Process Expert (Unity Pro) and more.

Search in

Improve your search experience:

  • Exact phrase โ†’ Use quotes " " (e.g., "error 404")
  • Wildcard โ†’ Use * for partial words (e.g., build*, *tion)
  • AND / OR โ†’ Combine keywords (e.g., login AND error, login OR signโ€‘in)
  • Keep it short โ†’ Use 2โ€“3 relevant words , not full sentences
  • Filters โ†’ Narrow results by section (Knowledge Base, Users, Products)
cancel
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
Showing results forย 
Showย ย onlyย  | Search instead forย 
Did you mean:ย 
  • Home
  • Schneider Electric Community
  • Industrial Automation
  • Modicon PAC Forum
  • Read input register with M340, via READ_VAR
Options
  • Mark Topic as New
  • Mark Topic as Read
  • Float this Topic for Current User
  • Bookmark
  • Subscribe
  • Mute
  • Printer Friendly Page
Invite a Co-worker
Send a co-worker an invite to the portal.Just enter their email address and we'll connect them to register. After joining, they will belong to the same company.
You have entered an invalid email address. Please re-enter the email address.
This co-worker has already been invited to the Exchange portal. Please invite another co-worker.
Please enter email address
Send Invite Cancel
Invitation Sent
Your invitation was sent.Thanks for sharing Exchange with your co-worker.
Send New Invite Close
Top Experts
User Count
Trinxs1
Lt. Commander Trinxs1 Lt. Commander
11
YONGHO-KIM
Lieutenant YONGHO-KIM Lieutenant
9
ciupol
Lt. Commander ciupol
9
RoozeeR
Lt. Commander RoozeeR Lt. Commander
8
View All

Invite a Colleague

Found this content useful? Share it with a Colleague!

Invite a Colleague Invite
Solved Go to Solution
Back to Modicon PAC Forum
Start a Topic
Solved
SIGE_BMR
Crewman SIGE_BMR
Crewman

Posted: โ€Ž2025-09-12 03:02 AM

0 Likes
4
357
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

Posted: โ€Ž2025-09-12 03:02 AM

Read input register with M340, via READ_VAR

Hello,

I'm trying to read the values on a flow meter via Modbus TCP with a M340 CPU and a NOE card.

The hardware configuration goes like this: Flow meter -> Modbus RTU to TCP Gateway -> NOE.

 

When I use a Modbus TCP Client on my PC (simply Modbus), I can read the modbus register just fine.

I use the function 4 "Read Input Registers", and I'm reading for example the 30103 register.

 

To do this in Control Expert (License XL and V16.0 by the way), I wrote this code in the MAST task:

GEST_READVAR[2] := 50;
IF NOT GEST_READVAR[0].0 THEN
READ_VAR (ADR := ADDM('Ethernet_1{192.168.50.153}1'), OBJ := '%IW', NUM := 30103, NB := length_arint(RECP_READVAR), GEST := GEST_READVAR, RECP => RECP_READVAR);
END_IF;

reTest := WORD_AS_REAL(LOW := INT_TO_WORD(RECP_READVAR[0]), HIGH := INT_TO_WORD(RECP_READVAR[1]));

 

(RECP_READVAR is an ARRAY[0..1] OF INT, reTest is a REAL).

 

Currently, the values of lines 0 and 1 in the RECP array are both 0, but simply modbus displays other values, so something must be wrong but I don't know what.

 

Does anyone have an idea of what I can do to make this work?

(you can find the datasheet of the Modbus RTU module attached to the topic, with register numbers on pages 19 to 26)

 

Thanks a lot for the time anyone would take to look into this๐Ÿ˜€

 

 

 

 

Attachments
Labels
  • Labels:
  • 01. Modicon M340 PAC
  • 05. Networking & Communication
  • 06. EcoStruxure Control Expert
  • Tags:
  • english
Reply

Link copied. Please paste this link to share this article on your social media post.

  • All forum topics
  • Previous Topic
  • Next Topic

Accepted Solutions
ProfHameedi
Lieutenant JG ProfHameedi Lieutenant JG
Lieutenant JG

Posted: โ€Ž2025-09-14 07:55 AM

2 Likes
2
331
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

Posted: โ€Ž2025-09-14 07:55 AM

Hello @SIGE_BMR 

As per the above issue's description, I can guess almost sure that the issue is related to the NUM value which refers to the starting register index.

The correct value is NUM=102 which means Modbus 103 as M340/M580 are based on IEC0 but your device is based on IEC1, and the suffix 3 means the data type is Input Register which has already included in the OBJ="%IW".

You may try this and feedback me.

See Answer In Context

Reply

Link copied. Please paste this link to share this article on your social media post.

Replies 4
ProfHameedi
Lieutenant JG ProfHameedi Lieutenant JG
Lieutenant JG

Posted: โ€Ž2025-09-14 07:55 AM

2 Likes
2
332
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

Posted: โ€Ž2025-09-14 07:55 AM

Hello @SIGE_BMR 

As per the above issue's description, I can guess almost sure that the issue is related to the NUM value which refers to the starting register index.

The correct value is NUM=102 which means Modbus 103 as M340/M580 are based on IEC0 but your device is based on IEC1, and the suffix 3 means the data type is Input Register which has already included in the OBJ="%IW".

You may try this and feedback me.

Reply

Link copied. Please paste this link to share this article on your social media post.

YONGHO-KIM
Lieutenant YONGHO-KIM Lieutenant
Lieutenant

Posted: โ€Ž2025-09-14 06:02 PM

2 Likes
0
323
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

Posted: โ€Ž2025-09-14 06:02 PM

"Modbus address 30103 actually corresponds to address 103 (0-based), so you should set NUM := 103." 

YONGHOKIM_0-1757898158006.png

 

Reply

Link copied. Please paste this link to share this article on your social media post.

SIGE_BMR
Crewman SIGE_BMR
Crewman

Posted: โ€Ž2025-09-14 11:37 PM

In response to ProfHameedi
1 Like
1
282
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

Posted: โ€Ž2025-09-14 11:37 PM

Hello @ProfHameedi 
I tried your suggestion of using 102 for the NUM parameter and it worked!
I also had other Modbus registers to read on the device, all within the 30XXX range, and everything worked by sustracting 30001 to the register value and using the result as the NUM parameter.

Thank you so much for your help ๐Ÿ™
Have a great day ๐Ÿค™

Reply

Link copied. Please paste this link to share this article on your social media post.

ProfHameedi
Lieutenant JG ProfHameedi Lieutenant JG
Lieutenant JG

Posted: โ€Ž2025-09-15 03:51 AM

In response to SIGE_BMR
1 Like
0
278
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

Posted: โ€Ž2025-09-15 03:51 AM

Thanks for your feedback.. It is nice to hear that.

Reply

Link copied. Please paste this link to share this article on your social media post.

Preview Exit Preview

never-displayed

You must be signed in to add attachments

never-displayed

ย 

Youโ€™ve reached the end of your document

WHATโ€™S NEXT?

Ask our Experts

Didn't find what you are looking for? Ask our experts!

My Dashboard

Check out the new Feeds and activities that are relevant to you.

To The Top!

Forums

  • APC UPS Data Center Backup Solutions
  • EcoStruxure IT
  • EcoStruxure Geo SCADA Expert
  • Metering & Power Quality
  • Schneider Electric Wiser

Knowledge Center

Events & webinars

Ideas

Blogs

Get Started

  • Ask the Community
  • Community Guidelines
  • Community User Guide
  • How-To & Best Practice
  • Experts Leaderboard
  • Contact Support
Brand-Logo
Subscribing is a smart move!
You can subscribe to this board after you log in or create your free account.
Forum-Icon

Create your free account or log in to subscribe to the board - and gain access to more than 10,000+ support articles along with insights from experts and peers.

Register today for FREE

Register Now

Already have an account? Login

Terms & Conditions Privacy Notice Change your Cookie Settings ยฉ 2025 Schneider Electric

Welcome!

Welcome to your new personalized space.

of

Explore