Mindstorms 3rd Party ROBOTC Drivers RobotC
[Home] [Download] [Submit a bug/suggestion] [ROBOTC Forums] [Blog] [Support this project]
Files | Defines | Functions | Variables

Prototype Board
[HiTechnic]

Files

file  hitechnic-protoboard.h
 

HiTechnic Prototype Board driver.


Defines

#define HTPB_I2C_ADDR   0x02
#define HTPB_OFFSET   0x42
#define HTPB_A0_U   0x00
#define HTPB_A0_L   0x01
#define HTPB_DIGIN   0x0A
#define HTPB_DIGOUT   0x0B
#define HTPB_DIGCTRL   0x0C
#define HTPB_SRATE   0x0D

Functions

ubyte HTPBreadIO (tSensors link, ubyte mask)
bool HTPBwriteIO (tSensors link, ubyte mask)
bool HTPBsetupIO (tSensors link, ubyte mask)
int HTPBreadADC (tSensors link, byte channel, byte width)
bool HTPBreadAllADC (tSensors link, int &adch0, int &adch1, int &adch2, int &adch3, int &adch4, byte width)
bool HTPBsetSamplingTime (tSensors link, byte interval)
ubyte HTPBreadIO (tMUXSensor muxsensor, ubyte mask)
int HTPBreadADC (tMUXSensor muxsensor, byte channel, byte width)
bool HTPBreadAllADC (tMUXSensor muxsensor, int &adch0, int &adch1, int &adch2, int &adch3, int &adch4, byte width)

Variables

tByteArray HTPB_I2CRequest
tByteArray HTPB_I2CReply
tConfigParams HTPB_config = {HTSMUX_CHAN_I2C + HTSMUX_CHAN_9V, 14, 0x02, 0x42}

Detailed Description

HiTechnic Prototype Board


Define Documentation

#define HTPB_A0_L   0x01

Address of lower bits of first ADC, bits 1-0

Definition at line 68 of file hitechnic-protoboard.h.

#define HTPB_A0_U   0x00

Address of upper bits of first ADC, bits 9-2

Definition at line 67 of file hitechnic-protoboard.h.

#define HTPB_DIGCTRL   0x0C

Controls direction of digital ports

Definition at line 71 of file hitechnic-protoboard.h.

#define HTPB_DIGIN   0x0A

Address of digital inputs

Definition at line 69 of file hitechnic-protoboard.h.

#define HTPB_DIGOUT   0x0B

Address of digital outputs

Definition at line 70 of file hitechnic-protoboard.h.

#define HTPB_I2C_ADDR   0x02

Protoboard I2C device address

Definition at line 65 of file hitechnic-protoboard.h.

#define HTPB_OFFSET   0x42

Definition at line 66 of file hitechnic-protoboard.h.

#define HTPB_SRATE   0x0D

Controls sample rate, default set to 10ms

Definition at line 72 of file hitechnic-protoboard.h.


Function Documentation

int HTPBreadADC ( tSensors  link,
byte  channel,
byte  width 
)

Read the value of the specified analogue channel.

Parameters:
linkthe HTPB port number
channelthe specified ADC channel
widththe bit width of the result, can be either 8 or 10
Returns:
the value of the ADC channel, or -1 if an error occurred
Examples:
hitechnic-protoboard-exp1.c, hitechnic-protoboard-exp2.c, hitechnic-protoboard-exp4.c, hitechnic-protoboard-exp5.c, hitechnic-protoboard-exp8.c, hitechnic-protoboard-SMUX-test2.c, and hitechnic-protoboard-test1.c.

Definition at line 174 of file hitechnic-protoboard.h.

int HTPBreadADC ( tMUXSensor  muxsensor,
byte  channel,
byte  width 
)

Read the value of the specified analogue channel.

Parameters:
muxsensorthe SMUX sensor port number
channelthe specified ADC channel
widththe bit width of the result, can be either 8 or 10
Returns:
the value of the ADC channel, or -1 if an error occurred

Definition at line 207 of file hitechnic-protoboard.h.

bool HTPBreadAllADC ( tMUXSensor  muxsensor,
int &  adch0,
int &  adch1,
int &  adch2,
int &  adch3,
int &  adch4,
byte  width 
)

This function read the value of all of the analogue channels.

Parameters:
muxsensorthe SMUX sensor port number
adch0parameter to hold value for ad channel 0
adch1parameter to hold value for ad channel 1
adch2parameter to hold value for ad channel 2
adch3parameter to hold value for ad channel 3
adch4parameter to hold value for ad channel 4
widththe bit width of the result, can be either 8 or 10
Returns:
true if no error occured, false if it did

Definition at line 287 of file hitechnic-protoboard.h.

bool HTPBreadAllADC ( tSensors  link,
int &  adch0,
int &  adch1,
int &  adch2,
int &  adch3,
int &  adch4,
byte  width 
)

This function read the value of all of the analogue channels.

Parameters:
linkthe HTPB port number
adch0parameter to hold value for ad channel 0
adch1parameter to hold value for ad channel 1
adch2parameter to hold value for ad channel 2
adch3parameter to hold value for ad channel 3
adch4parameter to hold value for ad channel 4
widththe bit width of the result, can be either 8 or 10
Returns:
true if no error occured, false if it did
Examples:
hitechnic-protoboard-test3.c.

Definition at line 243 of file hitechnic-protoboard.h.

ubyte HTPBreadIO ( tSensors  link,
ubyte  mask 
)

Read the values of the digital inputs as specified by the mask.

Parameters:
linkthe HTPB port number
maskthe specified digital ports
Examples:
hitechnic-protoboard-exp6a.c, hitechnic-protoboard-exp6b.c, hitechnic-protoboard-exp7.c, hitechnic-protoboard-SMUX-test1.c, and hitechnic-protoboard-test2.c.

Definition at line 97 of file hitechnic-protoboard.h.

ubyte HTPBreadIO ( tMUXSensor  muxsensor,
ubyte  mask 
)

Read the values of the digital inputs as specified by the mask.

Parameters:
muxsensorthe SMUX sensor port number
maskthe specified digital ports

Definition at line 116 of file hitechnic-protoboard.h.

bool HTPBsetSamplingTime ( tSensors  link,
byte  interval 
)

This function configured the time between samples. This value is not stored permanently.

Parameters:
linkthe HTPB port number
intervala value between 4 and 100ms, default is 10ms
Returns:
true if no error occured, false if it did

Definition at line 325 of file hitechnic-protoboard.h.

bool HTPBsetupIO ( tSensors  link,
ubyte  mask 
)

Configure the ports for input or output according to the mask.

Parameters:
linkthe HTPB port number
maskthe specified digital ports, 0 = input, 1 = output
Returns:
true if no error occured, false if it did
Examples:
hitechnic-protoboard-exp1.c, hitechnic-protoboard-exp2.c, hitechnic-protoboard-exp3.c, hitechnic-protoboard-exp5.c, hitechnic-protoboard-exp6a.c, hitechnic-protoboard-exp6b.c, hitechnic-protoboard-exp7.c, hitechnic-protoboard-exp8.c, and hitechnic-protoboard-test1.c.

Definition at line 155 of file hitechnic-protoboard.h.

bool HTPBwriteIO ( tSensors  link,
ubyte  mask 
)

Write the values the digital outpus as specified by the mask.

Parameters:
linkthe HTPB port number
maskthe specified digital ports
Returns:
true if no error occured, false if it did
Examples:
hitechnic-protoboard-exp1.c, hitechnic-protoboard-exp2.c, hitechnic-protoboard-exp3.c, hitechnic-protoboard-exp5.c, hitechnic-protoboard-exp6a.c, hitechnic-protoboard-exp6b.c, hitechnic-protoboard-exp7.c, hitechnic-protoboard-exp8.c, and hitechnic-protoboard-test1.c.

Definition at line 136 of file hitechnic-protoboard.h.


Variable Documentation

tConfigParams HTPB_config = {HTSMUX_CHAN_I2C + HTSMUX_CHAN_9V, 14, 0x02, 0x42}

Array to hold SMUX config data for sensor

Definition at line 89 of file hitechnic-protoboard.h.

Array to hold I2C reply data

Definition at line 75 of file hitechnic-protoboard.h.

Array to hold I2C command data

Definition at line 74 of file hitechnic-protoboard.h.