How do I configure a Serial Port?
DerekHoffman
Posts: 22
Where do I need to look in order to find information on how to configure a serial port (i.e. set the baud rate, parity bit, etc.) on a NI-3100?
Searching the forums have turned up that I should use a send_command from an online handler from a data_event that's tied to the serial port I want to setup. But I can't find anything in the help files or my AMX Programmer I&II book that tells me what commands I can send using the send_command or how to even format them.
I'd expect something like this to be written done somewhere... I figure I must just be looking in the wrong places.
Thanks for the help,
Derek.
Searching the forums have turned up that I should use a send_command from an online handler from a data_event that's tied to the serial port I want to setup. But I can't find anything in the help files or my AMX Programmer I&II book that tells me what commands I can send using the send_command or how to even format them.
I'd expect something like this to be written done somewhere... I figure I must just be looking in the wrong places.
Thanks for the help,
Derek.
0
Comments
One is Software History which is located in the Tools menu of Netlinx Studio.
Another is to go to the AMX website and go to the NI-3100 product page. There you'll find the programming manual. It'll have that information there as well.
One thing to remember: put the configuration command in a DATA_EVENT, not at program startup.
something like
Here is an example how to set the serial port
DATA_EVENT[LCD_LEFT]
{
ONLINE:SEND_COMMAND DATA.DEVICE,'SET BAUD 9600,N,8,1'
}
Or you could use the Diagnostic Tools to set the serial port by using the send_command
Hope this will help
Cheers
Thanks for the help,
Derek.
Gotta, say, it sure is nice to actually get to use an actual programming language instead of the drag and drop hell of Simpl Windows. Plus, it's nice that we can actually do diffs and merges in our source code versioning system becasue axs is a simple ascii file and not a crazy markup language looking pile of... oh nevermind.
Thanks for the help guys,
Derek.
True dat,
it is also a great resource and is much nicer than Software History.
thanks for reminding me of it.
ejm
It's all a trade-off one way or the other...
- Chip
I do
ONLINE:
{
SEND_COMMAND dvDevice,'SET BAUD 9600,N,8,1 485 DISABLE';
WAIT 3 SEND_COMMAND dvDevice,'HSOFF';
}
in every of my module files.
so even if RS-485 or handshaking has been used on that port, these are disabled. there is also a
SEND_COMMAND <DEV>,'XOFF'
command that disables software handshaking, if somebody uses this one frequently...
Further to the thread - (I think I'm a step above newbie - certainly no expert but questioning that right now - sleep depravation is wonderful)
I want to ensure the port on the NI2100 is set correctly every time they system boots.
I used code as posted previously in the thread
DEFINE_DEVICE
dvSwitch = 5001:1:0 // Autopatch Precis LT w DSP (9600, N,1,8)
DATA_EVENT [dvSwitch]
{
ONLINE:
{
//Set baud rate for RS232 port 1 N-1-8
SEND_COMMAND DATA.DEVICE,'SET BAUD 9600,N,8,1' PULSE [dvRelay,1]
}
The relay pulse is in just to know it was getting there, however it appears to be triggering when the port itself on the NI comes online, NOT the switcher.
I tested this by having the switcher unplugged from the RS232 port and still heard the relay fire.
What am I missing please?
Cheers!