Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Programming a serial port

Programming a serial port
Thread Tools
Professional Poster
Join Date: Sep 2000
Location: San Francisco
Status: Offline
Reply With Quote
Mar 17, 2010, 11:34 AM
 
Hi all,
I'm having trouble programming a serial port. Long story, short: I'm trying to use a USB-Serial board to control a serial relay. I've installed the FTDI drivers and the USB-Serial board shows up in /dev as 'tty.usbserial-A6008501'. I can access the board using kermit by setting the baud rate to 9600 and turning off 'carrier watch'. But I really want to access it from the terminal or directly using C since I have written the control program in C. I can accomplish this by calling kermit from the C program, but this seems to introduce an intolerable lag (even though it is slight). I've tried using the following command, which is supposed to work from Linux:

echo -e 'xFF\x00\x01' > /dev/tty.usbserial-A6008501

but it just hangs. I've tried using the following to change the baud rate:

stty -f /dev/tty.usbserial-A6008501 9600

and then issuing the echo command but it still just hangs. I've also tried turning off the carrier detect using -mdmbuf or -clocal but the settings don't seem to stick. If I query using stty, neither of the flags is present.

Can someone give me a little help on this? Why can't I get the stty flags to stick and is there a way around it?

Thanks!
kman
     
kman42  (op)
Professional Poster
Join Date: Sep 2000
Location: San Francisco
Status: Offline
Reply With Quote
Mar 17, 2010, 11:34 AM
 
Ooops! I meant to put this in the dev forum. Sorry.
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 07:55 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2