Programming :: Communicate To RS232 Using Fstream?
Apr 1, 2009
I'm trying to attach an fstream to serial port for reading and writing with the following code:
Code:
#include <iostream>
#include <fstream>
#include <string>
[code]....
The code compiles without errors, but doesn't catch any input text from the device attached to RS232. I have tried it with Rx and Tx connected, but didn't receive my text back. It works OK if I substitute /dev/ttyS0 with an ordinary file, but any attempt to use /dev/ttyS0 seems to lead to an empty answer string. I tried this on a PC under Ubuntu Linux 7.10.
View 3 Replies
ADVERTISEMENT
Nov 29, 2010
I have included fstream in my file (#include <fstream>) In the file, I have a class declaration and a private variable static fstream fileStopWatch; Then I am getting the error "'fstream' does not name a type" It was working in gcc version 4.1.2 20080704 (Red Hat 4.1.2-48) but not working in gcc version 4.4.4 (GCC)
[Code].....
View 2 Replies
View Related
Jan 31, 2010
a)using notepad,prepare a text file with marks for 8 students on seperate lines. The program will then read this file and store all the marks into an array.
b)It will then calculate the average marks.
c)Finally, displays all the marks and average marks on the screen.
would you be kind enough to give me the workout solutions.
View 7 Replies
View Related
Jun 1, 2010
I have been working on writing a small rs232 driver like minicom for months. I am almost there, I have the interrupt service routine running, I can read() ok. However when I write(), it returns the number of characters written, 1, but nothing is actually written out the port. I researched termios, and they say that serial port programming is really messy in linux/unix.
I am probably not setting up the port parameters correctly, or my write() function is not doing what it is supposed to. As I said, write() is returning successful. Other comm programs run ok (picocom & gtkterm) on my hardware. I am running knoppix/debian on an ancient computer. I saw other guys using slackware.
View 14 Replies
View Related
Dec 16, 2009
I've started development on a ARM board. The ARM board displays it's command prompt through it's rs232 output. So I open putty/minicom (rs232 display) and can see and interact with the ARM linux system through my PC. The ARM root fs is on a USB pen, So I cross compile on my PC, then plug the pen into my PC copy the exe into the home/usr etc folder. Then unplug. plug it into the ARM boot the ARM and from my PC rs232 window can run the code. However plugging/unplugging is taking an age, I'm sure there must be a way to transfer the exe across the rs232. I've tried to use putty minicom to do so throught various methods xmodem etc but don't seem to be able to. I think I must have to do something on the ARM end but am unsure what?
View 7 Replies
View Related
Nov 29, 2010
I am writing a program to send data over serial port but the sending and reading operation is not occurring as desired to be... Below you can see the read and write parts. Could you please help me to find where I am doing wrong...
Reading Part:
Code:
#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <termios.h>
[code]....
When I compile and run the above programs Reading part does not read the 13 bytes once it first reads 8 byte then 8 again then 2 and so on. It always divides the sent data...
View 8 Replies
View Related
Aug 5, 2010
I want to send something through the serial port, for example
[code]...
the point here is send some numbers to a couple of 7 seg displays, so I will wire a RS232 chip on a protoboard, the logic after the RS232 is not an issue, but how can I assure the data is being sent right from my linux box to the RS232 chip, the one on the protoboard? Do I have to write a C program to read the strings and then send them to the serial port?For example if I wanted to send this to the displays:
[code]...
So I guess the simplest way is (Supposing I can deal with the stream so it is filtered and only display the number array) $ ifstat > /dev/ttyS0 But, how do I know if the RS232 will take them as the right characters?
View 3 Replies
View Related
Jan 5, 2011
I am trying to create a RS232 C program that executes a series of commands down the line to a robot. Everything seems to work fine, except any sequential write to the serial port. At first I thought it was the UART's buffer being filled too fast, but even with a 50 uS delay it still throws the error.
Here is my code:
Code:
#include <termios.h>
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/signal.h>
#include <sys/types.h>
[Code]...
View 1 Replies
View Related
Feb 24, 2009
I have a application in C++, and now I have two class. MyDialog is the class that main function launch. In MyDialog class there are four elements and when I click over theese elements, there is a MousePressEvent that launch other class, Touchpad class. So, in some moments, I have loaded two class. My question is, how can pass a value from Touchpad class to MyDialog class, when I close (destroy) Touchpad class. In a few words, is it possible to communicate values between class?
View 5 Replies
View Related
Jun 7, 2011
How to communicate between two threads using message queue?
View 4 Replies
View Related
Jan 3, 2011
I want to communicate between two threads, each belonging to a different process. Iam using message queues for this. I use mq_open()call. I created the queues with the same queue name starting with a '/'. But when I open the queue, the queue ID is different in both the process. What should I do so that both the process have the same queue ID?
View 1 Replies
View Related
May 13, 2010
I am trying to interface a machine (lock in amplifier) with Ubuntu using a RS 232(25pin) to USB cable. I wrote a program in c to interact with the machine. I think the machine is detected (after connecting the machine a file is created in folder /dev with name ttyusb1. I heard that ubuntu has all the header files required to interface with the port. with the help of a person i wrote this program (please see the attachment below.) but i don't know whether the commands are right or wrong. the program is compiled. but when i run the program it is getting stuck. i have to stop the program using Ctrl+z. if anyone knows these commands (how to write to or read from the port) please help me with this program.
View 6 Replies
View Related
May 18, 2010
been trying to use a rs232 device that uses the usb port. it calls for a virtual com port to be created. i am running on ubuntu 10 and get hella confused with the search results i have come across.some call for the usbdevfs which apparently doesn't exist under lucid. another had me do use some "magic" in getting it to work.they provided a script mountusbfs.sh
Code:
#
# Magic to make /proc/bus/usb work
#
mkdir -p /dev/bus/usb/.usbfs
[code]....
of course when i tried it the domount command doesn't exist so i modified the above script replacing the domount with mount and it seemed to do something things. usbview is specified as the determining factor whether or not you have the usbfs mounted properly. it wants to use proc bus and ubuntu doesn't use that anymore apparenlty. i have read that i need to enable a usbmon (flag?option?) in the kernel to be set. which it isn't when i followed the steps to check.
View 3 Replies
View Related
Feb 9, 2011
a few day ago i have checked my application and make rs232 cable converter to communicated it. And not detected, why? FYI, this is my lsusb command, but in my dmesg, was not found. check this out, (usualy there is another rows, just like ".....converted to ttyUSB0....")
View 1 Replies
View Related
Aug 6, 2010
I was able to write a script on Linux Shell for send and read data to a serial port. But I�m facing a problem now. If by any mean I send to de device anything else than the predefined strings, stated by the manufacturer, the device ceases to respond. The only way I found its to turn off and then turn on the thing again. Which its very impractical. Its there any way to "reset de UART chip on the device" or send some string based on the RS232 standard that clean the device buffer?
View 2 Replies
View Related
Apr 27, 2010
how to access serialport(RS232) data using OpenGL.Heard about SDL(Simple DirectMedia Layer),but didn't get how to use SDL and OpenGL to access RS232 data.
View 8 Replies
View Related
Jun 24, 2011
is possible to configure NTP server to transmit time with COM (RS232) port ????
View 1 Replies
View Related
Feb 10, 2011
I have 2 computers one of them ubuntu installed and on the other one windows(xp) installed.how they can communicate?like file sharing,printer sharing etc.?wat kind software or what i need?
View 3 Replies
View Related
Nov 19, 2010
How can I get two ip addresses to communicate with each other which are not in the same 255 range?
Like:
192.168.0.1
and
192.168.1.1
View 7 Replies
View Related
Dec 3, 2010
I'm using Fedora 9 and has finished the DHCP for my eth2 and static on eth0. I would like to add a route so that the 192.168.22.x eth0 and 192.168.26.x eth2 can communicate to each others,.
View 3 Replies
View Related
Oct 2, 2010
I am trying to set up a website from my ubuntu machine through IIS of windows server 2003. I am sharing the folder I want to store the files in across the network and all the computers are seeing it find.
The question is, how do I do this so it does not require a password to connect to it or give windows the permission without having to put them in every time.
I can get to my website, but it is asking for username and pass... I need that gone.
View 4 Replies
View Related
Aug 30, 2010
I previously used SSH to communicate between my two ubuntu PCs, but my new internet connection is far too slow for this method. Is there someway I can directly communicate between my two PCs using the router. Samba? moreover, my ip seems to be dyanamic through my internet, how can i change it to static? or will it not matter for Local area connections?
View 5 Replies
View Related
Oct 25, 2010
I have a wireless headset that I'm trying to charge through USB. When I connect it, it just doesn't charge. Looking at dmesg, the device isn't recognised, which is not surprising, since I think the USB port is only for charging, and it won't communicate over USB. lsusb also tells me that (apart from other things that are connected to the USB bus, that all of the 'MaxPower' variables are set to 0mA. So what I think is happening is I connect the headset ubuntu queries it, receives no reply, and so doesn't let the port draw any current. As far as I'm aware, there usually is some kind of OS handshaking like this, but it may vary from model of computer to model, so there's no point in saying "my <INSERT USB DEVICE HERE> charges". I am able to charge my MP3 player from the same port (because it's recognised), and I can charge the headset if I use a dumb mains->USB/5V transformer, but it should also work with my laptop. What I think I need is some way of manually setting the 'MaxPower' on the USB ports.
View 4 Replies
View Related
Dec 18, 2010
I am testing with Suse Linux Enterprise Server 10 in a VMWare environment. I've installed two SLES10 servers, named sles1 and sles2. I can't get the two servers to communicate, even a simple ping won't work. The "Network Adapter" in VMWare is set to "bridged", a setting which has worked fine when installing WinXP in VMWare and connecting to the Internet.Even if I ping sles1 from sles1 (= "pinging myself"), I get the same error message.Only if I ping localhost, I get a proper ping result.What did I do wrong? Did I forget to configure something?
View 2 Replies
View Related
Oct 12, 2010
I am setting up a small home print server running Fedora 13 (no gui). I setup Samba to have 1 file share and 1 printer. I can access both just fine in Windows network.
However when I try to print, nothing happens. I looked under Jobs in the Cups Web Interface and no job was ever created, so I suspect either Samba or CUPS isn't configured correctly. I am able to print a test page from CUPS directly.
smb.conf
Code:
Code:
View 2 Replies
View Related
Aug 17, 2010
Trying to install Debian 5050i-386 ISO Image. Part way through I get the following error message: The network autoconfiguration was successful. However, no default route was set: the system does not know how to communicate with hosts on the Internet. This will make it impossible to continue with the installation unless you have the first official Debian CD-ROM, a 'Netinst' CD-ROM, or packages available on the local network. Of course I discontinued the install. How does one set a default rout?
View 8 Replies
View Related
Oct 20, 2009
I downloaded and installed a new copy of Fedora 11 last week onto a new computer (hereafter "proximate"). I also have a remote computer without a monitor running an outdated version of Red Hat Linux (hereafter "remote"). To manage the processes on remote graphically, I ssh from proximate into remote; this connection succeeds without incident in transmitting text (including commands) between the two computers; however, the command "gnome-session" returns: (gnome-session:15789): Gtk-WARNING **: cannot open display:
(The numbers apparently represent the process identifier and vary from instance to instance.) A similar warning (and no accompanying graphics) occurs whenever I attempt to start any graphical user interface from remote via ssh from proximate. The issue almost certainly lies with proximate; remote successfully communicated graphics to the ancient box that proximate replaces.
Interestingly, I cannot communicate via ssh from remote to proximate (within a secure shell from proximate to remote). If I execute /usr/sbin/sshd on proximate as root, then I can login, but even then I cannot execute any commands.
Consider the following output:
If I execute ssh -vvv proximate from remote to proximate, then I get a lengthy output that ultimately ends with "debug1: Exit status 254."
What must I do to communicate both text and graphics among my computers?
View 3 Replies
View Related
Apr 16, 2011
I am having trouble connecting to my Garmin GPS unit, an eTrex Venture HC. I gather from all the resources I've checked that it my system is finding the GPS just fine, but I am unable to communicate with the device. Using gpsbabel, I get the following error:
I noticed that the gpsd service was disabled, so I enabled it, but that didn't seem to change anything.
(using Fedora 14)
lsusb:
dmesg:
View 1 Replies
View Related
Jul 18, 2010
I have two computers...Ubuntu server and Windows XP client. Both are connected to the internet using Ethernet. I have them connected directly using 1394 to increase speed of large transfers. The internet network and 1394 have different IP address scemes. Internet 192.168... 1394 10.0.0...
I am having problems getting the two computers to communicate with each other. I can ping the server's ip address and and it loops back. Same with the XP's IP address. I can't ping each other.
ifconfig shows my eth0 and eth1 connections are up. The eth1 Link Encap says UNSPEC.(Don't know if that means anything.)
View 2 Replies
View Related
Dec 5, 2010
Chili555 where are you?
I am running Ubuntu Release 10.04 (lucid), Kernel Linux 2.6.32-26-generic-pae, GNOME 2.30.2.
I have installed the ASUS USB-N13 according to your advice in previous posts, specifically, in your advice to 828688 Ben.
The dongle seems to be operating as it should. The LED does its flashing at what appears to be the correct time. Wicd also looks correct. Networks are found with good signals shown. Everything looks correct. But when I attempt to connect, "validating authentication" runs for quite some time, and eventually results in a dialogue window stating the communication failed. The required WEP password is entered in the RT2870STA.dat file, and again in the wicd window.
I have entered as much detail in the RT2870STA.dat file as I dare, and believe it to be correct.
ndiswrapper is not installed. Network Manager is uninstalled. Only wicd remains.
View 9 Replies
View Related