Geekzone: technology news, blogs, forums
Guest
Welcome Guest.
You haven't logged in yet. If you don't have an account you can register now.


Delphinus

611 posts

Ultimate Geek
+1 received by user: 274


#257316 25-Sep-2019 17:07
Send private message

I have an Adeunis LoRa pulse counter connected to The Things Network. I can send it downlink frames to change registers in it.

 

From the documentation: https://www.gowifi.co.nz/specs/PULSE_LoRaWAN_AU915-928_UG_V1.0.0_FR_GB.pdf

 

Page 72 gives some detail on the registers able to be changed. I have successfully changed register 301 to 5 mins by sending 41 01 00 05 (the extra 00 is because S301 register's size is 2 bytes).

 

However what would I send to change 321 to Value 1 - this uses Hexadecimal instead of Decimal, and uses bits 0 to 2 for the configuration. Any ideas?


Create new topic
worzel
4 posts

Wannabe Geek
+1 received by user: 3


  #2324736 25-Sep-2019 17:44
Send private message

Short Answer: same as you did for decimal (provided value is less than 10).

 

Long Answer:

 

Hexadecimal is the same as decimal for numbers from 0 to 9, then it uses letters A to F to represent decimal 10 to 15.

 

With 2 bits there are four possible values which as Binary, Decimal, Hexadecimal are:

 

00, 0, 0 

 

01, 1, 1 

 

10, 2, 2

 

11, 3, 3  (not used for your device)

 

To distinguish between the various bases, binary is often written as 0b01, and hexadecimal as 0x01

 

 




SirHumphreyAppleby
2938 posts

Uber Geek
+1 received by user: 1859


  #2324747 25-Sep-2019 18:47
Send private message

Hex and decimal are represented exactly the same way from the point of view of the computer.

 

What the documentation appears to be doing is using the term decimal to represent a number, and hexadecimal where individual bits or groups of bits need to be set. That's not strictly correct, both will do the job perfectly well. It's possibly due to the fact that C (which the firmware is likely written in), doesn't have a way to represent binary numbers, only hex and decimal.

 

Register 321 is simple as it's a single byte. Simply setting the value to 0, 1 or 2 should work.

 

320 is more complicated as it has two distinct functions, each of which use 4 bits. It's unclear which are the high and low bits, but one would need to be shifted 4 bits to the left. In C, this would mean assigning (value_chan_a << 4) | value_can_b, assuming the most significant bit controls Channel A, to set both channels (they cannot be set independently). The value of value_chan_n can use decimal or hex notation, it matters not to the computer.


Create new topic








Geekzone Live »

Try automatic live updates from Geekzone directly in your browser, without refreshing the page, with Geekzone Live now.



Are you subscribed to our RSS feed? You can download the latest headlines and summaries from our stories directly to your computer or smartphone by using a feed reader.