News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Serial Communications

Started by msmith, December 30, 2005, 05:06:33 AM

Previous topic - Next topic

zooba

Quote from: msmith on January 02, 2006, 10:26:10 PM
I put in the Sleep 0 you suggested an all is well as far as the process hogging is concerned. BTW, the CPU usage still shows 100%

Perhaps it needs to be Sleep 1 then. It's been a while since I've done any polling loops :U

Cheers,

Zooba

NPNW

mssmith,

QuoteThe machines output 1 to 2K data blocks of unsolicited data with no handshaking at 9600 Baud.

In some cases these machines are equipped with wireless transmitters which transmit to a "server" radio that then encodes their data into a 57600 KBaud stream. We then demultiplex this data stream to make it appear that the data came from 16 individual machines. In this case we use RTS/CTS

Do you have the physical specifications on the wire between the machine and the computer? Look at the pins on the incoming serial connection. Then find a serial block diagram. Then look at the serial connection on the machine or better yet find a manual. Check the pin out on the machine.
This should tell you what the physical wiring is connected for. That may be why the hyperterminal is having a problem if there is no physical connection on the pins.

Hope that helps.

msmith

zooba,

Sleep 1 also works and the CPU usage goes down to 7% (there are other processes running). Infact, I just went back and checked, and it is also 7% with my program not running.

According to MSDN, Sleep 1 sleeps for 1 MilliSecond and Sleep 0 exits and returns immediately if no higher priority processes are in need of a time slice. That explains why Sleep 0 keeps it at 100%.

While receiving data at 57600 baud, I'm not sure I want to be "blind" to incomming data for a whole MilliSecond, but it seems to work without losing data with Sleep 0 or Sleep 1.

Thank you very much for your help.

Mike

msmith

NPNW,

Quote
Do you have the physical specifications on the wire between the machine and the computer? Look at the pins on the incoming serial connection. Then find a serial block diagram. Then look at the serial connection on the machine or better yet find a manual. Check the pin out on the machine.
This should tell you what the physical wiring is connected for. That may be why the hyperterminal is having a problem if there is no physical connection on the pins.

Right now I'm just testing the code in my house using a laptop to simulate the Toyo machine (shooting captured shots).

My cable is a "five wire" cable with xmit/rcv crossed and rts/cts crossed.

If RTS were working as I had expected on Hyperterm and the RTS wire was mis-connected, it still should not transmit.

BTW, you really hit on something concerning the "physical specifications on the wire between the machine and the computer". In the real world, this is a huge problem. In our non wireless installations, we usually use Cat-5 cables with serial adaptors at the machines and a Comtrol Octa multiport comm boardon the server. With the machines being over 200 feet away and the large amount of electrical noise in the area, things are not always robust. Couple that with the work involved in putting in the cables, we have gone mostly to wireless. In that case, each press has a radio and the server has one special server radio that gives us a high speed stream of the composite data. We then decode and demultiplex that data so that the downstream process "thinks" it is recieving from 16 separate ports.

Thanks for your help.

Mike

NPNW

That brings up something. I have had problems with serial and laptops before. Please check your verison of laptop for serial problems. Sometimes they do not work properly. Can't remember specifics, but worth looking into. Also with the 5 wires. There can be interference or ground problems that I have seen. Do you have it running off of battery or AC power? If AC power check where you have it connected into? If its a strip outlet, please take it out and put it into the wall outlet. I have seen moving from different power outlets that will cure some problems with computers. While it may not show up with a laptop in other areas, the ground and or voltage problems can show up in transmitting data. Had a problem where a old External Gig drive would not save one file. Found out the file was a 100 meg file. When he went to save it the faulty power strip caused errors in the data stream. When he pluged it and the computer into a new outlet, power strip it worked fine. Also try restarting the laptop. Sometimes that works.


msmith

My laptop is running off of AC power and the comm port has always worked fine. It is working fine now except for the RTSCTS problem I am having. While it is true that I don't normally use RTS/CTS, I suspect that Hyperterm is using DSR/DTR for their handshaking. Their help and their web site don't say what they are using.

NPNW

Mike,
Just a shot. Good Luck.