Your Universal Remote Control Center
RemoteCentral.com
Philips Pronto Professional Forum - View Post
Previous section Next section Up level
Up level
The following page was printed from RemoteCentral.com:

Login:
Pass:
 
 

Topic:
RS232 feedback question
This thread has 9 replies. Displaying all posts.
Post 1 made on Monday March 18, 2024 at 22:14
mpg7321
Regular Member
Joined:
Posts:
June 2020
111
I would like to display the current mute status on my Marantz receiver.
what am I doing wrong, the code needing to be sent is MU?\r

var s = CF.extender[A].serial[1];
s.bitrate = 9600;
s.databits = 8;
s.parity = 0;
s.stopbits = 1;
var line = s.match('MU?\r','\r',1000);
CF.widget("Mute_Status").label = line;
OP | Post 2 made on Tuesday March 19, 2024 at 17:08
mpg7321
Regular Member
Joined:
Posts:
June 2020
111
The RFX9600 firmware is on the latest. If I add commands to a RS232 component I have no problems sending RS232 commands out, and controlling my receiver, but I just can't seem to get things working from a script, this does not work either,

var e = CF.extender[A];
var s = e.serial[1];
s.bitrate = 9600;
s.databits = 8;
s.parity = 0;
s.stopbits = 1;
s.send(MV50\r);
Post 3 made on Tuesday March 19, 2024 at 17:38
Lyndel McGee
RC Moderator
Joined:
Posts:
August 2001
12,994
A try/ catch debug statement around your code would have shown you errors that variable 'A' is not defined.

Extender 'A' is hexadecimal representation of extender ID. Character A is treated as a variable and not as a number.

Serial ports are referenced using 0 to 3.

var e = CF.extender[10]; // or [0x0A]
var s = e.serial[1];

This will reference Serial Port 2 on Extender A.

Note that every time you send to an extender port, the receive buffer is cleared so using RS232 to constantly receive events from equipment is problematic.

I know there are threads about this that I authored long ago. Search for 232 and UART and you can read up about it. IIRC, those were the keywords.

From what you are sending, you are talking with a Marantz or Denon unit. I'd highly recommend using TCPIP to port 22 vs doing the RS232 way.
Lyndel McGee
Philips Pronto Addict/Beta Tester
OP | Post 4 made on Tuesday March 19, 2024 at 18:32
mpg7321
Regular Member
Joined:
Posts:
June 2020
111
Thanks, that works, hear is my code but can't seem to get the "if statement" to work properly,

var e = CF.extender[10];
if( e == null )
{
Diagnostics.log("Extender 0 is not defined");
}
else
{
var s = e.serial[0];
if( s == null )
{
Diagnostics.log("Extender 0 is not a serial extender");
}
else
{
s.bitrate = 9600;
s.databits = 8;
s.parity = 0; // None
s.stopbits = 1;
}
}
var status = s.match('MU?\r','\r',1000);
CF.widget("Mute_Status").label = status;
if (status === 'MUOFF')
{
s.send("MUON\r");
}
else
{
s.send("MUOFF\r");
}

The widget displays MUOFF so when I try the "IF Statement" it should execute the s.send("MUON\r"); line, but it is not
OP | Post 5 made on Tuesday March 19, 2024 at 18:42
mpg7321
Regular Member
Joined:
Posts:
June 2020
111
I am guessing there is something in the return string that is not viable in the widget, like a space or a carriage return or something, this line does work,

if (status.indexOf('MUOFF') > -1)
Post 6 made on Wednesday March 20, 2024 at 18:57
Lyndel McGee
RC Moderator
Joined:
Posts:
August 2001
12,994
System.print and Diagnostics.log are your friend

Add a widget on your page with ProntoScript name _PS_DEBUG_ (see the dev guide)

System.setDebugMask(9);

for (var i = 0; i < status.length; i++) {
System.print('i:' + i + '=' + status.charCodeAt[i]);
}

What you will see is the the serial match also returns the carriage return at the end of the string (\r).

So status really is 'MUOFF\r' and not 'MUOFF'

That'ts why === does not work and your status.indexOf('MUOFF') > -1 does work.

:-)

Here's what I'd recommend. Download NodeJS as it is a wonderful playground for JavaScript development. It will really help you learn the JavaScript language and the APIs. Also note that the Mozilla website also lets you try out many things directly from a Web Browser.

[Link: developer.mozilla.org]
Lyndel McGee
Philips Pronto Addict/Beta Tester
OP | Post 7 made on Wednesday March 20, 2024 at 21:00
mpg7321
Regular Member
Joined:
Posts:
June 2020
111
so thats why when I tried if (status == 'MUOFF') did not work, it should have been if (status == 'MUOFF\r')
OP | Post 8 made on Wednesday March 20, 2024 at 21:01
mpg7321
Regular Member
Joined:
Posts:
June 2020
111
so this is what I use to determine if my receiver is muted, then send out the appropriate commands..

var e = CF.extender[10];
if( e == null )
{
Diagnostics.log("Extender 0 is not defined");
}
else
{
var s = e.serial[0];
if( s == null )
{
Diagnostics.log("Extender 0 is not a serial extender");
}
else
{
s.bitrate = 9600;
s.databits = 8;
s.parity = 0; // None
s.stopbits = 1;
}
}
var status = s.match('MU?\r','\r',1000);

if (status.indexOf('MUOFF') > -1)
{
s.send("MUON\r");
}
else
{
s.send("MUOFF\r");
}
Post 9 made on Friday March 22, 2024 at 21:13
Lyndel McGee
RC Moderator
Joined:
Posts:
August 2001
12,994
FYI, this is the thread where the UART is discussed. And it fits right into what you are trying to do on your remote.

[Link: remotecentral.com]

and another one too.

[Link: remotecentral.com]
Lyndel McGee
Philips Pronto Addict/Beta Tester
OP | Post 10 made on Sunday March 24, 2024 at 13:22
mpg7321
Regular Member
Joined:
Posts:
June 2020
111
thanks


Jump to


Protected Feature Before you can reply to a message...
You must first register for a Remote Central user account - it's fast and free! Or, if you already have an account, please login now.

Please read the following: Unsolicited commercial advertisements are absolutely not permitted on this forum. Other private buy & sell messages should be posted to our Marketplace. For information on how to advertise your service or product click here. Remote Central reserves the right to remove or modify any post that is deemed inappropriate.

Hosting Services by ipHouse