It is currently Sun May 19, 2013 4:00 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: How can I set a non standard baudrate with PB ?
PostPosted: Sat Nov 05, 2011 1:07 am 
Offline
Addict
Addict

Joined: Sun Sep 07, 2008 12:45 pm
Posts: 1440
Location: Germany
Hi Mac OS X gurus,

yesterday I had the chance to test one of my programs on Mac OS X.
In general it works, but...
I have to open the serial port with a non standard baudraute.
The Linux method is not working :(
Code:
LinuxSerialInfo.serial_struct

ioctl_(Handle , #TIOCGSERIAL, @LinuxSerialInfo)

LinuxSerialInfo\flags | #ASYNC_SPD_CUST
LinuxSerialInfo\custom_divisor = LinuxSerialInfo\baud_base / Baud

ioctl_(Handle, #TIOCSSERIAL, @LinuxSerialInfo)

Any ideas :?:

I only found examples with IOSSIOSPEED in 'C', but no idea how I can use this
in combination with PB.

Hope somebody can help me.

Bernd


Top
 Profile  
 
 Post subject: Re: How can I set a non standard baudrate with PB ?
PostPosted: Sat Nov 05, 2011 8:42 am 
Offline
Addict
Addict

Joined: Sun Aug 08, 2004 5:21 am
Posts: 1084
Location: Netherlands
I think it should be something like this
Code:
#IOSSIOSPEED = $80045402

fileDescriptor = OpenSerialPort(0, "/dev/tty.Bluetooth-PDA-Sync", 300, #PB_SerialPort_NoParity, 8, 1, #PB_SerialPort_NoHandshake, 1024, 1024)

speed.l = 14400
If ioctl_(fileDescriptor, #IOSSIOSPEED, @speed) = -1
  Debug "error setting speed"
EndIf

but I'm not sure.
I guess only someone from the PB dev team can tell you the proper way to get the fileDescriptor .


Top
 Profile  
 
 Post subject: Re: How can I set a non standard baudrate with PB ?
PostPosted: Sat Nov 05, 2011 10:00 am 
Offline
Addict
Addict

Joined: Sun Sep 07, 2008 12:45 pm
Posts: 1440
Location: Germany
Hi Wilbert,

thanks for your reply. I hope that I can test this soon.
For the fd I use the following for Linux:
Code:
If SerialPort = #PB_Any
  Handle = SerialPortID(Port)
Else
  Handle = Port
EndIf
I think it is the same on the Mac.

Bernd


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye