Python Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesPython Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old December 2nd, 2012, 01:31 PM
rkn704 rkn704 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2012
Posts: 1 rkn704 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 55 m 27 sec
Reputation Power: 0
Newbie. Serial Data & COM Ports.

I want to monitor serial ASCI data arriving at a USB port via a RS232 to USB converter.


A number years ago I wrote a QBasic program on a PC with a genuine serial port to perform a similar task and used a command to prepare the port setting baud rate, data bits and timeouts etc

OPEN "com1:9600,N,8,1,cd0,cs0,ds0,op0,rs,tb512,rb512" FOR RANDOM AS #2

and the following would identify the arrival of data at the port and start the decoding subroutine.

ON COM(1) GOSUB READRX


I would like to create a similar program using Python but have not yet been able to find information regarding establishing the coms with external devices. As my pc does not have a 'genuine' serial port the solution must be able to work through the USB port and the RS232 converter.

Using Python on a Windows XP PC

Any help much appeciated.

Reply With Quote
  #2  
Old December 2nd, 2012, 02:59 PM
b49P23TIvg's Avatar
b49P23TIvg b49P23TIvg is offline
Contributing User
Dev Shed Loyal (3000 - 3499 posts)
 
Join Date: Aug 2011
Posts: 3,357 b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level) 
Time spent in forums: 1 Month 2 Weeks 3 Days 9 h 9 m 51 sec
Reputation Power: 383
I liked the abasic play command.

In python, you can try

with inf as open('com1','r'):[indent]inf.read(4) # read 4 bytes

I don't know how clever you'll need to be to make the code interrupt driven as your qbasic code probably was.
__________________
[code]Code tags[/code] are essential for python code!

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPython Programming > Newbie. Serial Data & COM Ports.

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap