• slider image 442
  • slider image 483
  • slider image 484
  • slider image 485
  • slider image 486
  • slider image 487
:::


Browsing this Thread:   1 Anonymous Users






Re: 101 FW HID
#2
中級會員
中級會員


查看用戶資訊
各位新進您好, 小弟現在又做了一個新的嘗試.

小弟寫了一個新模組, monitor(), 並運用此模組達到讀取LM73溫度的功能; 經驗證, 功能可以執行, 並正確無誤的讀出溫度.

現在小弟將此模組加在
\USB101_SW\MCHPFSUSB\fw\Hid\Ctrl_IO_AD_DEMO\user\user.c的void ProcessIO(void)中Emulate()之後,可是經過這一個動作後,USB 人性化介面裝置出現驚嘆號並且顯示裝置無法啟動。

請問各位先進指教一下小弟,看是小弟的程式哪裡出錯了。
謝謝。

void ProcessIO(void)
{
if((usb_device_state < CONFIGURED_STATE)||(UCONbits.SUSPND==1)) return;
Emulate_IO();
monitor();
}//end ProcessIO


void monitor(void)
{
_devices=0x90;

while(_devices<=0x94)
{
switch(_devices)
{
case 0x92 :
{
SetPointer(0x92, 0x0);
real_temp_2=Read_WORD_Data(0x92,0x0);
}// End case 0x92
break;
case 0x94 :
{
SetPointer(0x94, 0x0);
real_temp_3=Read_WORD_Data(0x94,0x0);
}// End case 0x94 :
break;
default :
{
SetPointer(0x90, 0x0);
real_temp_1=Read_WORD_Data(0x90,0x0);
}// End switch(_devices)
}// End while (real_temp_1 < def_temp_1 || real_temp_2 < def_temp_2 || real_temp_3 < def_temp_3)
}// End monitor()

發表於: 2008/4/10 16:03
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


101 FW HID
#1
中級會員
中級會員


查看用戶資訊
您好, 小弟現正研究USB101 FW, 並且期望在程式中加入PORTB高中斷的功能, 以下是我的程式碼, 請參考:

void main(void)
{
PORTBbits.RB5=1;
TRISBbits.TRISB5=1;

RCONbits.IPEN=1; // Enable Interrupt Priority bit
INTCONbits.GIEH=1; // Enable High Priority Interrupt
k=PORTBbits.RB5; // Read value of PORTB while initialing
INTCONbits.RBIF=0; // Clear PORTB change interrupt flag
INTCONbits.RBIE=1; // Enable High Priority Interrupt

InitializeSystem();
OpenLCD() ;
OpenPORTB(0xFF); // Turn on PORTB with Interrupt
//putrsLCD("PIC18F4550 Test") ;
j=0;
while (j<10 && !i)
{
j++;

itoa(j,LCD_String);
LCD_Set_Cursor(0,5);
putsLCD(LCD_String);

itoa(i,LCD_String);
LCD_Set_Cursor(0,10);
putsLCD(LCD_String);

for(l=0;l<3;l++) Delay10KTCYx(200); // Delay 1 second } // End while (j<30 && !SYS_POWER && !power_on)

if (j==10)
{
LCD_Set_Cursor(0,0);
putrsLCD("Sleeping");

Sleep();
} // End if (j==30)

while(1)
{
USBTasks(); // USB Tasks
ProcessIO(); // See user\user.c & .h
} //end while
}//end main

/* High priority interrupt
When getting button signle, PIC will send a pulse*/
#pragma code isrhighcode = 0x0008

void isr_high_direct(void)
{
_asm //begin in-line assembly
goto isr_high //go to isr_high function
_endasm //end in-line assembly
} // End isr_high_direct()
#pragma code

#pragma interrupt isr_high

void isr_high(void)
{
i=1;
k=PORTBbits.RB5;
INTCONbits.RBIF=0;
} // End isr_high()
#pragma code

現在問題是 : 倘若等到j數到10, 進入sleep mode之後再按RB5使其醒來, 在XP裡面可以認到USB裝置; 但是若是在j數到10之前按下RB5, 就會發生USB裝置無法辨識的情形, 請問這是什麼原因呢?
謝謝

發表於: 2008/4/8 17:55
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部







You can view topic.
不可以 發起新主題
You cannot reply to posts.
You cannot edit your posts.
You cannot delete your posts.
You cannot add new polls.
You cannot vote in polls.
You cannot attach files to posts.
You cannot post without approval.
You cannot use topic type.
You cannot use HTML syntax.
You cannot use signature.
You cannot create PDF files.
You cannot get print page.

[進階搜尋]


:::

Microchip連結

https://www.facebook.com/microchiptechnologytaiwan/
http://www.microchip.com.tw/modules/tad_uploader/index.php?of_cat_sn=13
https://mu.microchip.com/page/tmu
http://elearning.microchip.com.tw/modules/tad_link/index.php?cate_sn=1
https://page.microchip.com/APAC-PrefCenters-TW.html
http://www.microchip.com/
http://www.microchip.com/treelink
http://www.microchipdirect.com/
http://www.microchip.com.cn/newcommunity/index.php?m=Video&a=index&id=103
http://www.microchip.com.tw/modules/tad_uploader/index.php?of_cat_sn=2
http://www.microchip.com.tw/Data_CD/eLearning/index.html
http://www.microchip.com.tw/RTC/RTC_DVD/
https://www.microchip.com/development-tools/
https://www.youtube.com/user/MicrochipTechnology
[ more... ]

教育訓練中心

!開發工具購買
辦法說明 [業界客戶] [教育單位]
----------------------------------
!校園樣品申請
辦法說明 [教師資格] [學生資格]
----------------------------------