FOR TIPS, gUIDES & TUTORIALS

subscribe to our Youtube

GO TO YOUTUBE

12688 questions

15067 answers

24145 comments

47110 members

0 votes
108 views 5 comments
by

Hi all,
I'm trying to read the mobile data received today/this week/this month but I don't know how to handle the 2 bytes that I receive.
For example in the webUI i see that bytes received is 3GB (I've restarted the router 2 days ago).
The 2 bytes that I receive are (byte 0; byte1):

  • today: 13194; 37050
  • this week: 65535; 65535
  • this month: 65535; 65535

Let's take for example today, I should take the most signficant byte and multiply by 256 and then add the less significant byte: 13194*256 + 37050 = 4734114 and since the received data is in KB, the result is 4,5GB that is more then what the UI says (that should have the data of today, yesterday and the day before yesterday).

What am I doing wrong?
Thanks,
Andrea

P.s. To read today's data I read the register 185 and the next one.

1 Answer

0 votes
by

Hello,

Are you sure you are reading the value correctly? Based on data here, the mobile data received today is stored in 2 registers, each register has two bytes, and the whole number is stored as a 32 bit unsigned integer?

Also, if you are using the request configuration feature in MODBUS master within the router, you need to use 186 as a first register number

Best regards, 

by
I'm reading from from Node Red so the first register should be 185.
I thought that the 32 bit unsigned integer was the result of the 2 registers.
By the way, those are the numbers I get from the 2 registers: 185 and 186.
How would you translate those 2 reading into bytes?
by

I suggest to check explanation in the section Interpreting the response in the following link.

by

Ok, I see the error that I've made: there is a different modbus data mapping for an old firmware (legacy WebUI, which I was using) that the manual says it returns data in KB, while there is not this wording in the new mapping.

So, my reading could be 13194*65536 + 37050 = 864719034 (about 824MB) which could be the downloaded data of today (I'll try to check if that's true).
What about the weekly and monthly usage data which are all 65535?

by
Nothing...
The data does not add up: I've just noticed the section "Mobile usage" under "Status" and for today it says that I've received 1,29GB and sent 115MB while the ModBus (as I read it and as the manual says to read it), it says that I've downloaded 825MB.
WHYYYY? :'(
by
I've noticed the registers max out on 4294967295 (4GB), which is the max for an unsigned 32 bit integer.

I'm also using Node-Red and ran into this. I was able to get the same (wrong) amount from doing this on the web-UI where you can go into modbus->master->test

So either I'm doing something wrong or these registers are to small for producing figures greater than 4GB.