* Sellecting the Serial port Number on Linux */ * "sudo" command to execute the compiled binary as super user. * 2) Linux will not allow you to access the serial port from user space,you have to be root.So use */ * " gcc -o serialport_read serialport_read.c " */ * 1) Compile the serialport_read.c file using gcc on the terminal (without quotes) */ * OS : Linux(x86) (Linux Mint 13 Maya)(Linux Kernel 3.x.x) */ * Commands : gcc -o serialport_read serialport_read.c */ * Program reads a string from the serial port at 9600 bps 8N1 format */ ![]() * Serial Port Programming in C (Serial Port Read) */ To be able to output the value I use the following code using termios libraries: /*=*/ ![]() Then if cat /dev/ttyUSB0 has been listening, I get the following output: -2.250416E-14A,+8.320175E+03,+0.000000E+00,of which the first number is the desired value. I am trying to write a simple application to read out a current value from a Keithley 6485 picoammeter, connected via serial communication (RS232USB) on linux.Ĭurrently, such a value can be retrieved by doing all the needed initialization of the device and sending "READ?" to it: echo "READ?" > /dev/ttyUSB0.
0 Comments
Leave a Reply. |