xxxx18一60岁hd中国/日韩女同互慰一区二区/西西人体扒开双腿无遮挡/日韩欧美黄色一级片 - 色护士精品影院www

  • 大小: 2.99M
    文件類型: .rar
    金幣: 1
    下載: 0 次
    發(fā)布日期: 2021-01-29
  • 語(yǔ)言: C/C++
  • 標(biāo)簽: 傳輸文件??串口??

資源簡(jiǎn)介

1、開發(fā)工具:VS2003及以上版本;

2、功能:計(jì)算機(jī)的串口傳輸文件;
3、編程語(yǔ)言:C語(yǔ)言;
4、實(shí)現(xiàn)過(guò)程:
    發(fā)送端:
step1:CreateFile函數(shù)打開串口COM1;設(shè)置通信方式為重疊模式;
step2:配置串口波特率,定義控制字DCB,對(duì)DCB結(jié)構(gòu)體中主要參數(shù),如波特率、數(shù)據(jù)位數(shù)、校驗(yàn)位、停止為數(shù)結(jié)構(gòu)參數(shù)進(jìn)行賦值;配置超時(shí),定義結(jié)構(gòu)體變量TIMEOUTS,對(duì)TIMEOUTS中的主要參數(shù)進(jìn)行賦值,完成間隔超時(shí)和總超時(shí)的定義;
step3:定義寫串口函數(shù)UartWrite();完成將用戶輸入發(fā)送到串口的工作;
step4:main函數(shù)中定義while循環(huán),不斷采集用戶的輸入。
同理,接受端的代碼結(jié)構(gòu)如下:
    發(fā)送端:
step1:CreateFile函數(shù)打開串口COM1;設(shè)置通信方式為重疊模式;
step2:配置串口波特率,定義控制字DCB,對(duì)DCB結(jié)構(gòu)體中主要參數(shù),如波特率、數(shù)據(jù)位數(shù)、校驗(yàn)位、停止為數(shù)結(jié)構(gòu)參數(shù)進(jìn)行賦值;配置超時(shí),定義結(jié)構(gòu)體變量TIMEOUTS,對(duì)TIMEOUTS中的主要參數(shù)進(jìn)行賦值,完成間隔超時(shí)和總超時(shí)的定義;
step3:定義寫串口函數(shù)UartRead();完成將從串口讀取數(shù)據(jù)的工作;
step4:main函數(shù)中定義while循環(huán),讀取串口數(shù)據(jù)。
5、操作說(shuō)明:
step1:打開serialrev.exe,點(diǎn)擊任意鍵,建立讀串口;
step2:打開serialtrans.exe,窗口顯示“串口創(chuàng)建成功”,然后輸入字符,回車,發(fā)送數(shù)據(jù)。
step3:觀察serialrev.exe窗口的變化,此時(shí)會(huì)顯示接受到的數(shù)據(jù)。

代碼片段和文件信息

/*?serrecv.c?*/
/*?Receives?and?saves?a?file?over?a?serial?port?*/
/*?Last?modified:?Septemeber?21?2005?*/
/*?http://www.gomorgan89.com?*/

#include?
#include?
#include?

/*?Function?to?print?out?usage?information?*/
void?usage(void);

/*?Function?to?set?up?the?serial?port?settings?with?the?specified?baud?rate
???no?parity?and?one?stop?bit?*/
void?set_up_serial_port(HANDLE?h?long?baud);

/*?Function?to?receive?and?save?file?from?serial?port?*/
void?get_file_from_serial_port(HANDLE?h?char?*file_name?unsigned?long?file_length);

int?main()
{
HANDLE?serial_port; /*?Handle?to?the?serial?port?*/
long?baud_rate?=?9600; /*?Baud?rate?*/
char?port_name[]?=?“COM5:“; /*?Name?of?serial?port?*/
unsigned?long?file_size; /*?Size?o

?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----

?????文件??????19659??2016-03-30?12:13??uart_trans\Debug\sertrans.obj

?????文件??????????0??2016-03-30?12:13??uart_trans\Debug\sertrans.sbr

?????文件?????????20??2016-03-30?12:08??uart_trans\Debug\test_file.txt

?????文件????1926144??2016-03-30?12:13??uart_trans\Debug\uart_trans.bsc

?????文件?????192570??2016-03-30?12:13??uart_trans\Debug\uart_trans.exe

?????文件?????212056??2016-03-30?12:13??uart_trans\Debug\uart_trans.ilk

?????文件????4475960??2016-03-30?12:13??uart_trans\Debug\uart_trans.pch

?????文件?????418816??2016-03-30?12:13??uart_trans\Debug\uart_trans.pdb

?????文件?????132096??2016-03-30?12:13??uart_trans\Debug\vc60.idb

?????文件??????77824??2016-03-30?12:13??uart_trans\Debug\vc60.pdb

?????文件???????5984??2016-03-30?22:30??uart_trans\sertrans.cpp

?????文件???????4334??2016-03-30?12:10??uart_trans\uart_trans.dsp

?????文件????????526??2016-03-30?12:10??uart_trans\uart_trans.dsw

?????文件??????41984??2016-03-30?22:55??uart_trans\uart_trans.ncb

?????文件??????48640??2016-03-30?22:55??uart_trans\uart_trans.opt

?????文件???????1445??2016-03-30?12:13??uart_trans\uart_trans.plg

?????文件??????18515??2016-03-30?12:35??uart_recv\Debug\serrecv.obj

?????文件?????????20??2016-04-14?19:37??uart_recv\Debug\test_file.txt

?????文件?????192568??2016-03-30?12:35??uart_recv\Debug\uart_recv.exe

?????文件?????242712??2016-03-30?12:35??uart_recv\Debug\uart_recv.ilk

?????文件????3561080??2016-03-30?10:45??uart_recv\Debug\uart_recv.pch

?????文件?????541696??2016-03-30?12:35??uart_recv\Debug\uart_recv.pdb

?????文件?????132096??2016-03-30?12:35??uart_recv\Debug\vc60.idb

?????文件??????77824??2016-03-30?12:35??uart_recv\Debug\vc60.pdb

?????文件???????5653??2016-03-30?12:34??uart_recv\serrecv.cpp

?????文件???????4318??2016-03-30?10:46??uart_recv\uart_recv.dsp

?????文件????????524??2016-03-30?10:44??uart_recv\uart_recv.dsw

?????文件??????41984??2016-03-30?12:40??uart_recv\uart_recv.ncb

?????文件??????48640??2016-03-30?12:40??uart_recv\uart_recv.opt

?????文件???????1278??2016-03-30?12:35??uart_recv\uart_recv.plg

............此處省略8個(gè)文件信息

評(píng)論

共有 條評(píng)論

相關(guān)資源