I need help understanding data transfer through RS422.
i have been tasked developing application read , process data sent measurement device through rs422 serial interface. have been given following information:
1. baud rate, stop bits, parity , data byte size fixed , known.
2. 45 bytes of data sent every 50 ms.
3. clear breakdown of data within packets have been given.
the document given me mentions details (for example) byte 2 contains message id in int format. unsigned represents values 0 255.
this doubt begins. while talking tech lead, told such hardware devices sent data in hexadecimal format. in read function, allocating 2 bytes every byte of data assuming (for example) value 170 (0xaa) sent 'a' followed 'a', allocating byte each character. append them , convert string decimal 170.
for testing device using serial port emulator, have strong suspicions data sent in ascii format (a byte each character), might merely confirming wrong assumption.
i including read function has if clause might demonstrate confusion:
the document specifies each byte begin 0x1010 or 0x8080. have specified condition in way mentioned in code. buffer size set 90 rather 45 because of assumption.
can tell me if have understood whole thing wrong? glad clarify situation further if additional information needed.
the language c++ , appliaction developed using vc++
1. baud rate, stop bits, parity , data byte size fixed , known.
2. 45 bytes of data sent every 50 ms.
3. clear breakdown of data within packets have been given.
the document given me mentions details (for example) byte 2 contains message id in int format. unsigned represents values 0 255.
this doubt begins. while talking tech lead, told such hardware devices sent data in hexadecimal format. in read function, allocating 2 bytes every byte of data assuming (for example) value 170 (0xaa) sent 'a' followed 'a', allocating byte each character. append them , convert string decimal 170.
for testing device using serial port emulator, have strong suspicions data sent in ascii format (a byte each character), might merely confirming wrong assumption.
i including read function has if clause might demonstrate confusion:
code: [select]
dword nobytesread;
byte abbuffer[90];
cstring data;
if(readfile((m_hcomm),&abbuffer,90,&nobytesread,&overlap))
if(nobytesread==90)
{
data.empty();
data.append(lpctstr(abbuffer),nobytesread);
if(data.getat(0)=='1'&&data.getat(1)=='0'&&data.getat(2)=='1'&&data.getat(3)=='0'||data.getat(0)=='8'&&data.getat(1)=='0'&&data.getat(2)=='8'&&data.getat(3)=='0')
{
this->fnsetdata();
this->fndispdata();
}
else
{
data.empty();
}
}
the document specifies each byte begin 0x1010 or 0x8080. have specified condition in way mentioned in code. buffer size set 90 rather 45 because of assumption.
can tell me if have understood whole thing wrong? glad clarify situation further if additional information needed.
the language c++ , appliaction developed using vc++
i have been tasked developing application read , process data sent measurement device through rs422 serial interface. have been given following information:you going have inspect data.
1. baud rate, stop bits, parity , data byte size fixed , known.
2. 45 bytes of data sent every 50 ms.
3. clear breakdown of data within packets have been given.
the document given me mentions details (for example) byte 2 contains message id in int format. unsigned represents values 0 255.
this doubt begins. while talking tech lead, told such hardware devices sent data in hexadecimal format. in read function, allocating 2 bytes every byte of data assuming (for example) value 170 (0xaa) sent 'a' followed 'a', allocating byte each character. append them , convert string decimal 170.
for testing device using serial port emulator, have strong suspicions data sent in ascii format (a byte each character), might merely confirming wrong assumption.
i including read function has if clause might demonstrate confusion:code: [select]dword nobytesread;
byte abbuffer[90];
cstring data;
if(readfile((m_hcomm),&abbuffer,90,&nobytesread,&overlap))
if(nobytesread==90)
{
data.empty();
data.append(lpctstr(abbuffer),nobytesread);
if(data.getat(0)=='1'&&data.getat(1)=='0'&&data.getat(2)=='1'&&data.getat(3)=='0'||data.getat(0)=='8'&&data.getat(1)=='0'&&data.getat(2)=='8'&&data.getat(3)=='0')
{
this->fnsetdata();
this->fndispdata();
}
else
{
data.empty();
}
}
the document specifies each byte begin 0x1010 or 0x8080. have specified condition in way mentioned in code. buffer size set 90 rather 45 because of assumption.
can tell me if have understood whole thing wrong? glad clarify situation further if additional information needed.
the language c++ , appliaction developed using vc++
rs422 differential voltage 4 wire (actually 5) interface. use 2 max485's 1 hardwired transmit , 1 hardwired receive.
the data should in async serial format. start, b0,b1,b2,b3,b4,b5,b6,b7,b8,parity,stop
if true, hardware serial covert bit stream bytes.
ignore 'leads' hexadecimal format. if doc said byte 2 unsigned integer, not hexadecimal.
if said 45 bytes, means.
chuck.
Arduino Forum > Using Arduino > Networking, Protocols, and Devices (Moderator: fabioc84) > I need help understanding data transfer through RS422.
arduino
Comments
Post a Comment