easy_c 1.0 # IO8 module declarations: # The IO8 module provides 8 lines of mixed digital output, # digitial input, and/or analog input. The Anlog input # can be read with an accuracy of 10-bits between 0-5V. # Each line has a dedicated 3-pin header with ground, # 5 volts, and signal I/O pin. # IO8 (Revision C) Summary: # # io8 :@= create@RB2_IO8_C(8s) # # dddddddd := digital8_get@(io8, cmd) # This routine returns a value of type Byte. # Return the digital input values for all 8 pins. # # call digital8_set@(io8, cmd, dddddddd) # The argument dddddddd is of type Byte. # Set digital outputs to {dddddddd}. # # dddddddd := direction_get@(io8, cmd) # This routine returns a value of type Byte. # Return direction of all 8 pins. 0=output and 1=input. # # call direction_set@(io8, cmd, dddddddd) # The argument dddddddd is of type Byte. # Set direction mask to {dddddddd}. 0=output and 1=input. # # aaaaaaaa := analog_mask_get@(io8, cmd) # This routine returns a value of type Byte. # Return direction of all 8 pins. 0=digital and 1=analog. # # call analog_mask_set@(io8, cmd, aaaaaaaa) # The argument aaaaaaaa is of type Byte. # Set analog mask to {aaaaaaaa}. 0=digital and 1=analog. # # aaaaaaaa := analog8_get@(io8, cmd, ccc) # The argument ccc is of type Byte. # This routine returns a value of type Byte. # Return 8 bits from channel {ccc}. # # bb := analog10_get@(io8, cmd, ccc) # The argument ccc is of type Byte. # This routine returns a value of type Byte. # Return last 2 least significant bits from channel {ccc}. # # iiiiiiii := low_set@(io8, cmd, dddd) # The argument dddd is of type Byte. # This routine returns a value of type Byte. # Set low 4 bits of digital outputs to {dddd}. Return all 8 bits. # # iiiiiiii := high_set@(io8, cmd, dddd) # The argument dddd is of type Byte. # This routine returns a value of type Byte. # Set high 4 bits of digital outputs to {dddd}. Return all 8 bits. # # call direction_bit_clear@(io8, cmd, bbb) # The argument bbb is of type Byte. # Clear bit {bbb} of direction mask. # # call direction_bit_set@(io8, cmd, bbb) # The argument bbb is of type Byte. # Set bit {bbb} of direction mask. # # call analog_mask_bit_clear@(io8, cmd, bbb) # The argument bbb is of type Byte. # Clear bit {bbb} of analog mask. # # call analog_mask_bit_set@(io8, cmd, bbb) # The argument bbb is of type Byte. # Set bit {bbb} of analog mask. # # call digital_bit_clear@(io8, cmd, bbb) # The argument bbb is of type Byte. # Clear bit {bbb} of digital outputs. # # call digital_bit_set@(io8, cmd, bbb) # The argument bbb is of type Byte. # Set bit {bbb} of digital outputs. # # call digital_bit_toggle@(io8, cmd, bbb) # The argument bbb is of type Byte. # Toggle bit {bbb} of digital outputs. # # call pulse_time_configure@(io8, cmd, pphe) # The argument pphe is of type Byte. # Configure IO7 pulse timer where {e}=enable, {h}=high, and {pp}=prescale. # # cccccccc := pulse_count_get@(io8, cmd) # This routine returns a value of type Byte. # Read back pulse count as {cccccccc}. # # call pulse_count_set@(io8, cmd, cccccccc) # The argument cccccccc is of type Byte. # Set pulse count as {cccccccc}. # # hhhhhhhhllllllll := pulse_length_get@(io8, cmd) # This routine returns a value of type Short. # Get pulse length as {hhhhhhhh llllllll} timer ticks. # # tttttttt := threshold_get@(io8, cmd) # This routine returns a value of type Byte. # Get analog threshold as {tttttttt}. # # call threshold_set@(io8, cmd, tttttttt) # The argument tttttttt is of type Byte. # Set analog threshold to {tttttttt}. # # vvvvvvvv := analog_thresholded_get@(io8, cmd) # This routine returns a value of type Byte. # Get analog values {vvvvvvvv} compared to analog threshold. # # End of summary # IO8 (Revision C) declarations: define RB2_IO8_C simple Short routine create@RB2_IO8_C takes address Short returns RB2_IO8_C external RB2__cmd_new # Create and return new {RB2_IO8_C} object # connected to IO8 module at {address}. routine select@RB2_IO8_C takes io8 RB2_IO8_C returns Logical external RB2__select define RB2_IO8_C_Digital8_Get simple Byte constant cmd@RB2_IO8_C_Digital8_Get RB2_IO8_C_Digital8_Get = rb2_io8_c_digital8_get@(0b) routine digital8_get@RB2_IO8_C takes io8 RB2_IO8_C takes command RB2_IO8_C_Digital8_Get returns Byte external RB2__cmd_c_b define RB2_IO8_C_Digital8_Set simple Byte constant cmd@RB2_IO8_C_Digital8_Set RB2_IO8_C_Digital8_Set = rb2_io8_c_digital8_set@(1b) routine digital8_set@RB2_IO8_C takes io8 RB2_IO8_C takes command RB2_IO8_C_Digital8_Set takes dddddddd Byte returns_nothing external RB2__cmd_cb define RB2_IO8_C_Direction_Get simple Byte constant cmd@RB2_IO8_C_Direction_Get RB2_IO8_C_Direction_Get = rb2_io8_c_direction_get@(2b) routine direction_get@RB2_IO8_C takes io8 RB2_IO8_C takes command RB2_IO8_C_Direction_Get returns Byte external RB2__cmd_c_b define RB2_IO8_C_Direction_Set simple Byte constant cmd@RB2_IO8_C_Direction_Set RB2_IO8_C_Direction_Set = rb2_io8_c_direction_set@(3b) routine direction_set@RB2_IO8_C takes io8 RB2_IO8_C takes command RB2_IO8_C_Direction_Set takes dddddddd Byte returns_nothing external RB2__cmd_cb define RB2_IO8_C_Analog_Mask_Get simple Byte constant cmd@RB2_IO8_C_Analog_Mask_Get RB2_IO8_C_Analog_Mask_Get = rb2_io8_c_analog_mask_get@(4b) routine analog_mask_get@RB2_IO8_C takes io8 RB2_IO8_C takes command RB2_IO8_C_Analog_Mask_Get returns Byte external RB2__cmd_c_b define RB2_IO8_C_Analog_Mask_Set simple Byte constant cmd@RB2_IO8_C_Analog_Mask_Set RB2_IO8_C_Analog_Mask_Set = rb2_io8_c_analog_mask_set@(5b) routine analog_mask_set@RB2_IO8_C takes io8 RB2_IO8_C takes command RB2_IO8_C_Analog_Mask_Set takes aaaaaaaa Byte returns_nothing external RB2__cmd_cb define RB2_IO8_C_Analog8_Get simple Byte constant cmd@RB2_IO8_C_Analog8_Get RB2_IO8_C_Analog8_Get = rb2_io8_c_analog8_get@(16b) routine analog8_get@RB2_IO8_C takes io8 RB2_IO8_C takes command RB2_IO8_C_Analog8_Get takes ccc Byte returns Byte external RB2__cmd_m_b define RB2_IO8_C_Analog10_Get simple Byte constant cmd@RB2_IO8_C_Analog10_Get RB2_IO8_C_Analog10_Get = rb2_io8_c_analog10_get@(24b) routine analog10_get@RB2_IO8_C takes io8 RB2_IO8_C takes command RB2_IO8_C_Analog10_Get takes ccc Byte returns Byte external RB2__cmd_m_b define RB2_IO8_C_Low_Set simple Byte constant cmd@RB2_IO8_C_Low_Set RB2_IO8_C_Low_Set = rb2_io8_c_low_set@(32b) routine low_set@RB2_IO8_C takes io8 RB2_IO8_C takes command RB2_IO8_C_Low_Set takes dddd Byte returns Byte external RB2__cmd_m_b define RB2_IO8_C_High_Set simple Byte constant cmd@RB2_IO8_C_High_Set RB2_IO8_C_High_Set = rb2_io8_c_high_set@(48b) routine high_set@RB2_IO8_C takes io8 RB2_IO8_C takes command RB2_IO8_C_High_Set takes dddd Byte returns Byte external RB2__cmd_m_b define RB2_IO8_C_Direction_Bit_Clear simple Byte constant cmd@RB2_IO8_C_Direction_Bit_Clear RB2_IO8_C_Direction_Bit_Clear = rb2_io8_c_direction_bit_clear@(64b) routine direction_bit_clear@RB2_IO8_C takes io8 RB2_IO8_C takes command RB2_IO8_C_Direction_Bit_Clear takes bbb Byte returns_nothing external RB2__cmd_m define RB2_IO8_C_Direction_Bit_Set simple Byte constant cmd@RB2_IO8_C_Direction_Bit_Set RB2_IO8_C_Direction_Bit_Set = rb2_io8_c_direction_bit_set@(72b) routine direction_bit_set@RB2_IO8_C takes io8 RB2_IO8_C takes command RB2_IO8_C_Direction_Bit_Set takes bbb Byte returns_nothing external RB2__cmd_m define RB2_IO8_C_Analog_Mask_Bit_Clear simple Byte constant cmd@RB2_IO8_C_Analog_Mask_Bit_Clear RB2_IO8_C_Analog_Mask_Bit_Clear = rb2_io8_c_analog_mask_bit_clear@(80b) routine analog_mask_bit_clear@RB2_IO8_C takes io8 RB2_IO8_C takes command RB2_IO8_C_Analog_Mask_Bit_Clear takes bbb Byte returns_nothing external RB2__cmd_m define RB2_IO8_C_Analog_Mask_Bit_Set simple Byte constant cmd@RB2_IO8_C_Analog_Mask_Bit_Set RB2_IO8_C_Analog_Mask_Bit_Set = rb2_io8_c_analog_mask_bit_set@(88b) routine analog_mask_bit_set@RB2_IO8_C takes io8 RB2_IO8_C takes command RB2_IO8_C_Analog_Mask_Bit_Set takes bbb Byte returns_nothing external RB2__cmd_m define RB2_IO8_C_Digital_Bit_Clear simple Byte constant cmd@RB2_IO8_C_Digital_Bit_Clear RB2_IO8_C_Digital_Bit_Clear = rb2_io8_c_digital_bit_clear@(96b) routine digital_bit_clear@RB2_IO8_C takes io8 RB2_IO8_C takes command RB2_IO8_C_Digital_Bit_Clear takes bbb Byte returns_nothing external RB2__cmd_m define RB2_IO8_C_Digital_Bit_Set simple Byte constant cmd@RB2_IO8_C_Digital_Bit_Set RB2_IO8_C_Digital_Bit_Set = rb2_io8_c_digital_bit_set@(104b) routine digital_bit_set@RB2_IO8_C takes io8 RB2_IO8_C takes command RB2_IO8_C_Digital_Bit_Set takes bbb Byte returns_nothing external RB2__cmd_m define RB2_IO8_C_Digital_Bit_Toggle simple Byte constant cmd@RB2_IO8_C_Digital_Bit_Toggle RB2_IO8_C_Digital_Bit_Toggle = rb2_io8_c_digital_bit_toggle@(112b) routine digital_bit_toggle@RB2_IO8_C takes io8 RB2_IO8_C takes command RB2_IO8_C_Digital_Bit_Toggle takes bbb Byte returns_nothing external RB2__cmd_m define RB2_IO8_C_Pulse_Time_Configure simple Byte constant cmd@RB2_IO8_C_Pulse_Time_Configure RB2_IO8_C_Pulse_Time_Configure = rb2_io8_c_pulse_time_configure@(128b) routine pulse_time_configure@RB2_IO8_C takes io8 RB2_IO8_C takes command RB2_IO8_C_Pulse_Time_Configure takes pphe Byte returns_nothing external RB2__cmd_m define RB2_IO8_C_Pulse_Count_Get simple Byte constant cmd@RB2_IO8_C_Pulse_Count_Get RB2_IO8_C_Pulse_Count_Get = rb2_io8_c_pulse_count_get@(152b) routine pulse_count_get@RB2_IO8_C takes io8 RB2_IO8_C takes command RB2_IO8_C_Pulse_Count_Get returns Byte external RB2__cmd_c_b define RB2_IO8_C_Pulse_Count_Set simple Byte constant cmd@RB2_IO8_C_Pulse_Count_Set RB2_IO8_C_Pulse_Count_Set = rb2_io8_c_pulse_count_set@(153b) routine pulse_count_set@RB2_IO8_C takes io8 RB2_IO8_C takes command RB2_IO8_C_Pulse_Count_Set takes cccccccc Byte returns_nothing external RB2__cmd_cb define RB2_IO8_C_Pulse_Length_Get simple Byte constant cmd@RB2_IO8_C_Pulse_Length_Get RB2_IO8_C_Pulse_Length_Get = rb2_io8_c_pulse_length_get@(154b) routine pulse_length_get@RB2_IO8_C takes io8 RB2_IO8_C takes command RB2_IO8_C_Pulse_Length_Get returns Short external RB2__cmd_c_s define RB2_IO8_C_Threshold_Get simple Byte constant cmd@RB2_IO8_C_Threshold_Get RB2_IO8_C_Threshold_Get = rb2_io8_c_threshold_get@(180b) routine threshold_get@RB2_IO8_C takes io8 RB2_IO8_C takes command RB2_IO8_C_Threshold_Get returns Byte external RB2__cmd_c_b define RB2_IO8_C_Threshold_Set simple Byte constant cmd@RB2_IO8_C_Threshold_Set RB2_IO8_C_Threshold_Set = rb2_io8_c_threshold_set@(181b) routine threshold_set@RB2_IO8_C takes io8 RB2_IO8_C takes command RB2_IO8_C_Threshold_Set takes tttttttt Byte returns_nothing external RB2__cmd_cb define RB2_IO8_C_Analog_Thresholded_Get simple Byte constant cmd@RB2_IO8_C_Analog_Thresholded_Get RB2_IO8_C_Analog_Thresholded_Get = rb2_io8_c_analog_thresholded_get@(182b) routine analog_thresholded_get@RB2_IO8_C takes io8 RB2_IO8_C takes command RB2_IO8_C_Analog_Thresholded_Get returns Byte external RB2__cmd_c_b