Hi, I'm writting a program to send and receive data through a serial rs232 line.
In the future this program will comunicate with a modbus field device and be able to store data in a sql database.
Right now, i'm trying to figure out the MODBUS communication, i have tested CRC code implementation successfully, and i'm able to write and read from the serial line.
However, when i read from the serial line, i can't get unsigned char bytes in rtu mode. I can only get ascii charachters. ie. instead of getting 0x84 i get 0x04
When i write i dont get the same error.
Now, i don't think its the type of my variables what its causing the program to miss the most significative bit.
I made this test with good results:
~:make, and run './' the binary (lets call it "my program"), stopped "my program" and run minicom in the foreground, set the baudspeed, parity and number of bits in minicom, then stopped minicom, got my program to the foreground. After this my program received ok (0x84 is 0x84 ). !!!!
Im using this values for my flags:
termios.c_cflag = 0x9bd;
termios.c_ifalg = 1;
termios.c_lflag = 0;
termios.c_oflag = 0;
WHAT MAY BE CAUSING IT? , im going crazy here lol , please give me a hand.
I almost forgot: Excuse my english is very hard to translate after 28 hours of work. :P