Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
main.cpp
- Committer:
- wuliqunyy
- Date:
- 2021-03-03
- Revision:
- 11:b86aea372744
- Parent:
- 10:a8390614edcc
- Child:
- 12:9f8c7f4da5f6
File content as of revision 11:b86aea372744:
#include "mbed.h" #include "main_init.h" #include "i2c_mbed_fpga.h" /* Main function */ int main() { /*init funcitons*/ i2c_mbed_fpga i2c; main_init(); /*reset the FPGA!*/ /*control codes*/ wait_ms(2000); /* keep FPGA in reset for 5s, to let motor stop*/ enbale_fpga(); /* enable FPGA */ wait_ms(100); led4 = i2c.i2c_window_open(); /*send password 0xd0d0*/ wait_ms(100); i2c.i2c_set_position_pulse_width(1,3); /*unsigned int mantisaa_2b, unsigned int exponent_3b*/ wait_ms(100); i2c.i2c_set_start_up_pulse_width(3,5); /*(unsigned int mantisaa_3b, unsigned int exponent_3b*/ wait_ms(100); //led4 = i2c.i2c_set_soft_start_up(1, 1, 0, 1, 1); //wait_ms(1000); i2c.i2c_set_position_anti_cog(0); wait_ms(100); i2c.i2c_clear_spd_ctrl(); wait_ms(100); i2c.i2c_set_loop_mode(0); wait_ms(100); i2c.i2c_set_curve_type(3); wait_ms(100); i2c.i2c_set_dc_ini(1); wait_ms(100); i2c.i2c_set_dc_sr(3); wait_ms(100); i2c.i2c_set_open_loop_duty(0xffff); wait_ms(100); led4 = i2c.i2c_motor_start(); /*send password 0xcafe*/ /*enter infinite loop, motor should be running*/ while (1) {} }