Yeni Bir Cihaz Hazırladım.
Laptopta ve denediğin 3-4 pc de çalıştı gayet güzel. Ama Evdeki Pc de denediğinde çalışmadı sebebi neler olabilir acaba ?
Yok. Laptop da da çalışmıyor. Aslında Çalışıyor yanlız Bir Müddet Sonra Bağlantı Kopuyor.
Protonta UsbPoll gibi bir komut vardı swordfish de ne acaba ?
yardımı dokunur belki
http://digital-diy.com/forum/viewtopic.php?f=39&t=288 (http://digital-diy.com/forum/viewtopic.php?f=39&t=288)
Hocam Problemi Biliyorum yanlız Çözemiyorum.
Yaptığım Cihaz Keyboard. ama Bir müddet sonra kapatıyor suspend moda geçiyor. gerçi kesme transferde neden suspend moda geçer onuda anlamış değilim.
Usb sıkıntısı yüzünden C ye tam geçiş yaptım, alt komutları bulup çalıştırmak iyice problem haline gelmişti, verdiğim linkte aynı problemden dolayı SF de ki interrupt servisini kapatıp diğer işlemleri gerçekleştirmişler uzun zaman alan işlemlerde service fonksiyonunu direk çağırmışlar.
Kodlarınızda olmadığından dolayı tam birşey söylemekte mümkün değil malesef ama bağlantıyı canlı tutmak için her 2~10ms de bir "service()" komutunu kullanmanız gerekebilir.
SF ye yeni geçiş yaptım usb rutinleri için. Service rutuni çağırsak suspend moda grmez mi akşam deneyeyim.
Hocam Kodlar Aşağıda
{
*****************************************************************************
* Name : USB Keyboard demo.bas *
* Author : Nathan Herbert *
* Notice : Copyright (c) 2008 *
* : All Rights Reserved *
* Date : 03/02/2009 *
* Version : 1.1 *
* Notes : 1.0 First Revision *
* : 1.1 Updated to read back LED status *
* : 1.2 Now opens own wordpad window to show possibile uses *
*****************************************************************************
}
{
Up to 6 individual simultaneous keys can be pressed by using Keyarray 1 through 5
Alts, shift, ctrls etc are handled though modifer bytes. These can be combined by
ORing the required bytes together.
}
Device=18f2550
Clock = 48
// 20Mhz crystal, 48Mhz internal (FS USB)
Config PLLDIV = 5
Config CPUDIV = OSC1_PLL2
Config USBDIV = 2
Config FOSC = HSPLL_HS
Config VREGEN = ON
Config MCLRE=OFF
#option HID_BUFFER_SIZE = 8
#option USB_DESCRIPTOR = "HIDKeyboardDesc-1.bas"
Include "usbhid.bas"
Include "keyboarddefs.bas"
// Keyboard HID buffer
Structure TKeyReport
Modifier As Byte // Modifer Byte
Reserved As Byte // Reserved
KeyArray0 As Byte // Buttons Pushed
KeyArray1 As Byte
KeyArray2 As Byte
KeyArray3 As Byte
KeyArray4 As Byte
KeyArray5 As Byte
End Structure
Dim KeyReport As TKeyReport Absolute TXReportRAM
// Status LED structure
Structure TLedsReport
_byte As Byte
NumLock As _byte.0
capslock As _byte.1
ScrollLock As _byte.2
Compose As _byte.3
Kana As _byte.4
Const1 As _byte.5
Const2 As _byte.6
Const3 As _byte.7
End Structure
Dim LedsReport As TLedsReport Absolute RXReportRAM
{
********************************************************************************
* Name : SendKey *
* Purpose : Sends Key Report *
********************************************************************************
}
Sub SendKey(pKey As Byte, pModifier As Byte)
// Send desired key
KeyReport.Modifier = pModifier
KeyReport.Reserved = 0
KeyReport.KeyArray0 = pKey
KeyReport.KeyArray1 = 0
KeyReport.KeyArray2 = 0
KeyReport.KeyArray3 = 0
KeyReport.KeyArray4 = 0
KeyReport.KeyArray5 = 0
WriteReport
// Send Key Release
KeyReport.Modifier = 0
KeyReport.Reserved = 0
KeyReport.KeyArray0 = 0
KeyReport.KeyArray1 = 0
KeyReport.KeyArray2 = 0
KeyReport.KeyArray3 = 0
KeyReport.KeyArray4 = 0
KeyReport.KeyArray5 = 0
WriteReport
End Sub
{
********************************************************************************
* Name : Main *
* Purpose : Main Routine *
********************************************************************************
}
Sub Main()
DelayMS(100)
While true
If LedsReport.capslock=1 Then
Select PORTB
Case %11111110
SendKey(one,None)
Case %11111101
SendKey(two,None)
EndSelect
EndIf
If HID.DataAvailable Then
// Bring Report into structure
ReadReport
// Set LED 3 to show caps lock status
EndIf
Wend
End Sub
{
********************************************************************************
* Name : Program Start *
* Purpose : *
********************************************************************************
}
// Wait for USB attach
Repeat
Until HID.Attached
// Let PC finish enumerating
DelayMS(5000)
INTCON2.7=0
Main
evet şimdilik normal
while wend in arasına service () komutunu koyunca düzeldi.