求大神指点CH375
[DllImport("CH375DLL.dll")]
static extern IntPtr CH375OpenDevice(int i);//初始化
[DllImport("CH375DLL.dll", EntryPoint = "CH375ResetDevice")]
static extern bool CH375ResetDevice(ulong iIndex );//复位USB设备
[DllImport("CH375DLL.DLL", EntryPoint = "CH375ReadData", ExactSpelling = false, SetLastError = true)]
public static extern bool CH375ReadData(Int16 iIndex, [MarshalAs(UnmanagedType.LPArray)] byte[] oBuffer, [MarshalAs(UnmanagedType.LPArray)] Int32[] ioLength);//读单片机缓存
[DllImport("CH375DLL.DLL", EntryPoint = "CH375WriteData", ExactSpelling = false, SetLastError = true)]
public static extern bool CH375WriteData(Int16 iIndex, [MarshalAs(UnmanagedType.LPArray)] byte[] iBuffer, [MarshalAs(UnmanagedType.LPArray)] Int32[] ioLength); //写单片机缓存
[DllImport("CH375DLL.dll", EntryPoint = "CH375CloseDevice")]
static extern void CH375CloseDevice( // 关闭CH375设备
ulong iIndex);
private void button1_Click(object sender, EventArgs e)
{
CH375OpenDevice(0);//初始化(0为设备号)
byte[] str = new byte[20]; //用于开设单片机缓冲区
Int32[] len = new Int32[1];//读写长度
len[0] = 20;
str[0] = 6;str[1] = 4;str[2] = 1;//缓冲区写入值641
if (CH375WriteData(0, str, len))//写入单片机缓存
{
//读取刚才写入的数据
if (CH375ReadData(0, str, len))
{
string s = str[0].ToString();
string s2 = str[1].ToString();
string s3 = str[2].ToString();
if (s == "6" && s2 == "4" && s3 == "1")
{
MessageBox.Show("OK");
}
else
{
MessageBox.Show("ERROR");
}
}
}
}
这是网上的那段代码,为什么会在读的时候 死掉了呢?求指点
...全文
相关推荐
C# CH375 驱动库调用
C# 中调用CH375的动态链接库,实现USB通讯。
CH375单片机USB存储操作集成解决方案
本文还有配套的精品资源,点击获取 简介:"CH375子程序平台"为单片机开发人员提供了方便实现U盘读写功能的软件开发平台。该平台基于CRS公司设计的CH375 USB接口控制器芯片,支持USB 1.1规范,并提供全速数据传输。开发者可以在该平台上找到针对CH375芯片的驱动程序和API函数,通过这些子程序,单片机能够轻松完成对U盘的读写操作。此外,"CH375_ARM"压缩...
CH375WDM.rar_CH375W_CH375WDM.1NF_ch375_ch375wdm.SYS_ch375wdm.s
CH375的驱动,比较好的驱动学习代码。使用375的PCI设备均可以使用。
CH375WDM驱动
这是CH372和CH375的Windows98/ME/2000/XP简化版驱动程序, 仅供学习USB驱动开发 稍加修改完全可以用于其它USB芯片, 不过作者希望你是用于CH372和CH375芯片
CH375 驱动程序
CH375 驱动程序 C51 ARM avr msp430 各种单片机详尽开发代码


