Serial port : receiving problem
tuxtof
Posts: 5
Hi have the following problem on my NI2000 serial port
i can send (from NI2000) data without problem
but can i send data to NI2000 i receive nothing
i test NI2000 <-> Smartups UPC NI2000 send OK nothing receive
i test PC <-> Smartups UPC with the same cable all is OK
i test NI2000 <-> PC NI2000 send OK nothing receive from PC
my sample test code is
DEFINE_EVENT
DATA_EVENT[TEST]
{
ONLINE:
{
SEND_COMMAND TEST,"'SET BAUD 38400,N,8,1'"
SEND_STRING 0,"'TEST Now Online @ 38400bps'"
SEND_STRING TEST,"'Now Online @ 38400bps',$0A,$0D"
}
STRING:
{
SEND_STRING 0,"'chaine recu sur port Test=',Data.Text"
}
}
i test this code with PC terminal andlink modem cable
terminal receive data but NI2000 never receive data send by terminal
any idea is really welcome
i can send (from NI2000) data without problem
but can i send data to NI2000 i receive nothing
i test NI2000 <-> Smartups UPC NI2000 send OK nothing receive
i test PC <-> Smartups UPC with the same cable all is OK
i test NI2000 <-> PC NI2000 send OK nothing receive from PC
my sample test code is
DEFINE_EVENT
DATA_EVENT[TEST]
{
ONLINE:
{
SEND_COMMAND TEST,"'SET BAUD 38400,N,8,1'"
SEND_STRING 0,"'TEST Now Online @ 38400bps'"
SEND_STRING TEST,"'Now Online @ 38400bps',$0A,$0D"
}
STRING:
{
SEND_STRING 0,"'chaine recu sur port Test=',Data.Text"
}
}
i test this code with PC terminal andlink modem cable
terminal receive data but NI2000 never receive data send by terminal
any idea is really welcome
0
Comments
By default, the "transfer" of the received data from hardware buffer of the RS232 port into the NetLinx software is disabled. In this situation, you can get the current received data only at the data_event String section with DATA.TEXT
Two ways to enable full receiving:
1) manually enable receiving with SEND_COMMAND dvSER1,'RXON'
2) create a buffer: The Create_Buffer automatically does RXON.
Why possible to do this?
For example, there was a Conferencing system (afaik PCS1 from Sony) which blasts the controller with an BIG amount of data not usable when it's turned on. In this situation, to prevent the controller of lockup, before the PCS1 is turned on we disable the receiving with RXOF for about a minute.
DEFINE_EVENT
DATA_EVENT[TEST]
{
ONLINE:
{
SEND_COMMAND TEST,"'SET BAUD 38400,N,8,1'"
SEND_STRING 0,"'TEST Now Online @ 38400bps'"
SEND_COMMAND TEST,'RXON'
SEND_STRING TEST,"'Now Online @ 38400bps',$0A,$0D"
}
STRING:
{
SEND_STRING 0,"'chaine recu sur port Test=',Data.Text"
}
}
i have always no data receiving by the N2000
i make the same thing on another serial (UPS) same problem
how to verify that RXON is ok ??
another idea ??
Just to clarify. Defining a DATA_EVENT also automatically generates the RXON.
What cable are you using? If it is a complete 9 pin cable, then that could be the issue. There are pins on the NI 9 pin connector used for RS422 that a normal 9 pin use differently. Use only the signals required (RX, TX and GND as a minimum, more if HW Handshaking is required).
DATA.TEXT show what is in the hardware Buffer. No RXON is required.
To tuxtof:
please short pin 2 and 3 on the NetLinx' serial port. If you now still can't receive anything in DATA.TEXT, there maybe is a hardware problem. I remember one NI controller where receiving hasn't worked on any of the serial ports....
ok it's good
i make a first test with a simple cross betwen pin 2 and 3 it's perfect
after that i make good cable for my APC Smart UPS (1 - 3, 2 - 2 , 9 - 5)
and all is working
very thanks
I thought it was the definition of the STRING: handler that did that? Just doing a DATA_EVENT (perhaps with an ONLINE: handler for setting rates) wouldn't cut it?
- Chip
That's correct. I didn't consider defining a DATA_EVENT not having a STRING: handler, but obviously that is done anytime any is using the port as a TX only but does have an ONLINE: event for port setup. Thanks for clarifying.
The main thing I wanted to make clear is that it is not required to do a CREATE_BUFFER or explicitly send a 'RXON' command in NetLinx if you are using a STRING DATA_EVENT.
Chuck
I work whith APC SmatUPS.
It's standard RS-232 serial communications at 2400 bps/8N1.
The first command to UPS must be 'Y' - enter to smart mode.
It will answer only having accepted this command.
The Smart Protocol descriptions: http://www.networkupstools.org/protocols/apcsmart.html