Академический Документы
Профессиональный Документы
Культура Документы
5.1.2.
Figure 84: H-Bridge Connection Determine the output of the H-Bridge based on different inputs from the power supply. Use it to complete the table below:
77
Input A H
78
Figure 85: System Diagram 5.2.3. Conceptual Background The motor control in this lab will drive a motor both forward and backward. It will also allow for speed control by using a PWM. The direction that the voltage will pass through our motor will be determined by the H-Bridge. The signals passed into the H-Bridge will control which gates are open, this will then determine which way the voltage will be going through our motor. The PWM signal will dictate the rate at which the gates open and close. This will allow us to determine how quickly the motor is spinning.
79
Figure 87: Schematic Diagram of a Motor 5.2.4. Equipment Required PSoC Designer 5.0 Software PSoC Mini Programmer USB Cable Simple DC Motor SN754410 H-Bridge CY3210-PSoC Evaluation and CY3210-MiniEvaluation board
80
5.2.5.
Figure 89: Select LED Module 5.2.6. Set Global and User Module parameters
81
Figure 91: LED properties Dialog Box 5.2.7. Define Pin-out for the device
82
83
5.2.8.
Coding
//---------------------------------------------------------------------------// C main line //---------------------------------------------------------------------------#include <m8c.h> // part specific constants and macros #include "PSoCAPI.h" // PSoC API definitions for all User Modules
void main(void) { PWM8_1_Start(); LED_1_Start(); PWM8_1_WritePulseWidth(0xBA); LED_1_Off(); // Insert your main routine code here. }
5.2.9.
Programming PSoC module Save the file Generate configure file Compile main project Build the project Program->Program Part Select MiniProg1. Set the Acquire Mode on power cycle if external power is not supplied and vice versa.
84
5.2.10.
5.2.11.
Suggested Modifications
85