Ana Tema => Basic Programlama Komut Kullanımı => Konuyu başlatan: dnaci - 28 Ocak 2012, 10:29:07
Başlık: pic18f4550 usb usart uygulaması sorunu
Gönderen: dnaci - 28 Ocak 2012, 10:29:07
Merhaba arkadaşlar, basicte usb ve usart uygulaması üzerinde çalışıyorum ancak bir problemle karşılaştım ve çözümü bir türlü bulamıyorum. Projeyi proton basic üzerinde geliştiriyorum, biliyorum burası pic basic pro ile ilgili bir forum ancak mantık aynı ikiside basic.
usb bağlantısı ve usart konusunda bir problemim yok, usart projesi geliştirebiliyorum. usb projeside, ancak ikisi bir arada iken usb bağlantım kopuyor, nasıl bir kodlama tavsiye dersiniz. veriyi nasıl buffera aktarabilirim. (kod ham koddur, hatalar olabilir, fikir vermesi için ekliyorum, hserin komutu pc ile programın bağlantısını koparıyor. projeyi gerçekte donanım üzerinde çalıştırıyorum)
' descriptor file, located in \inc\usb_18 - a copy ' is located in the same folder as this file USB_DESCRIPTOR = "picusbproject5desc.inc"
Symbol USBBufferSizeMax = 32 Symbol USBBufferSizeTX = 8 Symbol USBBufferSizeRX = 32
Dim USBBuffer[USBBufferSizeMax] As Byte
' some useful flags... Dim PP0 As Byte SYSTEM ' USBPOLL status return Symbol CARRY_FLAG = STATUS.0 ' high if microcontroller does not have control over the buffer Symbol ATTACHED_STATE = 6 ' is USB attached
' ************************************************************ ' * main program loop - remember, you must keep the USB * ' * connection alive with a call to USBPoll, USBIn or USBOut * ' * every couple of milliseconds or so * ' ************************************************************
' ************************************************************ ' * receive data from the USB bus * ' ************************************************************ DoUSBIn: USBIn 1, USBBuffer, USBBufferSizeRX, DoUSBIn Return