pthreads
rel_jitter.tar.gz
rel_jitter_test.c
utils.c
Some common functions:
- int pthread_create(pthread_t * thread, pthread_attr_t * attr, void * (*start_routine)(void *), void * arg);
- int pthread_join(pthread_t th, void **thread_return);
- int pthread_attr_init(pthread_attr_t *attr);
- int pthread_attr_setscope(pthread_attr_t *attr, int scope);
- int pthread_attr_setschedpolicy(pthread_attr_t *attr, int policy);
- int pthread_attr_setschedparam(pthread_attr_t *attr, const struct sched_param *param);
- int pthread_attr_setinheritsched(pthread_attr_t *attr, int inherit);
- int sched_get_priority_max(int policy);
- int mlockall(int flags);
libraries needed when linking
Graphs
Gizmo Driver and Test Program
Test Program
- no options tests the LEDs
- -i tests the input sensors
- -n n is the number of volts to the relay. The value can be between 0-5. This test the operation of the relay and solenoid.
Gizmo Driver
- write
- 1 byte (digital output to LEDs)
- This is the control for the LEDs on the top of the hacksaw blade. One byte is written to the device and each bit corresponds to the control of one of the LEDs.
- code example to activate all the LEDs:
data = 0xff;
write (gfd, &data, 1);
count must equal 1
2 bytes (analog output to relay)
- This is the control for the solenoid. Writing between 0-5 will apply the corresponding number of volts to the relay. Given enough voltage the relay will then complete the circuit for the solenoid allowing the hacksaw blade to be pulled. Applying zero volts to the relay will open the solenoid circuit releasing the pull on the hacksaw blade by the solenoid.
- Note: applying a voltage greater than 5V will not increase the power of the solenoid, this may only burn up the relay.
- code example to activate the solenoid:
data = 5;
write (gfd, &data, 2);
count must equal 2
the value of the first byte in data will be used as the applied voltage to the relay
code example to deactivate the solenoid:
data = 0;
write (gfd, &data, 2);
read
- 2 bytes
- This provides the access to the the sensors on the sides of the hacksaw blade. As the hacksaw blade makes and breaks contact with springs the value read will change. Of the 2 bytes read only the first two bits will be needed. These two bits correspond to the two sensors.
-
- code example to read the the sensor values:
read (gfd, &data, 2);
count must equal 2