[PIC®/AVR®/dsPIC®产品] 哪里有PIC18F14K50 上位机、固件资料???

[复制链接]
2737|7
 楼主| zhongs98 发表于 2015-1-6 09:02 | 显示全部楼层 |阅读模式
我使用PIC18F14K50设计了一款小板子,控制一些ADC,EEPROM等外设,用电脑来设置参数和采集数据;
硬件没问题,现在准备固件和上位机程序。

上官网找半天也没找到好点的资料介绍。

1. 关于固件,我应该在 void ProcessIO(void)里面添加我要读写的子程序吧?
现在使用的固件是"USB Device - MCHPUSB - Generic Driver Demo"

2. 关于DLL,我看demo中是用"mpusbapi.dll",我想用C#写界面调用该DLL,如何实现?

各位有没简单的firmware和上位机程序?能实现简单的初始化,读写数据。
相关的链接也行。

邮箱:zhongs98@163.com

第一次用PIC的USB芯片,问题有点弱,请见谅!

tihty 发表于 2015-1-6 09:14 | 显示全部楼层
PIC的USB芯片是指什么,我都是用的USB转串口
 楼主| zhongs98 发表于 2015-1-6 09:41 | 显示全部楼层
tihty 发表于 2015-1-6 09:14
PIC的USB芯片是指什么,我都是用的USB转串口

你好,可能我表述有误,
Datasheet描述是:"PIC18F/LF1XK50 20-Pin USB Flash Microcontrollers with nanoWatt XLP Technology"

tihty 发表于 2015-1-6 09:57 | 显示全部楼层
PIC18F/LF1XK50 没使用过
 楼主| zhongs98 发表于 2015-1-6 10:53 | 显示全部楼层
MicroLCD 发表于 2015-1-6 10:06
小 KS吧

:handshake
之前用过cypress的CY7C68013,
现在想用Microchip的,
能分享写经验或资料吗?谢谢~~
martin 发表于 2015-1-6 17:31 | 显示全部楼层
 楼主| zhongs98 发表于 2015-1-7 08:56 | 显示全部楼层
martin 发表于 2015-1-6 17:31
http://www.microchip.com/Developmenttools/ProductDetails.aspx?PartNO=DM163025
这里或许有你可以参考的 ...

谢谢,我下载看看~
 楼主| zhongs98 发表于 2015-1-9 08:13 | 显示全部楼层
  1.         const string DeviceVID_PID = "vid_04d8&pid_000c";
  2.         [DllImport("MPUSBAPI.dll", EntryPoint = "_MPUSBGetDLLVersion")]
  3.         public static extern int MPUSBGetDLLVersion();

  4.         [DllImport("MPUSBAPI.dll", EntryPoint = "_MPUSBGetDeviceCount", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi, ExactSpelling = true)]
  5.         public static extern int MPUSBGetDeviceCount(
  6.         [MarshalAs(UnmanagedType.LPStr)]StringBuilder pVID_PID);
  7.         [DllImport("MPUSBAPI.dll", EntryPoint = "_MPUSBOpen", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi, ExactSpelling = true)]
  8.         public static extern IntPtr MPUSBOpen(int instance,
  9.                                             [MarshalAs(UnmanagedType.LPStr)]StringBuilder pVID_PID,
  10.                                             char[] pEP,
  11.                                             int dwDir,
  12.                                             int dwReserved);
  13.         [DllImport("MPUSBAPI.dll", EntryPoint = "_MPUSBClose", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi, ExactSpelling = true)]
  14.         public static extern bool MPUSBClose(IntPtr handle);
  15.         [DllImport("MPUSBAPI.dll", EntryPoint = "_MPUSBRead", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi, ExactSpelling = true)]
  16.         public static extern int MPUSBRead(IntPtr handle,//input
  17.                                            byte[] pdata,//optput
  18.                                            int dwLen,  //input
  19.                                            ref int Plength,//output
  20.                                            int dwMilliseconds);//input
  21.         [DllImport("MPUSBAPI.dll", EntryPoint = "_MPUSBWrite", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi, ExactSpelling = true)]
  22.         public static extern int MPUSBWrite(IntPtr handle,//input
  23.                                             byte[] pData,//output
  24.                                             int dwLen,  //input
  25.                                             ref int Plength,//output
  26.                                             int dwMilliseconds);//input
  27.         [DllImport("MPUSBAPI.dll", EntryPoint = "_MPUSBReadInt", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi, ExactSpelling = true)]
  28.         public static extern int MPUSBReadInt(IntPtr handle,//input
  29.                                               UInt32[] pdata,//output
  30.                                               int dwlen,//input
  31.                                               Int32[] pLenght,//output
  32.                                               int dwMilliseconds);//input
  33.         IntPtr EP1INHandle, EP1OUTHandle;

C#调用VC6.0写的驱动MPUSBAPI.dll需要做一些转换才能使用
您需要登录后才可以回帖 登录 | 注册

本版积分规则

4

主题

129

帖子

2

粉丝
快速回复 在线客服 返回列表 返回顶部