-- -- Program: bipolar.jal library -- -- Date: 14 July 2000 -- -- Author: G. Shearer -- Vanderbilt University -- Nashville, TN -- -- Purpose: for driving both bipolar and unipolar stepper motors -- uses Allegro UDN2998 dual H bridge -- Copyright (C) 2000 G. Shearer -- -- This library is free software; you can redistribute it and/or -- modify it under the terms of the GNU Library General Public -- License as published by the Free Software Foundation; either -- version 2 of the License, or (at your option) any later version. -- -- This library is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- Library General Public License for more details. -- -- You should have received a copy of the GNU Library General Public -- License along with this library; if not, write to the -- Free Software Foundation, Inc., 59 Temple Place - Suite 330, -- Boston, MA 02111-1307, USA. -- procedure stepout ( byte in seq, byte in speed ) is -- sends seq nibble to output if seq == 0 then port_a = 0b_0001 elsif seq == 1 then port_a = 0b_1001 elsif seq == 2 then port_a = 0b_0101 elsif seq == 3 then port_a = 0b_0110 elsif seq == 4 then port_a = 0b_0100 elsif seq == 5 then port_a = 0b_1000 elsif seq == 6 then port_a = 0b_0000 elsif seq == 7 then port_a = 0b_0010 else port_a = 0b_1010 end if delay_1ms( speed ) end procedure procedure fullforward ( byte in speed ) is -- makes one full step in the forward direction stepout( 1, speed ) stepout( 7, speed ) stepout( 5, speed ) stepout( 3, speed ) end procedure procedure fullreverse ( byte in speed ) is -- makes one full step in the reverse direction stepout( 3, speed ) stepout( 5, speed ) stepout( 7, speed ) stepout( 1, speed ) end procedure procedure halfstep ( bit in direction, byte in out seq, byte in speed ) is -- makes one half step in the proper direction and remembers which half step for 4 loop if direction == true & seq < 7 then seq = seq + 1 elsif direction == true & seq == 7 then seq = 0 elsif direction == false & seq > 0 then seq = seq - 1 elsif direction == false & seq == 0 then seq = 7 end if stepout ( seq, speed ) end loop end procedure procedure fullstep ( bit in direction, byte in speed ) is -- detects forward/reverse direction and calls proper fullstep procedure if direction == true then fullforward ( speed ) else fullreverse ( speed ) end if end procedure
|file: /Techref/piclist/jal/bipolib.jal, 2KB, , updated: 2000/8/14 13:20, local time: 2021/10/21 10:16,
|©2021 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://www.piclist.com/techref/piclist/jal/bipolib.jal"> piclist jal bipolib</A>
|Did you find what you needed?|
PICList 2021 contributors:
o List host: MIT, Site host massmind.org, Top posters @20211021 Neil, Harold Hallikainen, Alan Pearce, RussellMc, Bob Blick, Allen Mulvey, Dwayne Reid, madscientistatlarge, Sean Breheny, Justin Richards,
* Page Editors: James Newton, David Cary, and YOU!
* Roman Black of Black Robotics donates from sales of Linistep stepper controller kits.
* Ashley Roll of Digital Nemesis donates from sales of RCL-1 RS232 to TTL converters.
* Monthly Subscribers: Gregg Rew. on-going support is MOST appreciated!
* Contributors: Richard Seriani, Sr.
Welcome to www.piclist.com!