com port question not PIC related

Say "hi" here, and any general non PIC related chat.

com port question not PIC related

Postby cncmachineguy » Thu Feb 26, 2015 11:37 pm

Hi Guys, Please realize I consider this a better group to ask than any other. This is not about a PIC, but still a weird COM port question.

I am working on a VB.NET program to communicate with COM port to talk to a RS232 to Bluetooth adaptor. This is the equipment given, so no room to change it. Here is what is happening:
I can't seem to get the device to respond. I can talk to a modem, and I can use a loop back plug and see what I send. So I assume I am actually talking through the port.

Using TeraTerm I can talk to the device. So I am sure it is working. Here is the strange part:

If I send the command BAUD=?, the device should respond with BAUD=9600bps. When I send it from my software I get nothing. If I then close mine and open teraterm, I will see my query (BAUD=?) and then also see the response (BAUD=9600bps).

I have even changed the baud rate in my app, and teraterm will show garbage.

I am sure you guys will need more info, but I am at a loss here. It is almost like my stuff is stuck in a buffer then when Teraterm connects it is sent out. BTW, all my settings are the same as in TeraTerm, 9600, 8N1, no flow control. TeraTerm is setup as VT100 terminal if that makes any difference. There is a switch on the device for DTE/DCE, could this be it?
-Bert
User avatar
cncmachineguy
 
Posts: 21
Joined: Sun Nov 16, 2014 8:52 pm
PIC experience: Professional 5+ years with MCHP products

Re: com port question not PIC related

Postby AussieSusan » Fri Feb 27, 2015 4:20 am

Some devices detect the end of a command using a "\r" and some with a "\n" (and some may require a "\r\n" or "\n\r".
Check to see how Teraterm passes the "enter" key (or whatever key you are using to end the command) and make sure that you use the same sequence with your app.
Susan
AussieSusan
Verified identity
 
Posts: 173
Joined: Mon Jun 16, 2014 4:45 am
PIC experience: Experienced Hobbyist

Re: com port question not PIC related

Postby Roche » Fri Feb 27, 2015 1:38 pm

It might be worth having a look around the control lines to see if anything is different.
Roche
 
Posts: 72
Joined: Fri Jul 11, 2014 12:35 pm
PIC experience: Professional 5+ years with MCHP products

Re: com port question not PIC related

Postby Joseph Watson » Fri Feb 27, 2015 5:42 pm

DTE/DCE selection refers to whether the device is to behave as Data Terminal Equipment (such as a PC) or Data Communications Equipment (such as a modem). For the most part, it determines whether a device sends on the TX line and receives on the RX line (terminal equipment) or vice versa (communication equipment). I would say that since the device seems to operate with TeraTerm, you have it in the correct position for your application.
NCR once refused to hire me because I was too short. I'm still waiting on my growth spurt.
User avatar
Joseph Watson
 
Posts: 49
Joined: Sat May 31, 2014 8:06 pm
Location: Ohio, USA
PIC experience: Experienced Hobbyist

Re: com port question not PIC related

Postby cncmachineguy » Sat Feb 28, 2015 1:03 pm

Thanks all for jumping in here!

Susans suggestion:
I have tried all manner of Cr, CrLf, Lr that I can find to try. none seem to be the answer. (TeraTerm seems to just be Cr)

Joseph you are correct about the DTE/DCE switch, it just is not the issue either.

Roche, about the control lines, would you mind elaborating on that a bit?

At this point I am feeling like this is a flow control issue maybe (control lines?), but that makes no sense to me as TT claims flow control is none. On the other hand the bt-232e-b claims flow control is enabled.
-Bert
User avatar
cncmachineguy
 
Posts: 21
Joined: Sun Nov 16, 2014 8:52 pm
PIC experience: Professional 5+ years with MCHP products

Re: com port question not PIC related

Postby drh » Sat Feb 28, 2015 4:23 pm

On the other hand the bt-232e-b claims flow control is enabled.


Is flow control enabled on your VB.NET program? And does it match the type of flow control on the Bluetooth module?
User avatar
drh
Verified identity
 
Posts: 61
Joined: Tue May 27, 2014 3:31 pm
Location: Hemet, Calif.
PIC experience: Professional 5+ years with MCHP products

Re: com port question not PIC related

Postby Roche » Sat Feb 28, 2015 7:40 pm

Sometimes DSR and DTR both need to be asserted - DSR from the modem and DTR from the terminal. Bit looking at the bt-232e-b link it doesn't mention them, but does mention RTS/CTS.
I just had a quick look at a com port with teraterm running with no flow control and RTS is high, asserted when teraterm opens the port. DTR performs identically.
Roche
 
Posts: 72
Joined: Fri Jul 11, 2014 12:35 pm
PIC experience: Professional 5+ years with MCHP products

Re: com port question not PIC related

Postby cncmachineguy » Sat Feb 28, 2015 9:51 pm

DRH, Seems like I have tried all manner of flow control, both hardware and software, but I will try hardware again as the manual does seem to indicate this may be needed.

Roche, I will try asserting both when I open my port and see if that works. seems like maybe it will do the trick as the instant I open the port with TT, stuff happens as if automatically.

I am not able to try anything until Monday at work, but happy to keep collecting ideas to try first thing.

Like someone once said, a failed attempt is not bad, just shows 1 more way it does not work.
-Bert
User avatar
cncmachineguy
 
Posts: 21
Joined: Sun Nov 16, 2014 8:52 pm
PIC experience: Professional 5+ years with MCHP products

Re: com port question not PIC related

Postby cncmachineguy » Tue Mar 03, 2015 12:30 am

Thanks to all the help guys, I was successful today in both talking to the local adapter and sending a program to the machine connected to the remote adapter. Had to get all the handshaking and end of line stuff correct.

Last issue I have is it seems I don't end the transmission correctly.

The machine (old Fanuc control) receives the program and acts normal. but if I put it in receive mode again to send another program, I get an error indicating the adapter is trying to send something. The way to clear it is cycle power on the remote adapter, then everything is all good.

So not sure about this, think I will email the manufacture and ask (don't have much hope there). My gut feeling is there is something I should be doing when the transmission is done like close the port or something.
-Bert
User avatar
cncmachineguy
 
Posts: 21
Joined: Sun Nov 16, 2014 8:52 pm
PIC experience: Professional 5+ years with MCHP products


Return to Introductions and general chat

Who is online

Users browsing this forum: No registered users and 8 guests

cron