home *** CD-ROM | disk | FTP | other *** search
/ ifirobotics.com / www.ifirobotics.com.tar / www.ifirobotics.com / docs / isaac16-default-002.bsx < prev    next >
Text File  |  2007-12-18  |  17KB  |  506 lines

  1. ' PROGRAM:    ISSAC 16 Default Code with One or Two Joystick Control Rev 002
  2. ' Written by: Innovation First, Inc.
  3. ' Date:       20 SEP 01
  4. '
  5. ' Define BS2-SX Project Files
  6. '
  7. ' {$STAMP BS2SX}
  8.  
  9.  
  10.  
  11.  
  12. '========== DECLARE VARIABLES ================================================
  13. '=============================================================================
  14. '  Below is a list of declared input and output variables.  Comment or un-comment
  15. '  the variables as needed.  Declare any additional variables required in
  16. '  your main program loop.  Note that you may only use 26 total variables.
  17.  
  18.  
  19. '---------- Operator Interface (OI) - Analog Inputs --------------------------
  20.  
  21. p1_x        VAR byte    'Port 1, X-axis on Joystick
  22. p2_x        VAR byte    'Port 2, X-axis on Joystick
  23. p3_x        VAR byte    'Port 3, X-axis on Joystick
  24. p4_x        VAR byte    'Port 4, X-axis on Joystick
  25.  
  26. p1_y        VAR byte    'Port 1, Y-axis on Joystick
  27. p2_y        VAR byte    'Port 2, Y-axis on Joystick
  28. p3_y        VAR byte    'Port 3, Y-axis on Joystick
  29. p4_y        VAR byte    'Port 4, Y-axis on Joystick
  30.  
  31. p1_wheel    VAR byte    'Port 1, Wheel on Joystick
  32. p2_wheel    VAR byte    'Port 2, Wheel on Joystick
  33. p3_wheel    VAR byte    'Port 3, Wheel on Joystick
  34. p4_wheel    VAR byte    'Port 4, Wheel on Joystick
  35.  
  36. 'p1_aux    VAR byte    'Port 1, Aux on Joystick
  37. 'p2_aux    VAR byte    'Port 2, Aux on Joystick
  38. 'p3_aux    VAR byte    'Port 3, Aux on Joystick
  39. 'p4_aux    VAR byte    'Port 4, Aux on Joystick
  40.  
  41. PWM1        Var byte    'Modified output for PWM1    <----ADDED
  42. PWM2        Var byte    'Modified output for PWM2    <----ADDED
  43.  
  44. '---------- Operator Interface - Digital Inputs ------------------------------
  45.  
  46. oi_swA    VAR byte    'OI Digital Switch Inputs 1 thru 8
  47. oi_swB    VAR byte    'OI Digital Switch Inputs 9 thru 16
  48.  
  49.  
  50. '---------- Robot Controller (RC) - Analog Inputs ----------------------------
  51.  
  52. 'sensor1    VAR byte    'RC Analog Input 1, connector pin 2
  53. 'sensor2    VAR byte    'RC Analog Input 2, connector pin 16
  54. 'sensor3    VAR byte    'RC Analog Input 3, connector pin 5
  55. 'sensor4    VAR byte    'RC Analog Input 4, connector pin 19
  56. 'sensor5    VAR byte    'RC Analog Input 5, connector pin 8
  57. 'sensor6    VAR byte    'RC Analog Input 6, connector pin 22
  58. 'sensor7    VAR byte    'RC Analog Input 7, connector pin 11
  59. 'bat_volt    VAR byte    'RC Analog Input 8, hardwired to the Battery
  60.                 'Vin = ((4.7/14.7)* Battery voltage)-0.4
  61.                 'Binary Battery Voltage = (Vin/5.0 V)*255
  62.  
  63.  
  64. '---------- Robot Controller - Digital Inputs --------------------------------
  65.  
  66. rc_swA    VAR byte    'RC Digital Inputs 1 thru 8
  67. rc_swB    VAR byte    'RC Digital Inputs 9 thru 16
  68.  
  69.  
  70. '---------- Robot Controller - Digital Outputs -------------------------------
  71.  
  72. relayA    VAR byte
  73. relayB    VAR byte
  74.  
  75.  
  76. '---------- Misc. ------------------------------------------------------------
  77.  
  78. packet_num    VAR byte
  79. 'delta_t    VAR byte
  80.  
  81.  
  82.  
  83. '========== DEFINE ALIASES ===================================================
  84. '=============================================================================
  85. '  Aliases are variables which are sub-divisions of variables defined
  86. '  above.  Aliases don't require any additional RAM.
  87.  
  88.  
  89. '---------- Aliases for each OI switch input ---------------------------------
  90. '  Below are aliases for the digital inputs located on the Operator Interface.
  91. '  Ports 1 & 3 have their inputs duplicated in ports 4 & 2 respectively.  The 
  92. '  inputs from ports 1 & 3 may be disabled via the 'Disable' dip switch 
  93. '  located on the Operator Interface.  See Users Manual for details.
  94.  
  95. p1_sw_trig    VAR oi_swA.bit0    'Joystick Trigger Button,        same as Port4 pin5 
  96. p1_sw_top    VAR oi_swA.bit1    'Joystick Top Button,            same as Port4 pin8
  97. p1_sw_aux1    VAR oi_swA.bit2    'Aux input,                same as Port4 pin9
  98. p1_sw_aux2    VAR oi_swA.bit3    'Aux input,                same as Port4 pin15
  99.  
  100. p3_sw_trig    VAR oi_swA.bit4    'Joystick Trigger Button,        same as Port2 pin5 
  101. p3_sw_top    VAR oi_swA.bit5    'Joystick Top Button,            same as Port2 pin8
  102. p3_sw_aux1    VAR oi_swA.bit6    'Aux input,                same as Port2 pin9
  103. p3_sw_aux2    VAR oi_swA.bit7    'Aux input,                same as Port2 pin15
  104.  
  105. p2_sw_trig    VAR oi_swB.bit0    'Joystick Trigger Button
  106. p2_sw_top    VAR oi_swB.bit1    'Joystick Top Button
  107. p2_sw_aux1    VAR oi_swB.bit2    'Aux input
  108. p2_sw_aux2    VAR oi_swB.bit3    'Aux input
  109.  
  110. p4_sw_trig    VAR oi_swB.bit4    'Joystick Trigger Button
  111. p4_sw_top    VAR oi_swB.bit5    'Joystick Top Button
  112. p4_sw_aux1    VAR oi_swB.bit6    'Aux input
  113. p4_sw_aux2    VAR oi_swB.bit7    'Aux input
  114.  
  115.  
  116. '---------- Aliases for each RC switch input ---------------------------------
  117. '  Below are aliases for the digital inputs located on the Robot Controller.
  118.  
  119. rc_sw1    VAR rc_swA.bit0
  120. rc_sw2    VAR rc_swA.bit1
  121. rc_sw3    VAR rc_swA.bit2
  122. rc_sw4    VAR rc_swA.bit3
  123. rc_sw5    VAR rc_swA.bit4
  124. rc_sw6    VAR rc_swA.bit5
  125. rc_sw7    VAR rc_swA.bit6
  126. rc_sw8    VAR rc_swA.bit7
  127. rc_sw9    VAR rc_swB.bit0
  128. rc_sw10    VAR rc_swB.bit1
  129. rc_sw11    VAR rc_swB.bit2
  130. rc_sw12    VAR rc_swB.bit3
  131. rc_sw13    VAR rc_swB.bit4
  132. rc_sw14    VAR rc_swB.bit5
  133. rc_sw15    VAR rc_swB.bit6
  134. rc_sw16    VAR rc_swB.bit7
  135.  
  136.  
  137. '---------- Aliases for each RC Relay outputs ---------------------------------
  138. '  Below are aliases for the relay outputs located on the Robot Controller.
  139.  
  140. relay1_fwd    VAR RelayA.bit0
  141. relay1_rev    VAR RelayA.bit1
  142. relay2_fwd    VAR RelayA.bit2
  143. relay2_rev    VAR RelayA.bit3
  144. relay3_fwd    VAR RelayA.bit4
  145. relay3_rev    VAR RelayA.bit5
  146. relay4_fwd    VAR RelayA.bit6
  147. relay4_rev    VAR RelayA.bit7
  148.  
  149. relay5_fwd    VAR RelayB.bit0
  150. relay5_rev    VAR RelayB.bit1
  151. relay6_fwd    VAR RelayB.bit2
  152. relay6_rev    VAR RelayB.bit3
  153. relay7_fwd    VAR RelayB.bit4
  154. relay7_rev    VAR RelayB.bit5
  155. relay8_fwd    VAR RelayB.bit6
  156. relay8_rev    VAR RelayB.bit7
  157.  
  158.  
  159.  
  160.  
  161. '========= DEFINE CONSTANTS FOR INITIALIZATION ===============================
  162. '=============================================================================
  163. '  The initialization code is used to select the input data used by PBASIC.
  164. '  The Master micro-processor (uP) sends the data you select to the BS2SX
  165. '  PBASIC uP.  You may select up to 26 constants, corresponding
  166. '  to 26 variables, from the 32 available to you.  Make sure that you have 
  167. '  variables for all the bytes recieved in the serin command.
  168. '
  169. '  The constants below have a "c_" prefix, as compared to the variables that 
  170. '  they will represent.
  171. '
  172. '  Set the Constants below to 1 for each data byte you want to recieve.
  173. '  Set the Constants below to 0 for the unneeded data bytes.
  174.  
  175.  
  176. '---------- Set the Initialization constants you want to read ----------------
  177.  
  178. c_p1_y        CON    1
  179. c_p2_y        CON    1
  180. c_p3_y        CON    1
  181. c_p4_y        CON    1
  182.  
  183. c_p1_x        CON    1
  184. c_p2_x        CON    1
  185. c_p3_x        CON    1
  186. c_p4_x        CON    1
  187.  
  188. c_p1_wheel        CON    1
  189. c_p2_wheel        CON    1
  190. c_p3_wheel        CON    1
  191. c_p4_wheel        CON    1
  192.  
  193. c_p1_aux        CON    0
  194. c_p2_aux        CON    0
  195. c_p3_aux        CON    0
  196. c_p4_aux        CON    0
  197.  
  198. c_oi_swA        CON    1
  199. c_oi_swB        CON    1
  200.  
  201. c_sensor1        CON    0
  202. c_sensor2        CON    0
  203. c_sensor3        CON    0
  204. c_sensor4        CON    0
  205. c_sensor5        CON    0
  206. c_sensor6        CON    0
  207. c_sensor7        CON    0
  208. c_batt_volt    CON    0
  209.  
  210. c_rc_swA        CON    1
  211. c_rc_swB        CON    1
  212.  
  213. c_delta_t        CON    0
  214. c_PB_mode        CON    0
  215. c_packet_num    CON    1
  216. c_res01        CON    0
  217.  
  218.  
  219. '---------- Initialization Constant VOLTAGE - USER DEFINED -------------------
  220. '  This is the 'Low Battery' detect voltage.  The 'Low Battery' LED will
  221. '  blink when the voltage drops below this value.
  222. '  Basically, the value = ((DESIRED FLASH VOLTAGE * 16.3) - 15.2)
  223. '  Example, for a 10 Volt Flash trigger, set value = 148.
  224.  
  225. dataInitVolt    CON 132    '9.0 Volts Flash Trigger
  226.  
  227.  
  228.  
  229. '========== DEFINE CONSTANTS (DO NOT CHANGE) =================================
  230. '=============================================================================
  231. ' Baud rate for communications with User CPU
  232. OUTBAUD    CON    20    ' (62500, 8N1, Noninverted)
  233. INBAUD    CON    20    ' (62500, 8N1, Noninverted)
  234.  
  235. USERCPU    CON 4
  236. FPIN        CON 1
  237. COMA        CON 1
  238. COMB        CON 2
  239. COMC        CON 3
  240.  
  241.  
  242.  
  243.  
  244. '========== MAIN PROGRAM =====================================================
  245. '=============================================================================
  246.  
  247.  
  248.  
  249.  
  250. '---------- Input & Output Declarations --------------------------------------
  251.  
  252. Output    COMB
  253. Input        COMA
  254. Input        COMC
  255.  
  256. Output    7    'define Basic Run LED on RC => out7
  257.  
  258. Output      8    'define Robot Feedback LED => out8    => PWM1 Green
  259. Output      9    'define Robot Feedback LED => out9    => PWM1 Red
  260. Output      10    'define Robot Feedback LED => out10    => PWM2 Green
  261. Output      11    'define Robot Feedback LED => out11 => PWM2 Red
  262. Output      12    'define Robot Feedback LED => out12 => Relay1 Red
  263. Output      13    'define Robot Feedback LED => out13 => Relay1 Green
  264. Output      14    'define Robot Feedback LED => out14 => Relay2 Red
  265. Output      15    'define Robot Feedback LED => out15 => Relay2 Green
  266.  
  267.  
  268. '---------- Initialize Inputs & Outputs --------------------------------------
  269.  
  270. Out7  = 1        'Basic Run LED on RC
  271. Out8  = 0        'PWM1 LED - Green
  272. Out9  = 0        'PWM1 LED - Red
  273. Out10 = 0        'PWM2 LED - Green
  274. Out11 = 0        'PWM2 LED - Red
  275. Out12 = 0        'Relay1 LED - Red
  276. Out13 = 0        'Relay1 LED - Green
  277. Out14 = 0        'Relay2 LED - Red
  278. Out15 = 0        'Relay2 LED - Green
  279.  
  280. p1_x = 127        'Port 1, X-axis on Joystick
  281. p2_x = 127        'Port 2, X-axis on Joystick
  282. p3_x = 127        'Port 3, X-axis on Joystick
  283. p4_x = 127        'Port 4, X-axis on Joystick
  284.  
  285. p1_y = 127        'Port 1, Y-axis on Joystick
  286. p2_y = 127        'Port 2, Y-axis on Joystick
  287. p3_y = 127        'Port 3, Y-axis on Joystick
  288. p4_y = 127        'Port 4, Y-axis on Joystick
  289.  
  290. p1_wheel = 127    'Port 1, Wheel on Joystick
  291. p2_wheel = 127    'Port 2, Wheel on Joystick
  292. p3_wheel = 127    'Port 3, Wheel on Joystick
  293. p4_wheel = 127    'Port 4, Wheel on Joystick
  294.  
  295. 'p1_aux = 127    'Port 1, Aux Analog
  296. 'p2_aux = 127    'Port 2, Aux Analog
  297. 'p3_aux = 127    'Port 3, Aux Analog
  298. 'p4_aux = 127    'Port 4, Aux Analog
  299.  
  300.  
  301.  
  302.  
  303. '========== PBASIC - MASTER uP INITIALIZATION ROUTINE ========================
  304. '=============================================================================
  305. '  DO NOT CHANGE THIS!  DO NOT MOVE THIS!
  306. '  The init routine sends 5 bytes to the Master uP, defining which data bytes to receive.
  307. '  1)  Collect init.
  308. '  2)  Lower the COMA line, which is the clk line for the shift out command.
  309. '  3)  Lower COMB line to tell pic that we are ready to send init data.
  310. '  4)  Wait for pic to lower the COMC line, signaling pic is ready for data.
  311. '  5)  Now send out init dat to pic, all 5 bytes.
  312. '  6)  Now set direction and levels for the COMA and COMB pins.
  313.  
  314. tempA        CON    c_p3_x <<1 + c_p4_x <<1 + c_p1_x <<1 + c_p2_x <<1 + c_rc_swB
  315. dataInitA    CON    tempA <<1 + c_rc_swA <<1 + c_oi_swB <<1 + c_oi_swA
  316. tempB        CON    c_sensor4 <<1 + c_sensor3 <<1 + c_p1_y <<1 + c_p2_y <<1 + c_sensor2
  317. dataInitB    CON    tempB <<1 + c_sensor1 <<1 + c_packet_num <<1 + c_PB_mode
  318. tempC        CON    c_batt_volt <<1 + c_sensor7 <<1 + c_p1_wheel <<1 + c_p2_wheel <<1 + c_sensor6
  319. dataInitC    CON    tempC <<1 + c_sensor5 <<1 + c_p3_y <<1 + c_p4_y
  320. tempD        CON    c_res01 <<1 + c_delta_t <<1 + c_p3_aux <<1 + c_p4_aux <<1 + c_p1_aux
  321. dataInitD    CON    tempD <<1 + c_p2_aux  <<1 + c_p3_wheel <<1 + c_p4_wheel
  322.  
  323. Output    COMA
  324. low        COMA
  325. low        COMB
  326. Wait_init:    if IN3 = 1 then Wait_init:
  327. Shiftout    COMB,COMA,1, [dataInitA,dataInitB,dataInitC,dataInitD,dataInitVolt]
  328. Input        COMA
  329. high        COMB
  330.  
  331.  
  332.  
  333.  
  334. '========== MAIN LOOP ========================================================
  335. '=============================================================================
  336.  
  337. MainLoop:
  338.  
  339.  
  340. '---------- Serin Command - Get Data from Master uP --------------------------
  341. '  Construct the "serin" command using the following rules:
  342. '  1) There must be one variable for every input defined in the "Define Constants for Init" section.
  343. '  2) The order must match the order in the EXAMPLE SERIN COMMAND below.
  344. '  3) The total number of all variables may not exceed 26.
  345. '  4) Only use one "Serin" command.
  346. '  5) The Serin command must occupy one line.
  347. '
  348. '  If you see a BASIC INIT ERR on the Robot Controller after programming and pressing RESET, then
  349. '  there is a problem with the Serin command below.  Check the number of variables.  A BASIC INIT ERR
  350. '  will not occur if you have the variables in the wrong order, however your code will not work correctly.
  351. '
  352. '  EXAMPLE SERIN COMMAND
  353. '  This example exceed the 26 variable limit and is not on one line:
  354. '
  355. '  Serin COMA\COMB, INBAUD, [oi_swA,oi_swB,rc_swA,rc_swB,p2_x,p1_x,p4_x,p3_x,PB_mode,packet_num,sensor1,
  356. '                     sensor2,p2_y,p1_y,sensor3,sensor4,p4_y,p3_y,sensor5,sensor6,p2_wheel,p1_wheel,
  357. '                     sensor7,sensor8,p4_wheel,p3_wheel,p2_aux,p1_aux,p4_aux,p3_aux,delta_t,res01]
  358. '
  359.    Serin COMA\COMB, INBAUD, [oi_swA,oi_swB,rc_swA,rc_swB,p2_x,p1_x,p4_x,p3_x,packet_num,p2_y,p1_y,p4_y,p3_y,p2_wheel,p1_wheel,p4_wheel,p3_wheel]
  360.  
  361.  
  362.  
  363.  
  364. '---------- Blink BASIC RUN LED ----------------------------------------------
  365. Toggle 7            'Basic Run LED on the RC is toggled ON/OFF every loop.
  366.  
  367.  
  368.  
  369.  
  370. '========== PERFORM OPERATIONS ===============================================
  371. '  Add your custom code here.
  372. '  Delete any of the following sections below (except for Output Data) as desired.
  373.  
  374.  
  375. '---------- Buttons to Relays ------------------------------------------------
  376.  
  377. '  The &  used below is the PBASIC symbol for AND
  378. '  The &~ used below is the PBASIC symbol for AND NOT
  379.  
  380. relay1_fwd = p1_sw_trig &~ rc_sw1     'Port 1 Trigger = Relay 1 Forward
  381.                             'Relay 1 wont go Forward if rc_sw1 is ON
  382.  
  383. relay1_rev = p1_sw_top &~ rc_sw2     'Port 1 Thumb = Relay 1 Reverse
  384.                             'Relay 1 wont go Reverse if rc_sw2 is ON
  385.  
  386. relay2_fwd = p2_sw_trig &~ rc_sw3     'Port 2 Trigger = Relay 2 Forward
  387.                             'Relay 2 wont go Forward if rc_sw3 is ON
  388.  
  389. relay2_rev = p2_sw_top &~ rc_sw4     'Port 2 Thumb = Relay 2 Reverse
  390.                             'Relay 2 wont go Reverse if rc_sw4 is ON
  391.     
  392. relay3_fwd = p3_sw_trig            'Port 3 Trigger = Relay 3 Forward
  393. relay3_rev = p3_sw_top             'Port 3 Thumb   = Relay 3 Reverse
  394. relay4_fwd = p4_sw_trig            'Port 4 Trigger = Relay 4 Forward
  395. relay4_rev = p4_sw_top             'Port 4 Thumb   = Relay 4 Reverse
  396.  
  397.  
  398. relay5_fwd = p1_sw_aux1            'Port 1 Aux1 = Relay 5 Forward
  399. relay5_rev = p1_sw_aux2            'Port 1 Aux2 = Relay 5 Forward
  400. relay6_fwd = p3_sw_aux1            'Port 3 Aux1 = Relay 6 Forward
  401. relay6_rev = p3_sw_aux2            'Port 3 Aux2 = Relay 6 Forward
  402. relay7_fwd = p4_sw_aux1            'Port 4 Aux1 = Relay 7 Forward
  403. relay7_rev = p4_sw_aux2            'Port 4 Aux2 = Relay 7 Reverse
  404. relay8_fwd = 1                    'Relay 8 always Forward
  405. relay8_rev = 0                    'Relay 8 always Forward
  406.  
  407. '---------- Feedback LEDs for PWM1, PWM2 -------------------------------------
  408.  
  409. 'Out8  =   p1_y/216        'LED is ON when Victor883 full forward  <---REMOVED
  410. 'Out9  = ~(p1_y/56  max 1)    'LED is ON when Victor883 full reverse  <---REMOVED
  411. 'Out10 =   p2_y/216        'LED is ON when Victor883 full forward  <---REMOVED
  412. 'Out11 = ~(p2_y/56  max 1)    'LED is ON when Victor883 full reverse  <---REMOVED
  413.  
  414. '---------- Feedback LEDs for Relay1, Relay2 ---------------------------------
  415.  
  416. Out13 = relay1_fwd        'LED is ON when Relay 1 is Forward
  417. Out12 = relay1_rev        'LED is ON when Relay 1 is Reverse
  418. Out15 = relay2_fwd        'LED is ON when Relay 2 is Forward
  419. Out14 = relay2_rev        'LED is ON when Relay 2 is Reverse
  420.  
  421.  
  422. '---------- PWM outputs Limited by Limit Switches  ---------------------------
  423.  
  424. if rc_sw5 = 0 then next1:
  425.     p3_y = p3_y MAX 127
  426. next1:
  427.  
  428. if rc_sw6 = 0 then next2:
  429.     p3_y = p3_y MIN 127
  430. next2:
  431.  
  432. if rc_sw7 = 0 then next3:
  433.     p4_y = p4_y MAX 127
  434. next3:
  435.  
  436. if rc_sw8 = 0 then next4:
  437.     p4_y = p4_y MIN 127
  438. next4:
  439.  
  440. if rc_sw9 = 0 then next5:
  441.     p1_wheel = p1_wheel MAX 127
  442. next5:
  443.  
  444. if rc_sw10 = 0 then next6:
  445.     p1_wheel = p1_wheel MIN 127
  446. next6:
  447.  
  448. if rc_sw11 = 0 then next7:
  449.     p2_wheel = p2_wheel MAX 127
  450. next7:
  451.  
  452. if rc_sw12 = 0 then next8:
  453.     p2_wheel = p2_wheel MIN 127
  454. next8:
  455.  
  456. if rc_sw13 = 0 then next9:
  457.     p3_wheel = p3_wheel MAX 127
  458. next9:
  459.  
  460. if rc_sw14 = 0 then next10:
  461.     p3_wheel = p3_wheel MIN 127
  462. next10:
  463.  
  464. if rc_sw15 = 0 then next11:
  465.     p4_wheel = p4_wheel MAX 127
  466. next11:
  467.  
  468. if rc_sw16 = 0 then next12:
  469.     p4_wheel = p4_wheel MIN 127
  470. next12:
  471.  
  472.  
  473. '---------- One Joystick Drive + Feedback LEDs for PWM1, PWM2 -------------------------
  474. '  This section modified the output of PWM1, and PWM 2 for control from one
  475. '  joystick (Port 1).  The Out8 thru Out11 lines control the Feedback LEDs.
  476. '    Y-axis controls speed.
  477. '    X-axis turns.
  478. '    PWM1 - Left motor.
  479. '    PWM2 - Right motor.
  480.  
  481. PWM1 = (((2000 + p1_y - p1_x + 127) Min 2000 Max 2254) - 2000)        '<---ADDED
  482. PWM2 = (((2000 + p1_y + p1_x - 127) Min 2000 Max 2254) - 2000)        '<---ADDED
  483.  
  484. Out8  =   pwm1/216        'LED is ON when Victor883 full forward    '<---ADDED
  485. Out9  = ~(pwm1/56  max 1)    'LED is ON when Victor883 full reverse    '<---ADDED
  486. Out10 =   pwm2/216        'LED is ON when Victor883 full forward    '<---ADDED
  487. Out11 = ~(pwm2/56  max 1)    'LED is ON when Victor883 full reverse    '<---ADDED
  488.  
  489.  
  490.  
  491. '========== OUTPUT DATA ======================================================
  492. '=============================================================================
  493. '  The Serout line sends data to the Output uP.  The Output uP passes this to each PWM 1-16
  494. '  and Relay 1-8.  The Output uP will not output data if there is no communication with the
  495. '  Operator Interface or if the Competition Mode is Disabled.  Do not delete any elements
  496. '  from the Serout array.  Set unused PWM outputs to 127.  Set unused relay outputs to 0.
  497. '
  498. '  Serout USERCPU, OUTBAUD, [255,255,(PWM1),relayA,(PWM2),relayB,(PWM3),(PWM4),(PWM5),(PWM6),(PWM7),(PWM8),(PWM9),(PWM10),(PWM11),(PWM12),(PWM13),(PWM14),(PWM15),(PWM16)]
  499.  
  500.    Serout USERCPU, OUTBAUD, [255,255,pwm1,relayA,pwm2,relayB,p2_y,p3_y,p4_y,p3_x,p4_x,p1_wheel,127,127,127,127,127,127,127,127]
  501. '  ^---ADDED PWM1,PWM2 TO SEROUT COMMAND ABOVE
  502.  
  503.  
  504. Goto MainLoop:
  505.  
  506. Stop