Форум » » Помогите пожалуйста с XSIG для Arduino » Ответить

Помогите пожалуйста с XSIG для Arduino

p.vladi: Доброе время суток! Купил у Китайцев ящичек таких вот микроконтроллеров. Для своей нужды они оказались более чем полезные, особенно учитывая их цену. Основано на ATmega328 Питание 5В, скорость 16 МГц, размер 33мм на 18мм. Самое главное - цена, <$4... Внимание вопрос! У меня есть мечта написать маленький интерфейс между Arduino и Crestron - символ XSIG. Может уже кто-то разбирался с XSIG (для AMX, например) Вот описание протокола из помощи: [quote] Digital data is encoded in a 2-byte (16-bit) format, as follows: 1 0 C # # # # # 0 # # # # # # # 15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00 (Bit Position) Where bit 15 (the most significant bit) is set to 1 and bit 14 is set to 0, denoting the start of new digital data. Bit 13 is set to the complement of the signal state. That is, if the signal is high, C equals 0; if the signal is low, C equals 1. Bit 7 (the high-order bit of byte 2) is set to 0. The 12-bit index of the signal (identified by # signs) is spread out over bytes 1 and 2, with leading zeros used as fills. For example, consider a digital signal at index 14 (binary 0000 1110) that goes low. Following the format just described, the data would be sent as: 1 0 1 0 0 0 0 0 0 0 0 0 1 1 1 0 15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00 (Bit Position) Analog data is encoded in a 4-byte (32-bit) format, as follows: 1 1 A A 0 # # # 0 # # # # # # # 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 (Bit Position) 0 A A A A A A A 0 A A A A A A A 15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00 (Bit Position) Where bit 31 (the most significant bit) and bit 30 are both set to 1, denoting the start of new analog data. Bit 27 is set to 0, as are bits 23, 15, and 7 (the high-order bits of each byte). The 16-bit analog value of the signal (identified by red "a" letters) is spread out over bytes 1, 3 and 4, with leading zeros used as fills. The 10-bit index of the signal (identified by # signs) is spread out over bytes 1 and 2, with leading zeros used as fills. For example, consider an analog signal at index 9 (binary 0000 1001) with a value of 233 (binary 1110 1001). Following the format just described, the data would be sent as: 1 1 0 0 0 0 0 0 0 0 0 0 1 0 0 1 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 (Bit Position) 0 0 0 0 0 0 0 1 0 1 1 0 1 0 0 1 15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00 (Bit Position) Unlike digital and analog data, which is encoded in a format of fixed length, serial data can be of variable length and is encoded as follows: Bytes 1 and 2 1 1 0 0 1 # # # 0 # # # # # # # Serial data bytes (up to 252) d d d d d d d d ... ... ... Low-order Byte: 1 1 1 1 1 1 1 1 Where the five high-order bits are set to 1-1-0-0-1, denoting the start of new serial data. The high-order bit of byte 2 is set to 0. The 10-bit index of the signal (identified by # signs) is spread out over bytes 1 and 2, with leading zeros used as fills. This is followed by up to 252 bytes of serial data (identified by the "d" letters). Finally, the low-order byte is set to FFh (binary 1111 1111) denoting the end of the serial data. [/quote]

Ответов - 3

gosha: Так а в чем, собственно, загвоздка?

p.vladi: gosha пишет: Так а в чем, собственно, загвоздка? Мозжичка не хватает на C++ написать :-( Вот и спрашивал, вдруг кто на AMX делал

gosha: А зачем вообще такие сложности? Сделайте свой собственный протокол, со стороны крестрона - обычный COM-порт/Serial IO, со стороны Ардуины - ну придется свой скетч написать. И отнюдь не на C++




полная версия страницы