

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
The eighth lab of the microprocessors course (ece 332l) in spring 2008, focusing on pulse-width modulation (pwm) and dc motor control using a nios ii processor and digilent pmodhb3 h-bridge. Students are required to develop routines to control leds representing the pwm state and extend it to a level bar, add functionality to reverse the direction of the progress bar, and modularize the pwm design. The dc motor control functions should provide the ability to increase or decrease motor speed, change motor direction, and start/stop the motor.
Typology: Study notes
1 / 3
This page cannot be seen from the preview
Don't miss anything!
Note: A new Nios II processor core has been generated that provides 2 PIO based interfaces to the hardware. You need to change Nios II IDE system library property (includes Timestamp timer, Program memory (.text), Read- only data memory (.rodata), Read/write dta memory (.rwdata), Heap memory, and Stack memory), see figure on the last page. The interface to the Digilent PmodHB3 H-Bridge is through a 40-pin connector (JP2). The PmodHB3 H-Bridge module drives the DC motor. In addition, 4 AAs or AAAs batteries are used to power the DC motor. Some details of the DC motor are included in the following figure.
Tamiya 70093 3-Speed Crank Axle Gearbox
This compact gearbox gives you options for gear ratios of 17:1, 58:1, and 204:1.
The motor is rated for 3 volts but will typically work fine up to 6 volts. When using this product with the dual serial motor controller (or any motor driver based on an H-bridge), keep in mind that up to a few volts (depending on the load) are lost on the transistors of the H- bridge, so that a 4.5 volt battery delivers about 3 volts to the motors, giving them a reasonable amount of power. Motor overheating can be caused by excessive stalling, even at very low voltages.
http://www.technobots.co.uk/acatalog/info_1452_004.html
The documentation (Digient PmodHB3, 2A H-Bridge Reference Manual, Revision: February 26, 2007, Doc: 502-
During development cycles, the hardware to be controlled might not be available yet or can be easily damaged. To accommodate these situations, code development can be carried out with the use of a test platform. Upon completion of code development on the test platform, the code can be migrated to the final hardware with minor changes.
Since the H-Bridge hardware used in this lab can be easily damaged and batteries can be quickly run down, this is a good case to use a test platform. The test platform in this case is a set of LEDs that visually represents the PWM state. You can utilize 10 LEDs to represent the full period and activate the number of LEDs (using buttons) to represent the ON duty cycle (one LED ON as 10% duty cycle or five LEDs ON as 50% duty cycle).
Important: You need to show your design to the lab instructor before you are permitted to use the DC motor hardware setup.
Suggested API:
void pwm_init( unsigned int period, unsigned int ontime, unsigned int direction); unsigned int pwm_incr ( void ); unsigned int pwm_decr ( void ); unsigned int pwm_enable_toggle ( void ); unsigned int pwm_change_direction ( void );
Once these steps are accomplished and check-off, you can proceed to the following.
DC Motor PWM Deliverable:
Use buttons to increase or decrease the speed of DC motor. Used switches to enable the motor and changing the motor directions. In short, your DC motor control functions should provide functionalities to increase or decrease motor speed, change motor direction, and start/stop motor. REMEMBER, you can only change direction when speed == 0. Otherwise, bad things will happen which will result you owning the instructor $25 bucks. The following picture show how the H-Bridge and DC motor are connected to DE2.
Switch’s ON indicator
The RED wire is pin-
Install to JP2 40-pin connector