len = cyg_io_read(ser_handle1, ucMasterRTURcvBuftmp, &len);//
len等于0,cyg_io_read读到的字节数在参数中的红色的len,而不是前面的len
cyg_io_read函数的说明中有:
Syntax:
Cyg_ErrNo
cyg_io_read(
cyg_io_handle_t handle,
void *buf,
cyg_uint32 *len
);
Parameters: handle—handle to the device.
buf—pointer to the buffer to store the data.
len—pointer to the size of data to receive. When the function returns, this parameter con-
tains the actual size of data received.
Description: Receive data from the device speci?ed by the handle parameter. If ENOERR is returned,
the write operation completed successfully. The actual number of bytes read is returned in
the len parameter.
cyg_io_read返回值是0,因为读到的字节长度在参数中
时间: 2024-11-05 13:46:38