ВУЗ: Не указан

Категория: Не указан

Дисциплина: Не указана

Добавлен: 13.06.2025

Просмотров: 4193

Скачиваний: 0

ВНИМАНИЕ! Если данный файл нарушает Ваши авторские права, то обязательно сообщите нам.

Battery Entry

leftmotor = MOTORInit(LEFTMOTOR);

Now the motor can be used by the access routines provided, e.g. setting a certain speed. The following function calls the motor driver and sets the speed on a previously initialized motor:

MOTORDrive (leftmotor,50);

After finishing using a device (here: the motor), it is required to release it, so it can be used by other applications:

MOTORRelease (leftmotor);

Using the HDT entries for all other hardware components works in a similar way. See the following description of HDT information structures as well as the RoBIOS details in Appendix B.5.

C.2 Battery Entry

typedef struct

{

int version; short low_limit; short high_limit;

}battery_type;

e.g.

battery_type battery = {0,550,850};

int version:

The maximum driver version for which this entry is compatible.

Because newer drivers will surely need more information, this tag prevents this driver from reading more information than actually available.

short low_limit:

The value the AD-converter channel 1 measures shortly before the batteries are empty. This defines the lower limit of the tracked battery voltage.

short high_limit:

The value the AD-converter channel 1 measures with fully loaded batteries. This defines the upper limit of the tracked battery voltage.

C.3 Bumper Entry

typedef struct

{

int

driver_version;

int

tpu_channel;

int

tpu_timer;

short

transition;

}bump_type;

e.g.

bump_type bumper0 = {0, 6, TIMER2, EITHER};

415

C Hardware Description Table

int driver_version:

The maximum driver version for which this entry is compatible.

Because newer drivers will surely need more information, this tag prevents this driver from reading more information than actually available.

int tpu_channel:

The tpu channel the bumper is attached to. Valid values are 0..15 Each bumper needs a tpu channel to signal a 'bump'-occurrence.

int tpu_timer:

The tpu timer that has to be used. Valid values are TIMER1, TIMER2

If a 'bump' is detected the corresponding timer-value is stored for later calculations.

TIMER1 runs at a speed of 4MHz-8MHz (depending on CPUclock) TIMER2 runs at a speed of 512kHz-1MHz (depending on CPUclock)

short transition:

React on a certain transition. Valid values are RISING, FALLING, EITHER

To alter the behaviour of the bumper, the type of transition the TPU reacts on can be choosen.

C.4 Compass Entry

typedef struct

{

short version; short channel; void* pc_port; short pc_pin; void* cal_port; short cal_pin; void* sdo_port; short sdo_pin;

}compass_type;

e.g.

compass_type compass = {0,13,(void*)IOBase, 2,(void*)IOBase, 4, (BYTE*)IOBase, 0};

short version:

The maximum driver version for which this entry is compatible.

Because newer drivers will surely need more information, this tag prevents this driver from reading more information than actually available.

short channel:

TPU channel that is connected to the compass for clocking the data transfer. Valid values are 0..15

void* pc_port:

Pointer to an 8Bit register/latch (out). PC is the start signal for the compass

short pc_pin:

This is the bit number in the register/latch addressed by pc_port. Valid values are 0..7

void* cal_port:

Pointer to an 8Bit register/latch (out). CAL is the calibration start signal for the compass.

It can be set to NULL if no calibration is needed (In this case never call the calibration function).

short cal_pin:

416


Information Entry

This is the bitnumber in the register/latch addressed by cal_port. Valid values are 0..7

void* sdo_port:

Pointer to an 8Bit register/latch (in). SDO is the serial data output connection of the compass. The driver will read out the serial data timed by the TPU channel.

short sdo_pin:

This is the bitnumber in the register/latch addressed by sdo_port. Valid values are 0..7

C.5 Information Entry

typedef struct

{

int

version;

int

id;

int

serspeed;

int

handshake;

int

interface;

int

auto_download;

int

res1;

int

cammode;

int

battery_display;

int

CPUclock;

float

user_version;

String10 name; unsigned char res2;

}info_type;

e.g.

info_type roboinfo0 = {0,VEHICLE,SER115200,RTSCTS,SERIAL2,AUTOLOAD,0, AUTOBRIGHTNESS,BATTERY_ON,16,VERSION,NAME,0};

int version:

The maximum driver version for which this entry is compatible.

Because newer drivers will surely need more information, this tag prevents this driver from reading more information than actually available.

int id:

The current environment on which RoBiOS is running. Valid values are PLATFORM, VEHICLE, WALKER

It is accessible via OSMachineType().

int serspeed:

The default baudrate for the default serial interface.

Valid values are SER9600, SER19200, SER38400, SER57600 SER115200

int handshake:

The default handshake mode for the default serial interface. Valid values are NONE, RTSCTS

int interface:

The default serial interface for the transfer of userprograms. Valid values are SERIAL1, SERIAL2, SERIAL3

int auto_download;

The download mode during the main menu of RoBIOS. After startup of RoBIOS it can permanently scan the default serial port for a file-download. If it detects a file it automatically downloads it (set to AUTOLOAD).

417


C Hardware Description Table

If it should automatically run this file too set the value to (AUTOLOADSTART). If it is set to NO_AUTOLOAD no scanning is performed.

int res1:

this is a reserved value (formerly it was used for the state of the radio remote control which has now its own HDT entry. So always set it to 0)

int cammode:

The default camera mode. Valid values are AUTOBRIGHTNESS, NOAUTOBRIGHTNESS

int battery_display:

Switch the battery status display on or off. Valid values are BATTERY_ON, BATTERY_OFF

int CPUclock:

The clock rate(MHz) the MC68332 microprocessor should run with. It is accessible via OSMachineSpeed().

float user_version:

The user defined version number of the actual HDT. This nr is just for information and will be displayed in the HRD-menue of the RoBiOS!

String10 name;

The user defined unique name for this Eyebot. This name is just for information and will be displayed in the main menu of the RoBiOS! It is accessible via OSMachineName().

unsigned char robi_id;

The user defined unique id for this Eyebot. This id is just for information and will be displayed in the main-menu of the RoBiOS! Is is accessible via OSMachineID(). It can temporarily be changed in Hrd/Set/Rmt

unsigned char res2:

this is a reserved value (formerly it was used for the robot-ID of the radio remote control which has now its own HDT entry. So always set it to 0)

C.6 Infrared Sensor Entry

typedef struct

{

int

driver_version;

int

tpu_channel;

}ir_type;

e.g.

ir0 = {0, 8};

ir_type

int driver_version:

The maximum driver version for which this entry is compatible.

Because newer drivers will surely need more information this tag prevents this driver from reading more information than actually available.

int tpu_channel:

The tpu channel the ir-sensor is attached to. Valid values are 0..15

Each ir-sensor needs a tpu channel to signal the recognition of an obstacle.

418


Infrared TV Remote Entry

C.7 Infrared TV Remote Entry

typedef struct

{

version;

short

short

channel;

short

priority;

/* new in version 1: */

short

use_in_robios;

int

type;

int

length;

int

tog_mask;

int

inv_mask;

int

mode;

int

bufsize;

int

delay;

int

code_key1;

int

code_key2;

int

code_key3;

int

code_key4;

} irtv_type;

This is the new extended IRTV struct. RoBIOS can still handle the old version 0-format which will cause RoBIOS to use the settings for the standard Nokia VCN 620. But only with the new version 1 is it possible to use the IRTV to control the 4 keys in RoBIOS.

old settings (version 0): e.g. for a SoccerBot:

irtv_type irtv = {0, 11, TPU_HIGH_PRIO}; /* Sensor connected to TPU 11 (=S10)*/

e.g. for an EyeWalker:

irtv_type irtv = {0, 0, TPU_HIGH_PRIO}; /* Sensor connected to TPU 0 */

new settings (version 1 for Nokia VCN620 and activated RoBIOS control): irtv_type irtv = {1, 11, TPU_HIGH_PRIO, REMOTE_ON, SPACE_CODE, 15, 0x0000, 0x03FF, DEFAULT_MODE, 1, -1, RC_RED, RC_GREEN, RC_YELLOW, RC_BLUE};

short version:

The maximum driver version for which this entry is compatible. Because newer drivers will surely need more information, this tag

prevents this driver from reading more information than actually available.

short channel:

The TPU channel the IRTV-sensor is attached to. Valid values are 0..15. Normally, the sensor is connected to a free servo port. However on the EyeWalker there is no free servo connector so the sensor should be connected to a motor connector (a small modification is needed for this - see manual).

short priority:

The IRQ-priority of the assigned TPU channel. This should be set to TPU_HIGH_PRIO to make sure that no remote commands are missed.

short use_in_robios:

If set to REMOTE_ON, the remote control can be used to control the 4 EyeCon keys in RoBIOS. Use REMOTE_OFF to disable this feature.

int type: int length:

int tog_mask: int inv_mask: int mode:

int bufsize:

419


C Hardware Description Table

int delay:

These are the settings to configure a certain remote control. They are exactly the same as the parameters for

the IRTVInit() system call. Above is an example for the default Nokia VCN620 control. The settings can be found by using the irca-program.

int code_key1: int code_key2: int code_key3: int code_key4:

These are the codes of the 4 buttons of the remote control that should match the 4 EyeCon keys. For the Nokia remote control all codes can be found in the header file 'IRnokia.h'.

C.8 Latch Entry

With this entry RoBIOS is told where to find the In/Out-Latches and how many of them are installed.

typedef struct

{

short version;

BYTE* out_latch_address; short nr_out;

BYTE* in_latch_address; short nr_in;

} latch_type;

e.g.

latch_type latch = {0, (BYTE*)IOBase, 1 , (BYTE*)IOBase, 1};

int version:

The maximum driver version for which this entry is compatible.

Because newer drivers will surely need more information, this tag prevents this driver from reading more information than actually available.

BYTE* out_latch_address:

Start address of the out-latches.

short nr_out:

Amount of 8Bit out-latches

BYTE* in_latch_address;

Start address of the in-latches.

short nr_in;

Amount of 8Bit in-latches

C.9 Motor Entry

typedef struct

{

int

driver_version;

int

tpu_channel;

int

tpu_timer;

int

pwm_period;

BYTE*

out_pin_address;

short

out_pin_fbit;

short

out_pin_bbit;

420