I have been running linux for 10 months now, decided to finally rid my life
of windows.
But I have a problem, a device which is accessed through the serial port
only had software for windows, so I am stuck without the ability to access
it.
I decided I might try to write something to access it myself, but I fell
flat on my face. I am using g++.
I have specs on how the port needs to be set so that the device can
understand the data being sent to it.
It requires a baud of 9600, data sent as 8 data bits, no parity, 1 stop
bit; abbreviated N81.
The device then needs 3 byte of data, to control devices, which are dasiy
chained off the device, which is connect to ttyS1 of my PC.
The first byte is a sync byte, of size 255, while the other two are bytes
that vary of size depending on what device needs to be controlled.
Here is my lame attempt:
#include <iostream>
#include <asm/io.h>
#define BAUDRATE B9600
#define OUTPORT "/dev/ttyS1"
#include <string>
#include <fstream>
using namespace std;
int main() {
int clear;
clear = char(255);
string data, data2;
ofstream out("OUTPORT");
cin >> data;
cin >> data2;
out << clear << data << data2 << endl;
// EOF//Quote:}
(When the program executed, i typed in data and data 2 by hand by using
alt + (numpad keys) to get char values)
If anybody good assist me, (I have looked through termios in man, and
almost everything regarding serial ports in man) it would be greatly
apperciated.
Regards,
Bob