easy_c 1.0 # Servo4 module declarations: # The Servo4 module provides control of up to 4 servos. The Servo4-C # module provides regulated 5V for the servos. The power for the servos # is completely separate from the logic bus. Thus, the servos can stall # without crashing the logic bus. This is accomplished via # opto-isolators. IMPORTANT!!! When the module powers up, all 4 servos # are disabled!!! No servo motion occurs until the servo enable bits # are set. # Servo4 (Revision C) Summary: # # servo4 :@= create@RB2_Servo4_C(11s) # # call quick_set@(servo4, cmd, pppppss) # The argument pppppss is of type Byte. # Set servo {ss} to position {ppppp}, where {ppppp}=0b corresponds # to .75mS and {ppppp}=31b corresonds to 2.25mS. {ss} must be between # 0b and 3b inclusive. It is up to the user to shift {ppppp} to the left # by two bits and or in {ss}. # # call short_high_low_set@(servo4, cmd, ss, hhhhhlll) # The argument ss is of type Byte. # The argument hhhhhlll is of type Byte. # Set servo {ss} to {hhhhhlll} where each increment corrsponds to # 6.40uS of pulse width. {ss} mush be between 0b and 3b inclusive. # # call high_low_set@(servo4, cmd, ss, hhhhhhhhllllllll) # The argument ss is of type Byte. # The argument hhhhhhhhllllllll is of type Short. # Set servo {ss} to {hhhhhhhhllllllll} where each increment # corresponds to .20uS. As usual {ss} must be between 0b and 3b # inclusive. {hhhhhhhhllllllll} should be between 500s and 15000s. # # call low_set@(servo4, cmd, ss, llllllll) # The argument ss is of type Byte. # The argument llllllll is of type Byte. # Set low byte of servo {ss} to {llllllll} # # call high_set@(servo4, cmd, ss, llllllll) # The argument ss is of type Byte. # The argument llllllll is of type Byte. # Set low byte of servo {ss} to {hhhhhhhh} # # call enables_set@(servo4, cmd, eeee) # The argument eeee is of type Byte. # Set servo enable bits to {eeee}. 0=disabled and 1=enabled. # # hhhhhhhh := high_get@(servo4, cmd, ss) # The argument ss is of type Byte. # This routine returns a value of type Byte. # Get high byte of {ss}. # # llllllll := low_get@(servo4, cmd, ss) # The argument ss is of type Byte. # This routine returns a value of type Byte. # Get low byte of servo {ss}. # # eeee := enables_get@(servo4, cmd) # This routine returns a value of type Byte. # Get servo enable bits. 0=disabled and 1=enabled. # # End of summary # Servo4 (Revision C) declarations: define RB2_Servo4_C simple Short routine create@RB2_Servo4_C takes address Short returns RB2_Servo4_C external RB2__cmd_new # Create and return new {RB2_Servo4_C} object # connected to Servo4 module at {address}. routine select@RB2_Servo4_C takes servo4 RB2_Servo4_C returns Logical external RB2__select define RB2_Servo4_C_Quick_Set simple Byte constant cmd@RB2_Servo4_C_Quick_Set RB2_Servo4_C_Quick_Set = rb2_servo4_c_quick_set@(0b) routine quick_set@RB2_Servo4_C takes servo4 RB2_Servo4_C takes command RB2_Servo4_C_Quick_Set takes pppppss Byte returns_nothing external RB2__cmd_m define RB2_Servo4_C_Short_High_Low_Set simple Byte constant cmd@RB2_Servo4_C_Short_High_Low_Set RB2_Servo4_C_Short_High_Low_Set = rb2_servo4_c_short_high_low_set@(128b) routine short_high_low_set@RB2_Servo4_C takes servo4 RB2_Servo4_C takes command RB2_Servo4_C_Short_High_Low_Set takes ss Byte takes hhhhhlll Byte returns_nothing external RB2__cmd_mb define RB2_Servo4_C_High_Low_Set simple Byte constant cmd@RB2_Servo4_C_High_Low_Set RB2_Servo4_C_High_Low_Set = rb2_servo4_c_high_low_set@(128b) routine high_low_set@RB2_Servo4_C takes servo4 RB2_Servo4_C takes command RB2_Servo4_C_High_Low_Set takes ss Byte takes hhhhhhhhllllllll Short returns_nothing external RB2__cmd_ms define RB2_Servo4_C_Low_Set simple Byte constant cmd@RB2_Servo4_C_Low_Set RB2_Servo4_C_Low_Set = rb2_servo4_c_low_set@(136b) routine low_set@RB2_Servo4_C takes servo4 RB2_Servo4_C takes command RB2_Servo4_C_Low_Set takes ss Byte takes llllllll Byte returns_nothing external RB2__cmd_mb define RB2_Servo4_C_High_Set simple Byte constant cmd@RB2_Servo4_C_High_Set RB2_Servo4_C_High_Set = rb2_servo4_c_high_set@(140b) routine high_set@RB2_Servo4_C takes servo4 RB2_Servo4_C takes command RB2_Servo4_C_High_Set takes ss Byte takes llllllll Byte returns_nothing external RB2__cmd_mb define RB2_Servo4_C_Enables_Set simple Byte constant cmd@RB2_Servo4_C_Enables_Set RB2_Servo4_C_Enables_Set = rb2_servo4_c_enables_set@(144b) routine enables_set@RB2_Servo4_C takes servo4 RB2_Servo4_C takes command RB2_Servo4_C_Enables_Set takes eeee Byte returns_nothing external RB2__cmd_m define RB2_Servo4_C_High_Get simple Byte constant cmd@RB2_Servo4_C_High_Get RB2_Servo4_C_High_Get = rb2_servo4_c_high_get@(160b) routine high_get@RB2_Servo4_C takes servo4 RB2_Servo4_C takes command RB2_Servo4_C_High_Get takes ss Byte returns Byte external RB2__cmd_m_b define RB2_Servo4_C_Low_Get simple Byte constant cmd@RB2_Servo4_C_Low_Get RB2_Servo4_C_Low_Get = rb2_servo4_c_low_get@(164b) routine low_get@RB2_Servo4_C takes servo4 RB2_Servo4_C takes command RB2_Servo4_C_Low_Get takes ss Byte returns Byte external RB2__cmd_m_b define RB2_Servo4_C_Enables_Get simple Byte constant cmd@RB2_Servo4_C_Enables_Get RB2_Servo4_C_Enables_Get = rb2_servo4_c_enables_get@(168b) routine enables_get@RB2_Servo4_C takes servo4 RB2_Servo4_C takes command RB2_Servo4_C_Enables_Get returns Byte external RB2__cmd_c_b