Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to read from slave? #51

Open
emrelio opened this issue Feb 24, 2020 · 6 comments
Open

How to read from slave? #51

emrelio opened this issue Feb 24, 2020 · 6 comments

Comments

@emrelio
Copy link

emrelio commented Feb 24, 2020

I'm trying to read registers from the slave. But I can't read anything. With the ReqWrite function or FuncWrite function.

How can I read registers from the slave?

Thank You!

@armink
Copy link
Owner

armink commented Feb 24, 2020

You can ues this API

eMBMasterReqErrCode eMBMasterReqReadHoldingRegister( UCHAR ucSndAddr, 
                                                     USHORT usRegAddr,
                                                     USHORT usNRegs,
                                                     LONG lTimeOut );

@emrelio
Copy link
Author

emrelio commented Feb 24, 2020

I'm trying with this function but I did write the wrong function name in the first message. Sorry.

But I couldn't find the variable to read the data. I mean which variable is for reading the data.

@armink
Copy link
Owner

armink commented Feb 24, 2020

You can find the read data on the usMRegHoldBuf in FreeModbus\port\user_mb_app_m.c

@emrelio
Copy link
Author

emrelio commented Feb 27, 2020

Thank you! I did try to read but then I realized in every request the error code is always "TimeOut". Even in the reqWrite. I'm using f407 with 168MHz clock.

@armink
Copy link
Owner

armink commented Feb 29, 2020

May be uart driver has some problem. You can check the uart ISR for data receive.

@miskin-lee
Copy link

Thank you! I did try to read but then I realized in every request the error code is always "TimeOut". Even in the reqWrite. I'm using f407 with 168MHz clock.

me too!Have you solved the problem yet

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants