91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 201KB
    文件類型: .zip
    金幣: 2
    下載: 0 次
    發布日期: 2021-06-01
  • 語言: 其他
  • 標簽: MODBUS-RTU??

資源簡介

LINUX下的MODBUS-RTU驅動程序

資源截圖

代碼片段和文件信息

/*?		modbus_rtu.c?

???By?P.Costigan?email:?phil@pcscada.com.au?http://pcscada.com.au

???These?library?of?functions?are?designed?to?enable?a?program?send?and
???receive?data?from?a?device?that?communicates?using?the?Modbus?protocol.

???Copyright?(C)?2000?Philip?Costigan??P.C.?SCADA?link?PTY.?LTD.

???This?program?is?free?software;?you?can?redistribute?it?and/or?modify
???it?under?the?terms?of?the?GNU?General?Public?License?as?published?by
???the?Free?Software?Foundation;?either?version?2?of?the?License?or
???(at?your?option)?any?later?version.

???This?program?is?distributed?in?the?hope?that?it?will?be?useful
???but?WITHOUT?ANY?WARRANTY;?without?even?the?implied?warranty?of
???MERCHANTABILITY?or?FITNESS?FOR?A?PARTICULAR?PURPOSE.??See?the
???GNU?General?Public?License?for?more?details.

???You?should?have?received?a?copy?of?the?GNU?General?Public?License
???along?with?this?program;?if?not?write?to?the?Free?Software
???Foundation?Inc.?675?Mass?Ave?Cambridge?MA?02139?USA.





???The?functions?included?here?have?been?derived?from?the?
???Modicon?Modbus?Protocol?Reference?Guide
???which?can?be?obtained?from?Schneider?at?www.schneiderautomation.com.

???This?code?has?its?origins?with?
???paul@pmcrae.freeserve.co.uk?(http://www.pmcrae.freeserve.co.uk)
???who?wrote?a?small?program?to?read?100?registers?from?a?modbus?slave.
???
???I?have?used?his?code?as?a?catalist?to?produce?this?more?functional?set
???of?functions.?Thanks?paul.




*/

#include? /*?File?control?definitions?*/
#include? /*?Standard?input/output?*/
#include?
#include?
#include? /*?POSIX?terminal?control?definitions?*/
#include? /*?Time?structures?for?select()?*/
#include? /*?POSIX?Symbolic?Constants?*/
#include? /*?Error?definitions?*/
#include?“modbus_rtu.h“

//#define?DEBUG /*?uncomment?to?see?the?data?sent?and?received?*/


int?char_interval_timeout;



/*************************************************************************

???modbus_query(?packet?length)

Function?to?add?a?checksum?to?the?end?of?a?packet.
Please?note?that?the?packet?array?must?be?at?least?2?fields?longer?than
string_length.
**************************************************************************/

void?modbus_query(?unsigned?char?*packet??size_t?string_length?)
{
int?temp_crc;

/*?declaration?*/
unsigned?int?crc(unsigned?char?buf[]int?startint?cnt);



temp_crc?=?crc(?packet?0?string_length?);

packet[?string_length++?]?=?temp_crc?>>?8;
packet[?string_length++?]?=?temp_crc?&?0x00FF;
packet[?string_length?]?=?0;


}





/***********************************************************************

???send_query(?file_descriptor?query_string?query_length?)

Function?to?send?a?query?out?to?a?modbus?slave.
************************************************************************/

int?send_query(?int?ttyfd?unsigned?char?*query?size_t?string_length?)
{
int?write_stat;

#ifdef?DEBUG
int?i;
#endif

modbus_query(?

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件??????158036??1999-04-16?22:37??wes3.wav
?????文件??????287744??1999-05-02?20:47??vresume.exe
?????文件???????10459??2000-02-22?12:50??read_reg.c
?????文件???????23178??2007-05-10?21:33??modbus_tcp_c.htm
?????文件????????6346??2007-05-10?21:40??modbus_rtu.h
?????文件????????7173??2007-05-10?21:35??modbus_tcp.h
?????文件????????7378??2007-05-10?21:34??modbus_tcp.htm
?????文件???????22972??2007-05-10?21:36??modbus_tcp_c.c
?????文件???????23095??2007-05-10?21:40??modbus_rtu.c

評論

共有 條評論