Tuesday, February 17, 2009

Industrial USB HUB with USB-IF certification


Moxa new USB HUB product line - UPort HUB 404/407 is launched. 
UPort HUB is good USB extenstion solution for industrial environment. If you always have USB compatibility/stability problem such as "Unknown Device", you can take a look at it. It has USB-IF certification with USB 2.0 high speed (480Mbps), including self power and bus power mode. This can eliminate USB compatibility problem. With IEC-61000-4-2 level 4 protection, plug/un-plug frequently will never be a problem and it is very suitable for mobile device manufacturing. For harsh environment, the rugged metal case design, DIN rail mountable and wide range operating temperature support (-40~+85) can fulfil your industrail USB connection requirement. 

Thursday, February 05, 2009

Win32 DCB Trap

In Win32 serial communication functions, the DCB is very important struct (which is similar to termios struct in *UIX). There are several Win32 functions can change the struct - SetCommState, GetCommState and BuildCommDCB. When you want to use them, you have to notice some traps:

Trap 1:
DCB dcbSerial = {0};
dcbSerial.DCBlength = sizeof(dcbSerial);
dcbSerial.BaudRate = CBR_19200;
dcbSerial.ByteSize = 8;
dcbSerial.StopBits = ONESTOPBIT;
dcbSerial.Parity = NOPARITY;
if(!SetCommState(hSerial, &dcbSerial)){
//error setting serial port state
}
In above code, you clear all fields first and set some basic parameters. Please DON'T set DCB in this way.  That will set zero to important fields such as XonLim and XoffLim and cause some serial adapter driver to return fail. XonLim can not be the same as XoffLim if any flow control is enabled. 


Trap 2:
DCB dcbSerial = {0};
dcbSerial.DCBlength = sizeof(dcbSerial);
BuildCommDCB(“baud=1200 parity=N data=8 stop=1”, &dcbSerial);
if(!SetCommState(hSerial, &dcbSerial)){
//error setting serial port state
}  
This is very similar to trap 1. BuildCommDCB is just for compatbility and only few people will use it in Win32. It use the "mode" (one DOS program) style to describe serial parameter. 

The best way to set DCB is to get previous setting by calling GetCommState. This is also verys similer to *UIX termios - you should get old termios setting before setting new termios. That means: Get all old settings, change the field which you really want to change and set the new settings.

Correct way:
DCB dcbSerial = {0};
dcbSerial.DCBlength = sizeof(dcbSerial);
GetCommDCB(hSerial, &dcbSerial);
dcbSerial.BaudRate = CBR_19200;
dcbSerial.ByteSize = 8;
dcbSerial.StopBits = ONESTOPBIT;
dcbSerial.Parity = NOPARITY;
if(!SetCommState(hSerial, &dcbSerial)){
//error setting serial port state
} 

Change the specific field only and don't touch others if and only if you know what you are doing. This way can keep the previous settings.

Friday, January 23, 2009

Industrial serial-to-fiber converters


ICF-1150/1150I:
This is Moxa first IA form factor serial to fiber converter with rugged design. Support up to 921.6k baud rate and ADDC for RS-485 connection. With 3-way communication for easy troubleshooting and galvanic isolation, it is suitable for industrail environment.

Tuesday, January 20, 2009

Win32 TransmitCommChar trap

Sometimes my customers tell me they get trouble with TransmitCommChar. I try to tell you the story from driver side.

When you want to write data into COM port in Windows with C/C++, you will get 2 functions in SDK document: WriteFile and TransmitCommChar. If you only want to write one byte, most people will choose TransmitCommChar. Yes, it's easier than WriteFile. But I think this choice is not correct. 

TransmitCommChar is only "urgent" data and the char will be sent ahead of any pending data. In driver, it will only allocate one byte buffer for this function. When driver want to send any data, it will check urgent data buffer. If any, send it first. If there is any pending "urgent" data while calling this function, driver will return fail. That is, if you really want to use this function (just becuase WriteFile is too complicated...), you have to check the return value. If failed, you need to try again.

The "urgent" data concept is from UNIX. Sometimes you want to send "stop" or Xoff char to another side, you may this kind of function. So if you are not trying to send "urgent" data, don't use TransmitCommChar or you will get in trouble.

Wednesday, October 22, 2008

How to choose multiport serial board?


Moxa release a white paper about how to choose mulitport serial board. If you think this thing is easy, this white paper will tell you some facts. If you don't pay more attention on it, you system will become your nightmare. 

Choosing a Multiport Serial Board for Serial Communication

Sunday, October 19, 2008

Market Trend of RS232/422/485




Moxa releases a article about industrial serial communicaiton. If right now you think RS232/422/485 solution is old & obsolete and don't want to use it, maybe you should read it.

This article will tell you the real world idea about RS232/422/485 trend.  

Need Robust & Economic Industrial USB to RS232 solution?

The number 1 brand of USB to RS232 - Moxa, release robust & econmonic solution for USB to RS232.

Most the Industrial USB-RS232 converter in the world have the reliability issues, including hardware and software problems. Sometimes you get driver BSOD problem or sometimes your host can not detect your USB-RS232 conveter. Use Moxa UPort, you will never meet these problems.

Moxa industral grade UPort Family has the same quality level  which comes from Moxa 20 years experience on Multiport Serial Board Family.