ucl 2.0 # Copyright (c) 2006 by Wayne C. Gramlich # All rights reserved. # This is the code for the MiniMotor2-C module. All of the # code is stashed away in the {rb2_motor2} library so that it # can be shared with the MidiMotor2-C module. # We use the PIC16F688 for this module: library $pic16f688 # The module runs at 20MHz: library clock20mhz # The {$eusart} module needs the following 2 constants defined # before inclusion: constant $eusart_clock = clock_rate constant $eusart_factor = 4 library $eusart # The {rb2_motor2} library needs the following 4 constants defined # before inclusion: constant rb2_motor2_forward1 = 1 constant rb2_motor2_reverse1 = 8 constant rb2_motor2_forward2 = 2 constant rb2_motor2_reverse2 = 4 library rb2_motor2 # The {rb2bus_pic16f688} library provides the various bus interface # procedures appropriate for a PIC16F688 microcontroller. library rb2bus_pic16f688 # The module uses a 20MHz resonator; thus, the oscillator mode is HS: configure fosc=hs # Besides the bus RX/TX lines, only 4 other lines are used to # control the motor -- RC<0:3>: package pdip pin 1 = power_supply pin 2 = osc1 pin 3 = ra4_nc, name=nc4 pin 4 = ra3_nc, name=nc3 pin 5 = rx, name=rx, bit=rx_bit pin 6 = tx, name=tx, bit=tx_bit pin 7 = rc3_out, name=m2b, mask=m2b_mask, bit=m2b_bit pin 8 = rc2_out, name=m2a, mask=m2a_mask, bit=m2a_bit pin 9 = rc1_out, name=m1b, mask=m1b_mask, bit=m1b_bit pin 10 = rc0_out, name=m1a, mask=m1a_mask, bit=m1a_bit pin 11 = ra2_nc, name=nc2 pin 12 = ra1_nc, name=nc1 pin 13 = ra0_nc, name=nc0 pin 14 = ground origin 0 procedure main arguments_none returns_nothing # This is the main procedure: loop_forever call rb2_motor2_main(2) # The {rb2_motor2} library needs the {id} string defined as well: string id = "\16,0,2,3,3,12\MiniMotor2-C\7\Gramson"