ChangeIsConstant
Newbie level 2
- Joined
- Mar 26, 2015
- Messages
- 2
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1
- Activity points
- 26
I am trying to obtain the weights from a weighing scale KERN ew220-3nm to Arduino Uno through RS232.
This is the code :
As per the device manual, the complete transmitted output consists of 15 words, 1 start bit, 8 data bits(except 2-9 words which are data bytes and have maximum 6 characters), no parity, 2 stop bits.
This is the output obtained :
I have a few doubts -
1. Do the 2 stop bits as mentioned in the device manual disturb my complete data or is it ignored?
2. Whenever I print the incoming byte, does it print only the last byte or does it print some data from before along with the incoming data(if it is not a complete byte)?
3. Is the data to be read inversely due to the RS232 protocol of sending the LSB first?
4. The results include 16 or sometimes 17 words (which is basically not possible). The first word is 2BH or 20H and the last words as specified by the manual are CR and LF. But I cannot detect any output corresponding to that. Does that mean all of my output is some garbage data or do I need to decode it somehow?
Please help me with this. Thank you.
This is the code :
Code:
#include <SoftwareSerial.h>
SoftwareSerial mySerial(5, 4);
void setup()
{
Serial.begin(9600);
mySerial.begin(9600);
}
void loop()
{
while (mySerial.available()){
Serial.println(mySerial.read(),HEX);
}
}
As per the device manual, the complete transmitted output consists of 15 words, 1 start bit, 8 data bits(except 2-9 words which are data bytes and have maximum 6 characters), no parity, 2 stop bits.
This is the output obtained :
Code:
6A
9F
7C
F1
86
C6
1A
C6
46
19
43
97
43
15
79
EB
0
I have a few doubts -
1. Do the 2 stop bits as mentioned in the device manual disturb my complete data or is it ignored?
2. Whenever I print the incoming byte, does it print only the last byte or does it print some data from before along with the incoming data(if it is not a complete byte)?
3. Is the data to be read inversely due to the RS232 protocol of sending the LSB first?
4. The results include 16 or sometimes 17 words (which is basically not possible). The first word is 2BH or 20H and the last words as specified by the manual are CR and LF. But I cannot detect any output corresponding to that. Does that mean all of my output is some garbage data or do I need to decode it somehow?
Please help me with this. Thank you.