Unformatted text preview:

ECE 332L Microprocessors Lab (Fall 2007) – Lab 8 (Week 11)– Objective: Pulse-Width Modulation (PWM) and DC Motor. 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-069) for the H-Bridge is supplied on class web site. 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. Intermediate Deliverables: 1. Develop routine that lights one LED for the required ON duty cycle and are off for the remainder of period. Provide switch or button that enables or disables display of LED. 2. Extend first routine to display level bar that is progressively lit to maximum value specified by duty cycle and remaining LEDs are unlit. Provide buttons to increase or decrease duty cycle. 3. Add functionality that reverses direction of progress bar. Use switch or button.4. Modularize your design of the PWM into separate pwm.c and pwm.h files. 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-1 Install to JP2 40-pin connectorLab 8 System Library


View Full Document

BOISE STATE ECE 332L - lab81

Documents in this Course
Load more
Download lab81
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view lab81 and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view lab81 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?