473,324 Members | 2,548 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

I have to unplug and plug my USB device every time to communicate :(

I am using a linux machine with an USB port and I have to communicate with a temperature controller which has an UART port and for this I am using a USB to UART Serial Adapter.
port name on my machine is /dev/ttyUSB0
Expand|Select|Wrap|Line Numbers
  1. $port = "/dev/ttyUSB0";
  2. open(SERIALPORT,"+>$port") || die("ERROR SENDING DATA\n");
  3. SERIALPORT->autoflush();
  4.  
  5. ## in between I am sending data 
  6.  
  7. print $FILEHANDLE $data;
  8.  
and receiving back from that temperature controller ##

after all that process I am closing that file handle.
Expand|Select|Wrap|Line Numbers
  1. close(SERIALPORT);
  2.  
code is working fine one time . I am getting correct result .

but when I am trying to run the script second time then it hands at the step when I am sending data to temperature controller
Expand|Select|Wrap|Line Numbers
  1.  
  2. print $FILEHANDLE $data;
  3.  
and for this I have to unplug and plug that USB serial adapter again.after that it is working fine.

I am unable to find out what is the problem.
Can u people figure out what may be the possible reasons for it.

Thanks for your reply in advance.
Aug 19 '09 #1
2 3091
KevinADC
4,059 Expert 2GB
@ashishchauhan
What is the filehandle you are using? Is it $FILEHANDLE or SERIALPORT
Aug 19 '09 #2
oh sorry . it is SERIALPORT .
Aug 20 '09 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: kamarudin samsudin | last post by:
Hi all, Im new to linux and very very new to python. But i have to write a program to communicate with a devide. The device will send a data after i send something to it. Any suggestion and...
2
by: Federico Caselli | last post by:
Is it possible write a program to communicate with an external device via bluetooth using visual basic .net (of course for windows xp sp1 or later)? I tryed to read MSDN library about...
1
by: Paul Tremblay | last post by:
Hi All, I am writing an application framework which consists of classes mainApp and childApp (parent, child resp). My intention is to make childApp a base class to be extended by applications...
6
by: Gary James | last post by:
This may not be a direct C# question, but since I'll be using using C# for development, I thought I'd pose the question here. I'll soon be involved in the design of a new software product that...
1
by: mundra | last post by:
Can anyone help me by letting me know if there are third party libraries which i can use to commincate between a desktop and a symbian device. I know how to communicate between the desktop and a...
0
by: Chris Herring | last post by:
I am writing a WinForms app that will integrate a handheld voting device system into the app. The handhelds communicate to the PC via a USB connection. The USB device has no manufacturer driver,...
1
by: Anoj | last post by:
Hi All, Is there any system event in .net through which it can be detected that a USB device is attached to the computer or deattched. If yes kindly help me with some sample code in C#? ...
1
by: Koichi | last post by:
Hi, I'm now making a plug-in for a CG software. I embed Python in a plugin and it works. The problem is that it conflicts with other plugins that also embeds Python because it runs in the same...
2
by: paridaG | last post by:
Hi Can any one help me ? I have connected a HID reader to my serial port. It is working fine through my c++ program. Is it possible to connect one more device to serial port and need to work...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.