hi guys
i need a program that can compare a value read from a com-port and one from the terminal.
can somebody help me???
using linux kernel 2.6.14-M5
can only use standard function in sh and bash...
hi guys
i need a program that can compare a value read from a com-port and one from the terminal.
can somebody help me???
using linux kernel 2.6.14-M5
can only use standard function in sh and bash...
# Set /dev/ttyS0 to 9600 baud, 8 bits(CS8), 1 stop bit(-cstopb)
stty -F /dev/ttyS0 9600 CS8 -cstopb
# Read a line from /dev/ttyS0
read VAL1 < /dev/ttyS0
# Read a line from stdin
read VAL2
echo "Serial port gave ${VAL1}"
echo "Terminal gave ${VAL2}"
if [ "$VAL1" = "$VAL2" ]
then
echo "Values are equal"
else
echo "Values are not equal"
fi
I'll need more detail from you about what's being read and how if you need more detail from me.
the info from the cm-port will now be read by another programm
the data can be an number or a string...
if it is a string than you have given the wrong command to the other programm so that also has to be filtered out...
sorry for given detail after you have done the work :s
By details I mean details, not nonanswers like "a number". Number in what format? ASCII? Binary? Hex? Does the whatever send carriage returns or newlines? What's on the serial port?
may be Hex
the value im getting from the serial port is ASCII and there is a newline at the end...
im getting my information from the com port from a fluke 45 dual display multimeter