реклама на сайте
подробности

 
 
> USB на ATtiny45 и с UART-ом
Oleg_IT
сообщение Oct 4 2007, 05:21
Сообщение #1


Знающий
****

Группа: Свой
Сообщений: 922
Регистрация: 3-06-05
Из: Москва
Пользователь №: 5 709



Не могу найти работающий проект на ATtiny45 AVR-USB с UART с использованием libusb. CDC с UART есть, i2c-tiny-usb есть, а в сочетании с UART нет. Помогите найти.
Go to the top of the page
 
+Quote Post
 
Start new topic
Ответов
bodja74
сообщение Oct 5 2007, 11:33
Сообщение #2


Знающий
****

Группа: Свой
Сообщений: 543
Регистрация: 22-10-05
Пользователь №: 9 984



Ну вот такое я использую у себя на васике ,для определения существующих ,точнее доступных на данный момент портов.

обьявляем
Код
Type DCB
    DCBlength As Long
    BaudRate As Long
    fBitFields As Long
    wReserved As Integer
    XonLim As Integer
    XoffLim As Integer
    ByteSize As Byte
    Parity As Byte
    StopBits As Byte
    XonChar As Byte
    XoffChar As Byte
    ErrorChar As Byte
    EofChar As Byte
    EvtChar As Byte
    wReserved1 As Integer
End Type

Type COMMCONFIG
    dwSize As Long
    wVersion As Integer
    wReserved As Integer
    dcbx As DCB
    dwProviderSubType As Long
    dwProviderOffset As Long
    dwProviderSize As Long
    wcProviderData As Byte
End Type


Declare Function GetDefaultCommConfig Lib "kernel32" _
    Alias "GetDefaultCommConfigA" (ByVal lpszName As String, _
             lpCC As COMMCONFIG, lpdwSize As Long) As Long

Public Function EnumSerPorts(port As Integer) As Long
    'this function returns non-zero value if the port exists
    Dim cc As COMMCONFIG, ccsize As Long
'
    ccsize = LenB(cc)     'gets the size of COMMCONFIG structure
'
    EnumSerPorts = GetDefaultCommConfig("COM" + Trim(Str(port)) + _
                                        Chr(0), cc, ccsize)
'
End Function


определяем ,передаем параметр номер порта ,если существует EnumSerPorts возвращает 1.

Код
If EnumSerPorts(5) = 1 Then menu_port_com5.Enabled = True
If EnumSerPorts(4) = 1 Then menu_port_com4.Enabled = True
If EnumSerPorts(3) = 1 Then menu_port_com3.Enabled = True
If EnumSerPorts(2) = 1 Then menu_port_com2.Enabled = True
If EnumSerPorts(1) = 1 Then menu_port_com1.Enabled = True
Go to the top of the page
 
+Quote Post

Сообщений в этой теме
- Oleg_IT   USB на ATtiny45 и с UART-ом   Oct 4 2007, 05:21
- - GDI   Чета я не понял , что надо то? CDC вас чем не устр...   Oct 4 2007, 07:40
- - Oleg_IT   CDC «анонимная» вещь. При смене USB порта меняется...   Oct 4 2007, 10:37
- - prottoss   Цитата(Oleg_IT @ Oct 4 2007, 13:21) Не мо...   Oct 4 2007, 11:08
- - GDI   По-моему смена COM порта при смене USB порта обход...   Oct 4 2007, 12:34
|- - prottoss   Цитата(GDI @ Oct 4 2007, 20:34) По-моему ...   Oct 4 2007, 12:46
|- - Oleg_IT   Цитата(prottoss @ Oct 4 2007, 16:46) Нет,...   Oct 5 2007, 06:19
|- - prottoss   Цитата(Oleg_IT @ Oct 5 2007, 14:19) А как...   Oct 5 2007, 11:17
|- - defunct   Цитата(prottoss @ Oct 5 2007, 14:17) ИМХО...   Oct 5 2007, 11:28
|- - prottoss   Цитата(defunct @ Oct 5 2007, 19:28) HKEY_...   Oct 5 2007, 11:41
- - GDI   VID и PID читаются с самого USB устройства, котор...   Oct 5 2007, 06:48
- - GDI   Нет, там появляются и USB-Serial порты, только вот...   Oct 5 2007, 12:36
|- - IceS   Цитата(GDI @ Oct 5 2007, 16:36) вроде как...   Oct 5 2007, 13:43
- - prottoss   Да, на самом деле появляется новый порт... Может б...   Oct 5 2007, 13:53


Reply to this topicStart new topic
1 чел. читают эту тему (гостей: 1, скрытых пользователей: 0)
Пользователей: 0

 


RSS Текстовая версия Сейчас: 19th July 2025 - 23:36
Рейтинг@Mail.ru


Страница сгенерированна за 0.01357 секунд с 7
ELECTRONIX ©2004-2016