47755 (588501), страница 18

Файл №588501 47755 (Обеспечение всемирной трансляции спортивных шахматных соревнований с применением разработанного в ходе проекта законченного программного продукта) 18 страница47755 (588501) страница 182016-07-29СтудИзба
Просмтор этого файла доступен только зарегистрированным пользователям. Но у нас супер быстрая регистрация: достаточно только электронной почты!

Текст из файла (страница 18)

Only at this pointer location, data can be written, incrementing the pointer.

The written data always overwrites the oldest data.

In this buffer, sequentially messages are written. The messages are of various

length, from 1 byte to 5 bytes, specific for every message.

Various events generate a message that is written in the storage, in the

sequence as the events occur. When the buffer is downloaded and read, the event

messages can be found, starting with the oldest event, and the latest event in

the end of the buffer, followed by EE_EOF.

- At power-on, three tags EE_NOP are written, followed by a one-byte

EE_POWERUP message.

After this, an UPDATE_BOARD message is written (in virtually random sequence)

for every piece that is found on the board, at power-on.

When the board is equipped with a watchdog timer, and the watchdog times out,

an EE_WATCHDOG_ACTION is written and after that, the above described power-up

procedure takes place.

- When at any time a normal starting position for chess is found, with the

player for white having the board connector on his left hand, an EE_BEGINPOS tag

is written, and an EE_BEGINPOS_ROT tag is written when white has the

connector at his right hand (rotated)

- When 16 chess figures are found on the board, all in the A, B, G and H row,

which are not(!) in a normal chess starting position, the one-byte

EE_FOURROWS message is written, to be tolerant on erroneous placement and i.e. to be able to play the "Random Chess" as proposed by Bobby

Fischer. The exact position of the pieces has to be analyzed on the context: or found in the previous piece move messages, or found in the

coming piece move messages.

When an empty board is detected, the one-byte EE_EMPTYBOARD message is

written.

The above described detection of begin positions or empty-board has a certain

hysteresis: only after more than two pieces have been out of the begin

positions the search for begin positions is restarted, resulting in possibly

new tag writing. This to avoid flushing the buffer full with data, only because

of one bad positioned and flashing piece.

When the data of the internal storage are sent upon reception of the

DGT_SEND_EE_MOVES command, the one-byte EE_DOWNLOADED message is sent

On every detected change of piece positions this change is written to EEPROM

in a 2-byte message, which cover exactly the same data as is sent to the PC

in the UPDATE_BOARD mode.

The formatting of the 2-byte piece update tag is:

First byte: 0t0r nnnn (n is piece code, see before)

(piece code EMPTY when a piece is removed)

(t is recognition bit, always 1)

(r is reserved)

so the first byte of this tag is always in the

range 0x40 to 0x5f

Second byte: 00ii iiii (i = 0 to 63 (0x3f), the field number as

defined before)

NB: when one piece only is changing, the new value is overwrites the

piece update field described above, instead of generating a new message

in the internal storage.

The same kind of optimization is included for begin-position tags:

a EE_BEGINPOS or EE_BEGINPOS_ROT or EE_FOURROWS is not written, when

between the previous written tags and the new occurence of the begin-

situation only 2 or 1 piece were out of the tagged beginsituation.

On the pressing of the clock, the time of the halted clock is written in

a time message. It might be that when the moves are done very fast, the

storage is skipped. Note: the two clock sides are identified only by

left and right side of the clock: When the board is swapped, the clock

data are not (!) swapped.

The clock data are written on tumbler position change, so at the beginning

of the game, the game starting times will be lost.

Format of a three-byte time message:

First byte: 0uuf hhhh (f=1 for time in left clock screen, seen from the front)

( hhhh: hours, valued 0 to 9)

(uu recognition bits, both 1, so byte 0 has the

( value range of 0x60 to 0x69, or 0x70 to 0x79)

Second byte: 0MMM mmmm (MMM: Tens of minutes (range 0 to 5),

(mmmm: minute units, range 0 to 9)

Third byte: 0SSS ssss (SSS: tens of seconds, range 0-5)

(ssss: seconds units, range 0-9)

On the recognition of the first byte of a message: The above definitions

imply that the first byte of a message is always ranged

from 40-5f for a field change message, 60-69 or 70-79 for a time message,

and 6a to 6f, or 7a to 7f for a 1-byte message.

(all values hexadecimal)

*/

/* Definition of the one-byte EEPROM message codes */

#define EE_POWERUP 0x6a

#define EE_EOF 0x6b

#define EE_FOURROWS 0x6c

#define EE_EMPTYBOARD 0x6d

#define EE_DOWNLOADED 0x6e

#define EE_BEGINPOS 0x6f

#define EE_BEGINPOS_ROT 0x7a

#define EE_START_TAG 0x7b

#define EE_WATCHDOG_ACTION 0x7c

#define EE_NOP 0x7f

/* 7d and 7e reserved for future use*/

/*

Notes on the communication dynamics:

The squares of the board are sampled one by one, where a full scan takes

about 200-250 ms. Due to this scan time, it can be, that a piece that is

moved from square e.g. A2 to A3 can be seen on both squares, in the same

scan. On a next scan of course, the old position is not seen anymore.

When in UPDATE mode, this means, that the information on changes on the

squares can come in opposite sequence: first the new occurence is reported,

then the clearing of the old position is sent.

When a piece B on C4 is taken by piece A on B3, it can be that the following

changes are reported:

A on C4

Empty on B3

(and Empty on C4 is never seen)

An other extreme situation can occur e.g. when a queen on C1 takes a pawn

on C4. The reported changes can be (in sequence):

Empty on C4 (the pawn is taken by one hand)

Queen on C2

Queen on C3

Empty on C1

Empty on C2

Queen on C4

Empty on C3

For writing software it is important to take these dynamics into account.

Some effort needs to be made to reconstruct the actual moves of the pieces.

See also the programmers and users manual

Paragraph: Bus communication protocol

-------------------------------------

Differencens between busmode and single board mode:

* In bus mode, RS232 input and RS232 output are connected to all boards.

The RS232 output of the board is configured as a pull-up driver: with a

pull-down resistor on the RS232 pull-up line. Now all boards receive all

commands from the computer, and can all send data to the computer.

* In single board mode the board has a small incoming commands

buffer (10 bytes).

* The bus mode has only a one-command incoming commands buffer

* When entered in single board mode, the board status always switches to IDLE:

changes are not send automatically

Bus mode is default power up mode of the board. The board recognises

bus commands from the start.

However, single board commands are recognised and answered.

The board switches to single board mode on the moment, a single board

command is recognised. Switching back to bus mode is invoked by the

extra command DGT_TO_BUSMODE or by sending a busmode command. (NB This

busmode command causing the swithing is not processed!)

For all detailed hardware descriptions: call.

*/

/* one added functon for swiching to busmode by command: */

#define DGT_TO_BUSMODE 0x4a

/*

This is an addition on the other single-board commands. This command is

recognised in single-board mode. The RS232 output goes in

pull-up mode and bus commands are immediatly recognised hereafter.

Note that when the board is in single-board mode, and eventually a bus

mode command is found, this command is not processed, but the board

switches to bus mode. The next (bus) command is processed regularly.*/

/* Bus mode commands: */

#define DGT_BUS_SEND_CLK (0x01 | MESSAGE_BIT)

#define DGT_BUS_SEND_BRD (0x02 | MESSAGE_BIT)

#define DGT_BUS_SEND_CHANGES (0x03 | MESSAGE_BIT)

#define DGT_BUS_REPEAT_CHANGES (0x04 | MESSAGE_BIT)

#define DGT_BUS_SET_START_GAME (0x05 | MESSAGE_BIT)

#define DGT_BUS_SEND_FROM_START (0x06 | MESSAGE_BIT)

#define DGT_BUS_PING (0x07 | MESSAGE_BIT)

#define DGT_BUS_END_BUSMODE (0x08 | MESSAGE_BIT)

#define DGT_BUS_RESET (0x09 | MESSAGE_BIT)

#define DGT_BUS_IGNORE_NEXT_BUS_PING (0x0a | MESSAGE_BIT)

#define DGT_BUS_SEND_VERSION (0x0b | MESSAGE_BIT)

// extra return headers for bus mode:

#define DGT_MSG_BUS_BRD_DUMP (0x03 | MESSAGE_BIT)

#define DGT_MSG_BUS_BWTIME (0x04 | MESSAGE_BIT)

#define DGT_MSG_BUS_UPDATE (0x05 | MESSAGE_BIT)

#define DGT_MSG_BUS_FROM_START (0x06 | MESSAGE_BIT)

#define DGT_MSG_BUS_PING (0x07 | MESSAGE_BIT)

#define DGT_MSG_BUS_START_GAME_WRITTEN (0x08 | MESSAGE_BIT)

#define DGT_MSG_BUS_VERSION (0x09 | MESSAGE_BIT)

// extra defines for bus length info:

#define DGT_SIZE_BUS_PING 6

#define DGT_SIZE_BUS_START_GAME_WRITTEN 6

#define DGT_SIZE_BUS_VERSION 8 // was 6 up to version 1.2

/* Definition of different commands&data

All commands DGT_BUS_xx have the following format:

byte 1: command, i.e. DGT_BUS_SEND_BDR (D7 always 1)

byte 2: MSB of addressed board (D7 always 0)

byte 3: LSB of addressed board (D7 always 0)

byte 4: checksum: this is the sum of all bytes from start of the message

upto the last byte before the checksum. (D7 always 0)

I.e. message code 0x81 0x10 0x06 will carry checksum byte 0x17

DGT_BUS_SEND_CLK

asks for clock information of addressed board.

Will result in a DGT_MSG_BUS_BWTIME message from the board.

DGT_BUS_SEND_BRD

asks for a board dump of addressed board.

Will result in a DGT_MSG_BUS_BRD_DUMP message from the board.

DGT_BUS_SEND_CHANGES

asks for all stored information changes from the moment of the last

DGT_BUS_SEND_CHANGES. Will result in a DGT_MSG_BUS_UPDATE message from

the board.

In case these data do not arrive properly, the data can be asked again

with the DGT_BUS_REPEAT_CHANGES command.

DGT_BUS_REPEAT_CHANGES

Causes the board to send last sent packet of changes again.

DGT_BUS_SET_START_GAME

sets an EE_START_TAG tag in the internal board changes buffer, for use in the

following command DGT_BUS_SEND_FROM_START. After this EE_START_TAG the

positions of the pieces are all logged in the file.

The command is answered with a DGT_MSG_BUS_START_GAME_WRITTEN message,

about 70 msec. after receipt of DGT_BUS_SET_START_GAME

DGT_BUS_SEND_FROM_START

causes the board to send a DGT_MSG_BUS_FROM_START message, containing

all update information starting with EE_START_TAG until the last registered

changes (excluding the moves that are to be sent with the DGT_BUS_SEND_CHANGES

command). Remember that after the EE_START_TAG all piece positions are written

in the eeprom file.

DGT_BUS_PING

causes the addressed board to send a DGT_MSG_BUS_PING message.

NB: when the DGT_BUS_PING command is sent with board address 0 (zero )

all connected boards will reply with a DGT_MSG_BUS_PING message, randomly

spread over a 1100 msec. interval. This to avoid collision. For reliable

identification of all connected boards, this process should be repeated

sometimes with checking of checksums!

DGT_IGNORE_NEXT_BUS_PING

is used in the process of detecting connected boards on a bus. After this

command (which itself sends a DGT_MSG_BUS_PING as handshake) the first

following DGT_BUS_PING with address zero (!) is ignored. This command

can be used to suppress response of already detected boards, and decreases

the chance of bus collisions.

This command responds immediately with a DGT_MSG_BUS_PING.

DGT_BUS_END_BUSMODE

causes the board to quit busmode, and go into single-connection mode.

Be careful not to use this command in a multiple board configuration!

NOTE: Any single-board command arriving during bus mode will

switch a board to single-board mode and will be processed. When sent

with address 0 the command is processed on all connected boards

DGT_BUS_RESET

forces a power-up reset procedure. NB: this procedure takes some seconds.

When sent with address 0 the command is processed on all conected boards

DEFINITION OF THE MESSAGE DATA FORMATS FROM BOARD TO PC

-------------------------------------------------------

Характеристики

Список файлов ВКР

Свежие статьи
Популярно сейчас
Почему делать на заказ в разы дороже, чем купить готовую учебную работу на СтудИзбе? Наши учебные работы продаются каждый год, тогда как большинство заказов выполняются с нуля. Найдите подходящий учебный материал на СтудИзбе!
Ответы на популярные вопросы
Да! Наши авторы собирают и выкладывают те работы, которые сдаются в Вашем учебном заведении ежегодно и уже проверены преподавателями.
Да! У нас любой человек может выложить любую учебную работу и зарабатывать на её продажах! Но каждый учебный материал публикуется только после тщательной проверки администрацией.
Вернём деньги! А если быть более точными, то автору даётся немного времени на исправление, а если не исправит или выйдет время, то вернём деньги в полном объёме!
Да! На равне с готовыми студенческими работами у нас продаются услуги. Цены на услуги видны сразу, то есть Вам нужно только указать параметры и сразу можно оплачивать.
Отзывы студентов
Ставлю 10/10
Все нравится, очень удобный сайт, помогает в учебе. Кроме этого, можно заработать самому, выставляя готовые учебные материалы на продажу здесь. Рейтинги и отзывы на преподавателей очень помогают сориентироваться в начале нового семестра. Спасибо за такую функцию. Ставлю максимальную оценку.
Лучшая платформа для успешной сдачи сессии
Познакомился со СтудИзбой благодаря своему другу, очень нравится интерфейс, количество доступных файлов, цена, в общем, все прекрасно. Даже сам продаю какие-то свои работы.
Студизба ван лав ❤
Очень офигенный сайт для студентов. Много полезных учебных материалов. Пользуюсь студизбой с октября 2021 года. Серьёзных нареканий нет. Хотелось бы, что бы ввели подписочную модель и сделали материалы дешевле 300 рублей в рамках подписки бесплатными.
Отличный сайт
Лично меня всё устраивает - и покупка, и продажа; и цены, и возможность предпросмотра куска файла, и обилие бесплатных файлов (в подборках по авторам, читай, ВУЗам и факультетам). Есть определённые баги, но всё решаемо, да и администраторы реагируют в течение суток.
Маленький отзыв о большом помощнике!
Студизба спасает в те моменты, когда сроки горят, а работ накопилось достаточно. Довольно удобный сайт с простой навигацией и огромным количеством материалов.
Студ. Изба как крупнейший сборник работ для студентов
Тут дофига бывает всего полезного. Печально, что бывают предметы по которым даже одного бесплатного решения нет, но это скорее вопрос к студентам. В остальном всё здорово.
Спасательный островок
Если уже не успеваешь разобраться или застрял на каком-то задание поможет тебе быстро и недорого решить твою проблему.
Всё и так отлично
Всё очень удобно. Особенно круто, что есть система бонусов и можно выводить остатки денег. Очень много качественных бесплатных файлов.
Отзыв о системе "Студизба"
Отличная платформа для распространения работ, востребованных студентами. Хорошо налаженная и качественная работа сайта, огромная база заданий и аудитория.
Отличный помощник
Отличный сайт с кучей полезных файлов, позволяющий найти много методичек / учебников / отзывов о вузах и преподователях.
Отлично помогает студентам в любой момент для решения трудных и незамедлительных задач
Хотелось бы больше конкретной информации о преподавателях. А так в принципе хороший сайт, всегда им пользуюсь и ни разу не было желания прекратить. Хороший сайт для помощи студентам, удобный и приятный интерфейс. Из недостатков можно выделить только отсутствия небольшого количества файлов.
Спасибо за шикарный сайт
Великолепный сайт на котором студент за не большие деньги может найти помощь с дз, проектами курсовыми, лабораторными, а также узнать отзывы на преподавателей и бесплатно скачать пособия.
Популярные преподаватели
Добавляйте материалы
и зарабатывайте!
Продажи идут автоматически
7027
Авторов
на СтудИзбе
260
Средний доход
с одного платного файла
Обучение Подробнее