Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

ModusToolbox™ General Forum Discussions

Communication
Level 4
Level 4
First like received 50 replies posted 100 sign-ins

Tôi đang sử dụng ADC để đọc giá trị của cảm biến độ ẩm đất. Tôi đã đọc ADC với giá trị đầu ra là giá trị điện áp, bây giờ tôi muốn chuyển đổi giá trị điện áp hiện tại thành giá trị phần trăm khi hiển thị trên ứng dụng di động, tôi phải làm như thế nào? Tôi sử dụng Modus Toolbox và PSoC 063 BLE prototyping kit.
Cảm ơn!

0 Likes
8 Replies
Owen_Zhang123
Moderator
Moderator
Moderator
500 solutions authored 250 sign-ins 1000 replies posted

Do you mean you need to transfer the ADC value to a percentage?

You can define a full range of the value and calculate the percentage by yourself.

0 Likes
Communication
Level 4
Level 4
First like received 50 replies posted 100 sign-ins

How can I do that?

0 Likes
Owen_Zhang123
Moderator
Moderator
Moderator
500 solutions authored 250 sign-ins 1000 replies posted

What's the range of the value?

You may calculate it like this:  Percentage = 100*ADC_Value/Full_Range

0 Likes

Communication_0-1678701312003.png

This is the range of values that I have read from the ADC.

The description reads my ADC using: Read the value from ADC pin, represented as a 32-bit signed, right-aligned value.

This is a 'resolution'-bit value, sign-extended to 32 bits. If the vplus signal is below the vminus signal, the result will be negative. If the vplus signal is above the vminus signal, the result will be positive. If continous scanning is disabled, this will block while a conversion is performed on the selected channel, then return the result. Depending on the ADC speed this function may block for some time. If continuous scanning is enabled, this will return the value from the most recent conversion of the specified channel (if called shortly after enabling continuous scanning it may block until at least one conversion has been performed on this channel).

0 Likes

You don't know how to transfer the digital value to actual voltage?

0 Likes

Looks like you misunderstood me

0 Likes
Owen_Zhang123
Moderator
Moderator
Moderator
500 solutions authored 250 sign-ins 1000 replies posted

Could you be more specific about your problem?

0 Likes

I want to convert the readings like the image above into percentages

0 Likes