Tscope5
parport.c File Reference

Definitions of parallel port functions. More...

Go to the source code of this file.

Functions

Response registration

Parallel port boxes can be used as response devices.

See timer.c for more information about response registration.

int ts5_define_parport_button (int device, int button)
 Define a parallel port button as a response button. More...
 
int ts5_get_num_parport_buttons (int device)
 Get the number of buttons available on a parallel port. More...
 
double ts5_set_parport_button_debounce_time (int device, double button_debounce_time)
 Set the button debounce time of a parallel port response box. More...
 
double ts5_get_parport_button_debounce_time (int device)
 Get the button debounce time of a parallel port response box. More...
 
Trigger input/output

The parallel ports can be used as trigger input/output devices.

See timer.c for more information about trigger input/output.

void ts5_define_parport_trigger_input (int device)
 Define a parallel port as a trigger input device. More...
 
void ts5_simulate_parport_trigger_input (int device, unsigned char value, double interval)
 Turn on parallel port input simulation. More...
 
double ts5_set_parport_trigger_debounce_time (int device, double trigger_debounce_time)
 Set the trigger debounce time of a parallel port. More...
 
double ts5_get_parport_trigger_debounce_time (int device)
 Get the trigger debounce time of a parallel port. More...
 
void ts5_send_parport_trigger (int device, unsigned char value)
 Send a trigger trough a parallel port. More...
 
double ts5_set_parport_trigger_output_time (int device, double trigger_output_time)
 Set the trigger output time of a parallel port. More...
 
double ts5_get_parport_trigger_output_time (int device)
 Get the trigger output time of a parallel port. More...
 
Port settings

On older motherboards there were three parallel ports, with addresses 0x378, 0x278, 0x3BC.

This is the default setting in Tscope5.

On newer motherboards there are no parallel ports, but PCI parallel port cards can be added.

If you have such a card, you will need set the number of parallel ports and their addresses using the functions below.

int ts5_set_num_parports (int num_parports)
 Set the number of parallel ports that are connected to the system. More...
 
int ts5_get_num_parports ()
 Get the number of parallel ports that are connected to the system. More...
 
short ts5_set_parport_address (int device, short address)
 Set the address of a parallel port. More...
 
short ts5_get_parport_address (int device)
 Get the address of a parallel port. More...
 

Detailed Description

Definitions of parallel port functions.

Definition in file parport.c.

Function Documentation

int ts5_define_parport_button ( int  device,
int  button 
)

Define a parallel port button as a response button.

Parameters
deviceNumber of the parallel port (devices are numbered from 1).
buttonNumber of the button (buttons are counted from 1).
Returns
The reponse number associated with the button.

Give a positive number for the button if you want to monitor button press events, a negative number if you want to monitor button release events.

Examples:
parport01.c.

Definition at line 57 of file parport.c.

int ts5_get_num_parport_buttons ( int  device)

Get the number of buttons available on a parallel port.

Parameters
deviceNumber of the parallel port (devices are numbered from 1).
Returns
The number of buttons on the parallel port.
Examples:
parport01.c.

Definition at line 141 of file parport.c.

double ts5_set_parport_button_debounce_time ( int  device,
double  button_debounce_time 
)

Set the button debounce time of a parallel port response box.

Parameters
deviceNumber of the parallel port
button_debounce_timeDebounce time in seconds
Returns
The previous setting

The debounce time is the minimum amount of time between two state changes of the buttons of the box before Tscope5 really counts it as a state change. On some button boxes it is necessary to set this value because the press or release of a button causes a ripple in the electrical current sent to the parallel port (instead of a single state change between on and off).

The debounce time is the amount of time between the press and the release of a button (or vice versa). So the minimum amount of time between two presses (or two releases) will be twice the debounce time set here.

The default debounce time is set to 0.0 (The button boxes at our department have an internal debouncing circuit).

Definition at line 174 of file parport.c.

double ts5_get_parport_button_debounce_time ( int  device)

Get the button debounce time of a parallel port response box.

Parameters
deviceNumber of the parallel port
Returns
The debounce time

Definition at line 217 of file parport.c.

void ts5_define_parport_trigger_input ( int  device)

Define a parallel port as a trigger input device.

Parameters
deviceNumber of the parallel port (devices are numbered from 1).
Examples:
parport02.c.

Definition at line 253 of file parport.c.

void ts5_simulate_parport_trigger_input ( int  device,
unsigned char  value,
double  interval 
)

Turn on parallel port input simulation.

Parameters
deviceNumber of the parallel port (devices are numbered from 1).
valueInput value that has to be simulated (0-255, 0 turns the simulation off).
intervalInterval in seconds between two triggers.
Examples:
parport02.c.

Definition at line 277 of file parport.c.

double ts5_set_parport_trigger_debounce_time ( int  device,
double  trigger_debounce_time 
)

Set the trigger debounce time of a parallel port.

Parameters
deviceNumber of the parallel port
trigger_debounce_timeDebounce time in seconds
Returns
The previous setting

The default debounce time is set to 0.0

Definition at line 309 of file parport.c.

double ts5_get_parport_trigger_debounce_time ( int  device)

Get the trigger debounce time of a parallel port.

Parameters
deviceNumber of the parallel port
Returns
The debounce time

Definition at line 351 of file parport.c.

void ts5_send_parport_trigger ( int  device,
unsigned char  value 
)

Send a trigger trough a parallel port.

Parameters
deviceNumber of the parallel port (devices are numbered from 1).
valueThe trigger value that has to be sent (0-255).
Examples:
parport03.c.

Definition at line 374 of file parport.c.

double ts5_set_parport_trigger_output_time ( int  device,
double  trigger_output_time 
)

Set the trigger output time of a parallel port.

Parameters
deviceNumber of the parallel port
trigger_output_timeOutput time in seconds
Returns
The previous setting

The default output time is 0.002 seconds.

Examples:
parport03.c.

Definition at line 418 of file parport.c.

double ts5_get_parport_trigger_output_time ( int  device)

Get the trigger output time of a parallel port.

Parameters
deviceNumber of the parallel port
Returns
The output time

Definition at line 460 of file parport.c.

int ts5_set_num_parports ( int  num_parports)

Set the number of parallel ports that are connected to the system.

Parameters
num_parports
Returns
The previous setting.

Definition at line 506 of file parport.c.

int ts5_get_num_parports ( )

Get the number of parallel ports that are connected to the system.

Returns
The number of parallel ports that are connected to the system.
Examples:
parport01.c.

Definition at line 537 of file parport.c.

short ts5_set_parport_address ( int  device,
short  address 
)

Set the address of a parallel port.

Parameters
deviceNumber of the parallel port
addressThe address of the parallel port
Returns
The previous address of the parallel port.

Definition at line 554 of file parport.c.

short ts5_get_parport_address ( int  device)

Get the address of a parallel port.

Parameters
deviceNumber of the parallel port
Returns
The address of the parallel port.

Definition at line 592 of file parport.c.