RS 232 to control Optoma EX765W
arvinnino
Posts: 17
hi this is my first time controling a device using RS232, I dont know if theres a problem with the device or am i doing the wrong thing.. I have NI-2100 and Optoma EX765W connected via RS232 from Port 1 of NI-2100, i used RS232 cable that comes with the package of Optoma.
this is my source code, is there anything that i missed or done something wrong or should have done?? thanks..
DEFINE_DEVICE
dvNexia2 = 5001:1:1
DEFINE_START
SEND_COMMAND dvProj,'SET BAUD 9600,N,8,1'
DATA_EVENT[0]
{
ONLINE:
{
SEND_COMMAND dvProj,'SET BAUD 9600,N,8,1'
}
}
BUTTON_EVENT[dvMET13,1]
{
PUSH:
{
[dvMET13,1] = ![dvMET13,1]
SEND_STRING dvProj,"'~0071 4',$0D,$0A"
}
}
this is my source code, is there anything that i missed or done something wrong or should have done?? thanks..
DEFINE_DEVICE
dvNexia2 = 5001:1:1
DEFINE_START
SEND_COMMAND dvProj,'SET BAUD 9600,N,8,1'
DATA_EVENT[0]
{
ONLINE:
{
SEND_COMMAND dvProj,'SET BAUD 9600,N,8,1'
}
}
BUTTON_EVENT[dvMET13,1]
{
PUSH:
{
[dvMET13,1] = ![dvMET13,1]
SEND_STRING dvProj,"'~0071 4',$0D,$0A"
}
}
0
Comments
A couple of things I would personally do differently:
1 - Use a custom made cable with just pins 2, 3 and 5 (ie. TX, RX and ground) connected. Molded cables usually have most if not all conductors connected internally which can cause communications not to work on Netlinx serial ports (which are far from a standard port).
2 - I don't like the look of using DATA_EVENT[0] to set the baud rate of the serial port. It would be better if you change that line to DATA_EVENT[dvProj].
3 - You don't need the SET BAUD send command in DEFINE_START
Importantly, is the control system TX light for the serial port flashing when you press the keypad button?
where can i find the "control system TX light" ?
If it doesn't flash when you push the button then look at your button channel in your TP design and make sure the channel port assignments match your code and check your dev declaration and make sure you're 5001: port used:0. And use send_string 0's to ensure your button event fires when you push the KP's button cuz that needs proper addressing too.
If it does flash but you get no RX light flashing then check your cable, your port settings and your string format and commands.
Another thing you can do is to open up your "control a device" console in Netlinx, enable notifications and diagnostics and shoot commands at the device there to see if there's any response. Put in some line that sends the data_events data.txt from the projector so you can see it.
Check your define device section...
You named port 1 as dvNexia2
Kenneth K
Putting the send command baud rate stuff in a Data_Event[0] basically says when the NI Master controller is officially online send the baud rate command. Bear in mind, the serial port device (which is device 5001, ports 1-6 has not yet officially come online to receive the baud rate command. So it probably is still on whatever baud rate it was set to last time.
The way your code is written the serial port will never get the baud crate command.
The same thing is true for putting it in define_Start. The serial port isn't online yet to receive the command.
Hope that helps.
E
Thanks for the help... Yes i check on the manual of projector, the included RS232 cable in the projector only uses pin 2 3 & 5.
i tried this:
BUTTON_EVENT[dvMET13,1]
{
PUSH:
{
[dvMET13,1] = ![dvMET13,1]
SEND_STRING dvProj,"'~0071 4 <CR>'"
SEND_STRING 0,"'~0071 4 <CR>'"
}
}
and im receiving the String in diagnostic window but the TX LED is not turning on..
i declare the device like this " dvProj = 5001:1:0" but the LED is not turning on everytime im pressing button 1 of MET13.
sorry its typo error.. but in my program its correct..
Thanks for the info i fully understand it now.
BUTTON_EVENT[dvMET13,1]
{
push:
{
send_string dvproj,"'~XX00 1',$0d" //for swich on projector
}
}
SEND_STRING dvProj,"'~0071 4 <CR>'"
I think <CR> is "Carriage Return" I usually use this with $0D in hexa or 13 in in ASCII
and device you use is dvNexia2 not dvProj
hopefully this can solve your problem