
傳統要使用LabVIEW控制MCU的腳位,通常是使用UART或RS232介面,
因為對MCU而言應該是容易取得的通訊介面,
對LabVIEW而言,也都有子函數可用,
使用USB對LabVIEW而言並不是垂手可得,
fishark 發表在 痞客邦 留言(2) 人氣(1,498)

有一陣子沒寫這個計畫的進度了,
之前花了一段時間去弄懂Microchip USB範例程式的內容,
Microchip提供的範例程式通常是配合自家的開發版,
一個程式裡面會支援數顆MCU,所以程式會顯得複雜,不易懂,也不容易修改,
fishark 發表在 痞客邦 留言(0) 人氣(560)
在USB 資料Packet的傳輸中,
有兩個函數會被使用到, 分別是USBGenWrite()與USBGenRead(),
我們從help檔中分別來看這兩個函數,
1. 首先是USBGenWrite(),
fishark 發表在 痞客邦 留言(0) 人氣(437)

Microchip提供USB功能的MCU,
Microchip的libary提供許多USB的範例,
在範例中(USB Device - MCHPUSB - Generic Driver Demo)一開始就出現下列的程式碼:
#if defined(USB_INTERRUPT)
USBDeviceAttach();
#endif
while(1)
{
#if defined(USB_POLLING)
// Check bus status and service USB interrupts. USBDeviceTasks();
// Interrupt or polling method. If using polling, must call // this function periodically. This function will take care
// of processing and responding to SETUP transactions
// (such as during the enumeration process when you first
// plug in). USB hosts require that USB devices should accept
// and process SETUP packets in a timely fashion. Therefore,
// when using polling, this function should be called
// regularly (such as once every 1.8ms or faster** [see
// inline code comments in usb_device.c for explanation when
// "or faster" applies]) In most cases, the USBDeviceTasks()
// function does not take very long to execute (ex: <100
// instruction cycles) before it returns.
#endif
fishark 發表在 痞客邦 留言(0) 人氣(378)