![Tern CAN-Engine Скачать руководство пользователя страница 40](http://html.mh-extra.com/html/tern/can-engine/can-engine_technical-manual_1089501040.webp)
Chapter 4: Software
CAN-Engine
_____________________________________________________________________________________
4-18
4.
You need to select another IP address on the same subnet as your PC. This means the first 3
values will be the same as your PC's address in the above example; the last digit needs to be
different from any other device on your subnet.
For example, we choose: 192.168.2.206. (192.168.2.xxx remains the same.)
This value should also be set statically, as below:
u_char ControllerTcpAddress[] = {192, 168, 2, 206};
5.
The MAC address needs to be unique from any other device on the subnet. If you're using
multiple C-Eye's on the same network, connected to the same hub, make sure they have
different MAC addresses. Contact TERN if you are working with multiple C-Eyes and would
like our help selecting unique MAC address ranges.
6.
Save the file after making your network changes, and build this node again (right-click on the
.axe node, and select 'Build node').
4.6.4
User Application
The typical user application follows this basic model:
-
configure the i2chip module with network parameters (4-byte IP address, 6-byte MAC address, 4-
byte gateway address, 4-byte netmask, and buffer allocation between the 4 available sockets if
needed); after this is done, the module can already be remotely ping'ed at the above address. See
above section for more details.
-
establish a socket with appropriate type/port parameters (TCP stream server socket on port 80, for
example).
-
regularly monitor the status of the socket using the 'select' function as part of the main application
loop. ie. respond to incoming connections, create out-going connections, and read/write data.
4.6.5
'i2chip_hw'
Because of the large number of controllers with which the i2chip module is used, you must be careful to
define properly the specific hardware you're working with. Expect the 'i2chip_hw' code to be updated over
time to support newer systems. The documentation in 'i2chip_hw.h' has precedence over the architectures
listed in this email.
Each hardware architecture is selected via '#define' statements. These are listed below. To set a #define
value (should be uniform across your entire target, not just in a single .c or .h file):
-
right click on the .axe node,
-
select 'Edit local options',
-
select 'Compiler->Defines',
-
in this field, all of the relevant #define values should be stored. By default, this should include
__PDREMOTE__
(a value informing the complier that you're currently debugging the application).
You can add to this to form, for example:
__PDREMOTE__;TERN_186;TERN_P51
(186-based
controller on a P51 expansion board).