-- -- name : e0003.jal -- author : Wouter van Ooijen -- date : 21-Sep-1998 -- purpose : jal example -- -- firmware for a line following robot -- port B drives 2 4-phase stepper motors via an ULN2803. -- a0 and a1 are connected to 2 white-is-low reflective sensors. -- a2 and a3 drive 2 LEDs which show the state of the sensor inputs. -- target configuration: 16f84 with 10 Mhz Xtal include 16f84_10 -- standard library include jlib -- configure the appropriate port and pin directions port_b_direction = all_output pin_a0_direction = input pin_a1_direction = input pin_a2_direction = output pin_a3_direction = output -- provide steering for the two stepper motors -- and wait the appropriate time (time depends on the -- stepper motors used). procedure steppers( byte in a, byte in b ) is port_b = a + ( b << 4 ) delay_1mS( 10 ) end procedure -- variables for the current steering of the stepper motors -- initialised to appropriate intial values var byte left_stepper = 0b_0001 var byte right_stepper = 0b_0001 forever loop -- copy the sensor values to the indicator LEDs pin_a2 = pin_a0 pin_a3 = pin_a1 -- step each motor only when the associated -- sensor sees white if ! pin_a0 then stepper_motor_half_forward( right_stepper ) end if if ! pin_a1 then stepper_motor_half_forward( left_stepper ) end if -- provide steering and wait steppers( left_stepper, right_stepper ) end loop
file: /Techref/microchip/language/jal/doc/e0003.jal, 1KB, , updated: 1998/12/23 14:18, local time: 2024/8/14 23:27,
18.218.79.100:LOG IN
|
©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions? <A HREF="http://sxlist.com/techref/microchip/language/jal/doc/e0003.jal"> microchip language jal doc e0003</A> |
Did you find what you needed? |
Welcome to sxlist.com!sales, advertizing, & kind contributors just like you! Please don't rip/copy (here's why Copies of the site on CD are available at minimal cost. |
Welcome to sxlist.com! |
.