USB Keyspan Serial Ports 
Author Message
 USB Keyspan Serial Ports

Hopefully one of you RB-wizards will find these questions trivial :-)

My test config is:
G4/867/OS 9.2/Realbasic 3.5.2
Keyspan Twinserial USB serial adapter w/ latest 1.8.4 drivers

Question #1: My first problem is I can't open either of the serial ports.
E.g.,

  Serialcontrol.port = 0 //printer port
  connected = Serialcontrol.open

returns False. Note that

  count = system.serialportcount

returns 2, and

    system.serialport(0).name = "USB Printer Port"
    system.serialport(1).name = "USB Modem Port"

the names I assigned to ports using Keyspan Assistant.

Note also that Zterm can open either port correctly. I'm suspecting that
Realbasic doesn't use the Communications Toolbox, but can't find any RB docs
on that. Suggestions?

Question #2: Is there some example RB code of a serial port application that
works with USB emulated serial ports? I've searched for 2 days, but no
success as yet.

Question #3: I'm writing a utility to communicate with a digital multimeter
(Protek 506) which handshakes on CR - i.e., host sends CR, meter replies
with <data value string>CR. This works fine on a PC using Hyperterminal for
testing. But Zterm displays <nil> of the Protek reply. I can partially
verify the connection, as the Protek status shows RX followed by TX each
time I send a CR character. The port specs are data/7, stop/2, baud/1200,
parity/none. What stumps me is the apparently <nil> reply. Any suggestions
why?

Many  thanks,

Steve Darden
s/v Adagio
Hobart, TAS 7001
Australia
http://www.*-*-*.com/



Thu, 29 Apr 2004 09:11:39 GMT  
 USB Keyspan Serial Ports
USB serial ports seem to work fine under both 9.x and 10.1 (maybe
earlier versions of 10 as well) udner Classic mode.

Here's something I sent to someone else who recently asked about using
the Keyspan ports under OSX, maybe it will help you out.

This code finds all the serial ports in the system, including USB
adapters:

    for i=0 to system.serialPortcount-1
      s=s+"Port "+str(i)+" = "+system.SerialPort(i).name+"
"+str(system.SerialPort(i).ratedSpeed)+"
"+str(system.SerialPort(i).maximumSpeed)+ chr(13)
      serialPopup.addrow system.SerialPort(i).name
    next
  end if

(sorry for the formatting, you will have to fix that)

I put this code in the Change routine of the popup menu for the serial
ports:

  serial1.close

  serialPort=serialPopup.listindex
  'serial1.port = serialPopup.listindex

  if serialPort < (serialPopup.ListCount-1) then
    serial1.serialport=system.serialPort(serialPort)
    if serial1.open then
      'msgBox "Ported opened"
    else
      msgbox "Failure to open serial  port!!"
    end if
  else

  end if

Hope that helps. It seems to work fine with the keyspan usb/serial
adapters under OSX 10.1

--
Chris Smolinski
Black Cat Systems
http://www.blackcatsystems.com/
Macintosh Softwware - Specializing in audio, educational, and amateur radio



Fri, 30 Apr 2004 00:44:15 GMT  
 USB Keyspan Serial Ports

Quote:

> Question #2: Is there some example RB code of a serial port application that
> works with USB emulated serial ports? I've searched for 2 days, but no
> success as yet.

The sample code in the online reference does so for me just fine.  I've
got a Keyspan USA-28X.

Cheers,
- Joe

--
,------------------------------------------------------------------.
|    Joseph J. Strout         Check out the Mac Web Directory:     |

`------------------------------------------------------------------'



Fri, 30 Apr 2004 04:04:49 GMT  
 USB Keyspan Serial Ports

Quote:

> I use this routine with a Keyspan all the time, and it works fine. Note
> that I could never get a serial communication to work with a
> instantiation of the serial control. The serial control has to be placed
> in a window.

Could that be because you're instantiating it as a local variable, and
then it goes out of scope and gets immediately destroyed?

Similar mistakes can be made with Socket and (in 4.0) Shell...

Cheers,
- Joe

--
,------------------------------------------------------------------.
|    Joseph J. Strout         Check out the Mac Web Directory:     |

`------------------------------------------------------------------'



Fri, 30 Apr 2004 04:05:55 GMT  
 USB Keyspan Serial Ports

Quote:

> Question #3: I'm writing a utility to communicate with a digital multimeter
> (Protek 506) which handshakes on CR - i.e., host sends CR, meter replies
> with <data value string>CR. This works fine on a PC using Hyperterminal for
> testing. But Zterm displays <nil> of the Protek reply. I can partially
> verify the connection, as the Protek status shows RX followed by TX each
> time I send a CR character. The port specs are data/7, stop/2, baud/1200,
> parity/none. What stumps me is the apparently <nil> reply. Any suggestions
> why?

A CR on a PC may not be CR on a Mac.

If you can get a protocol analyzer, see what is REALLY getting sent.

If you can hook a PC with Hyperterminal to a Mac serial port, see what
Zterm actually receives when you send CR from Hyperterminal

Esle, experimant -- try Sending:
 <CR><LF>
 <LF><CR>
 <CR><null>   (where <null> is the byte 0)
 <CR><LF><null>
 <LF><CR><null>

-- ward



Fri, 07 May 2004 03:47:54 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Keyspan usb-serial

2. Access serial (via USB) port in RealBasic - example source wanted

3. Sending data over serial port with USB adapter...

4. USB to serial port convertors

5. need to use serial port on usb G4

6. Mac USB to Serial port access

7. Problem recognizing USB to serial port adapter

8. Serial Error 0x4002 (Error 16386, character was lost by overwrite / serial port overrun error)

9. trouble with serial communication (serial port init.vi)

10. REQUEST: Serial port code for processing serial mouse data

11. Port I/O through serial port on sound card

12. Using Serial Port to send mouse actions to remote computers mouse port

 

 
Powered by phpBB® Forum Software