Kennung für das Versionskontroll-System:
char *rcs = ''$Id: hardware.c,v 1.143 1996/05/08 11:02:46 heuler$'';
Globale Variablen:
volatile int _penw; /* angle of pendulum - set by irq */ volatile int _motw; /* angle of motor - set by irq */ volatile int _penv; /* velocity of pendulum - set by irq */ volatile int _motv; /* velocity of motor - set by irq */ volatile int _status; /* status of system - set by irq */ volatile int new_force = 0; /* flag for new force */ volatile int irq_counter = 0; /* counter of io irqs */ volatile int sleeping = 0; /* sleeptime in freq units */ volatile int wakeup = 0; /* process should be waked up */ volatile int overload = 0; /* processor overload */
volatile struct hctl *hctl_1, *hctl_2; volatile ubyte *port_A, *port_B, *port_C, *p_cont; volatile ubyte *count_0, *count_1, *count_2, *t_cont; static int sample_timer = 0x40; static struct wait_queue *pendel_waitq = NULL; static int pen_speed[VCOUNTER]; /* for speed of pendulum */ static int mot_speed[VCOUNTER]; /* for speed of motor */ static int calibrated = 0; /* calibrated */
Setzt die Schnittstellenkarte zurück:
void reset_card();
Programmiert die Interruptrate auf der Karte:
void set_intr_timer(int f);
Schaltet den Interrupt von der Karte an:
void start_intr();
Schaltet den Interrupt von der Karte aus:
void stop_intr();
Initialisiert die Speicher-Adressen der Schnittstellenkarte:
void init_address();
Prüft, ob die Karte vorhanden ist:
static int hardware_test();
Initialisiert die Hardware:
int init_hardware();
Schaltet die Hardware ab:
void shutdown_hardware();
Interrupt-Callback - Interruptbedienfunktion:
void pendel_interrupt();
Führt direkten Motorbefehl aus:
void set_mcp(int wert);
Schaltet den Endstufen-Endschalter aus:
void endstufe_on();
Schaltet den Endstufe-Endschalter ein:
void endstufe_reset();
Stellt den Motormodus ein:
void set_hctl_mode(int mode);
Setzt die Regelparameter:
void set_param(ubyte werta, ubyte wertb, ubyte wertk);
Setzt die Sollposition für den Arm:
void set_arm_pos(long pos);
Setzt den Positionszähler für den Arm auf 0:
void null_arm_pos();
Setzt den Positionszähler des Pendels auf 0:
void null_pendel_pos();
Liefert Position des Arms zur Senkrechten:
long get_arm_pos();
Liefert Position des Pendels zum Arm:
long get_pen_pos();
Liest Digitalsignale von Endstufe:
ubyte get_input();
Wartet time Millisekunden durch Schlafen:
void delay(int time);
Fährt Pendel herunter:
void pendel_down();
Fährt Pendel hoch und kalibriert es:
int pendel_calib();
Bewegt den Arm langsam:
void move_arm(long ziel);
Schwingt den Arm hoch:
int pendel_up(int faktor);
Steuert das Pendel mit dem Fuzzy-Controller:
void control();
Führt Befehle mit Argumenten aus:
void command_arg(int cmd, int value, int fl);
Führt Befehle ohne Argumente aus:
void command(int cmd, int fl);