开云体育

ctrl + shift + ? for shortcuts
© 2025 Groups.io

Convert Serial with negative numbers to analog


 

I have an issue that has been giving me some trouble over the last few days.


I'm using the Crestron Yamaha module provided on on the application market and I'm trying to get the volume converted to analog. The serial string that the Yamaha module output ranges from -80 to 16.4. I know about using the function atoi in Simpl+ but the problem is it converts -80 to 80.?


Any ideas on an efficient way to get this done?


Thanks!


 

Test the first byte of the string for '-' and invert appropriately.

On Fri, Nov 11, 2016 at 11:49 AM, mwillis1776@... [Crestron] <Crestron@...> wrote:
?

I have an issue that has been giving me some trouble over the last few days.


I'm using the Crestron Yamaha module provided on on the application market and I'm trying to get the volume converted to analog. The serial string that the Yamaha module output ranges from -80 to 16.4. I know about using the function atoi in Simpl+ but the problem is it converts -80 to 80.?


Any ideas on an efficient way to get this done?


Thanks!



 

开云体育

If You're working on Crestron class or something like this, please stop reading this post ;)

You can use SIMPL only. The fastest method (probably not most elegant) is: string goes to SIO and many digital outputs go to INIT. Thats all..

In SIMPL+ :

STRING_INPUT in[5];
ANALOG_OUTPUT out;
INTEGER temp;

CHANGE in //input is a string from "-80" to "16"
{
??? //output is in range -80 (65456d in crestron) to 16
??? if(find("-", in))
??? ??? temp = -atoi(in);
??? else
??? ??? temp = atoi(in);
???
??? //output will be? from 0 to 96
??? temp = temp + 80;
???
??? //scaled output from 0% to 100%
??? out = temp * 65535 / 96;
}


Btw. What exactly goes from Yamaha? From "-80" to "16.4"? Like 16.4 dB? ATOI ignores this ".4" part of the string..



Dňa 11.11.2016 o 17:49 mwillis1776@... [Crestron] napísal(a):

?

I have an issue that has been giving me some trouble over the last few days.


I'm using the Crestron Yamaha module provided on on the application market and I'm trying to get the volume converted to analog. The serial string that the Yamaha module output ranges from -80 to 16.4. I know about using the function atoi in Simpl+ but the problem is it converts -80 to 80.?


Any ideas on an efficient way to get this done?


Thanks!



 

Could you just add 80 to the original number, giving you a positive range of 0 to 96.4?



 

开云体育

It ?can ?be changed in the menu of the receiver most likely. I know you can do that on denon and marantz, ?and I think it is the same on yamaha.?



Sendt fra min Samsung Galaxy-smarttelefon.


 

Haha, nope not for a class. Sorry typo. The volume level that the Yamaha module outputs is the serial string 80db to 16.5db. I'll give that a shot and let you guys know.


 

interestingly, there's an undocumented method called ATOSI that returns a signed integer upon receiving a '-' value first, for 3 series only.? Not sure if that' supposed to be common knowledge, or if it's a wise thing to use undocumented 'things' but it does work.


 

You might want to try looking into the Yamaha volume command and rather than using feedback from the Yamaha just send it the value you want it to be. ?It is not difficult, and then you have a AVR that works like other Crestron audio devices, you can store and recall presets easily, etc.

From: <Crestron@...> on behalf of "mwillis1776@... [Crestron]" <Crestron@...>
Reply-To: <Crestron@...>
Date: Friday, November 11, 2016 at 3:56 PM
To: <Crestron@...>
Subject: [Crestron] Re: Convert Serial with negative numbers to analog

?

Haha, nope not for a class. Sorry typo. The volume level that the Yamaha module outputs is the serial string 80db to 16.5db. I'll give that a shot and let you guys know.


 

I've got it working now with the atosi module. Thanks for the heads up on the undocumented module. Came in really handy.


Bill Broadwick
 

开云体育

Hi mwillis,

? Where did you find the atosi module?

Thanks.


On Nov 15, 2016, at 1:07 PM, mwillis1776@... [Crestron] <Crestron@...> wrote:

?

I've got it working now with the atosi module. Thanks for the heads up on the undocumented module. Came in really handy.


 

It's not a module.? It's a S+ command.

On Thu, Dec 8, 2016 at 1:36 PM, Bill Broadwick bill_broadwick@... [Crestron] <Crestron@...> wrote:
?

Hi mwillis,

? Where did you find the atosi module?

Thanks.


On Nov 15, 2016, at 1:07 PM, mwillis1776@... [Crestron] <Crestron@...> wrote:

?

I've got it working now with the atosi module. Thanks for the heads up on the undocumented module. Came in really handy.



Bill Broadwick
 

开云体育

Thanks Phil.


On Dec 8, 2016, at 1:56 PM, Phil Bridges gravityhammer@... [Crestron] <Crestron@...> wrote:

?

It's not a module.? It's a S+ command.

On Thu, Dec 8, 2016 at 1:36 PM, Bill Broadwick bill_broadwick@... [Crestron] <Crestron@...> wrote:
?

Hi mwillis,

? Where did you find the atosi module?

Thanks.


On Nov 15, 2016, at 1:07 PM, mwillis1776@... [Crestron] <Crestron@...> wrote:

?

I've got it working now with the atosi module. Thanks for the heads up on the undocumented module. Came in really handy.