Step Motor 28byj-48

Source: Internet
Author: User

The following code is directly used:

# Include "maid" # include "debug_frmwrk.h" # include "LED. H "volatile extends cyclecounter; void delayms (includelay) {uint32_t starttime = cyclecounter; while (while) (cyclecounter-starttime) <= delay);} void implements ick_handler (void) // define ick handler sub-routine (1 ms) {cyclecounter ++;} uint32_t A [8] = {clerk, 0 clerk, 0xff4fffff, 0xff6fffff, 0xff2fffff, 0xff3fffff, clerk, clerk, 0xff9fffff}; int main (void) {javasick_config (clkpwr_getclk (clkpwr_clktype_cpu)/1000); gpio_init (); // ê ¹ äügpio ¿úµäê ± öó gpio _ setdir (<20, gpio_direction_output); gpio_setdir (<21, gpio_direction_output ); gpio_setdir (4,1 <22, gpio_direction_output); gpio_setdir (4,1 <23, gpio_direction_output); While (1) {gpio_setvalue (4, a [0]); delayms (1 ); gpio_clearvalue (xffffffff); gpio_setvalue (4, a [1]); delayms (1); gpio_clearvalue (xffffffff); gpio_setvalue (4, a [2]); delayms (1); gpio_clearvalue (xffffffff); gpio_setvalue (4, a [3]); delayms (1); gpio_clearvalue (xffffffff); gpio_setvalue (4, A [4]); delayms (1); gpio_clearvalue (xffffffff); gpio_setvalue (4, a [5]); delayms (1); gpio_clearvalue (xffffffff ); gpio_setvalue (4, a [6]); delayms (1); gpio_clearvalue (4, 0 xffffffff); gpio_setvalue (4, a [7]); delayms (1 ); gpio_clearvalue (4,0 xffffffff );}}

WhereGpio_clearvalue (4, 0 xffffffff); this code is very important.If some bits are not cleared, some bits of setvalue cannot be set to 0 next time. setvalue can only be set to 1.

 

Step Motor 28byj-48

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.