Home
pr24 pid motor controller
Contents
1. led gota 0 send string ANGLE lcd gotao 11 send string P led gota 20 send string I led gota 26 send string Dr Figure 25 Now we put some string on LCD display since the LCD is used for show the values of P I D and angle which selected by user Refer to Figure 25 cd goto is used for set the position of LCD s cursor and send string is used for display a string on LCD display while 1 rec data unsigned long ai readi 3600 led goto send decirec data ij kp ai readiz led goto 13i send decikp 3 ki ai readizi led gotoi zzi send deciki Si kd ai readiti led gotoizs send decikd 3 Figure 26 Refer to Figure 26 the loop while 1 is used for make infinity loop so that PIC can function continuously rec data is used for get data from the function of ai read 0 which refer to analog signal from RAO or the Angle value Since the system able to turn up to 3600 degree 10 turns and 3600 is greater than 255 hence we need to convert the ai read 0 to the type of unsigned long For P I and D value since they are limited to 100 smaller than 255 hence we not need to Created by Cytron Technologies Sdn Bhd All Rights Reserved convert it After get the data from ai read we use cd goto and send dec functions to display the data values on the specific position of LCD display while SIL setup Timerl TH
2. Cytron Technologie PR24 PID MOTOR CONTROLLER Version 1 0 October 2009 Cytron Technologies Sdn Bhd Information contained in this publication regarding device applications and the like is intended through suggestion only and may be superseded by updates It is your responsibility to ensure that your application meets with your specifications No representation or warranty is given and no liability is assumed by Cytron Technologies Incorporated with respect to the accuracy or use of such information or infringement of patents or other intellectual property rights arising from such use or otherwise Use of Cytron Technologies s products as critical components in life support systems is not authorized except with express written approval by Cytron Technologies No licenses are conveyed implicitly or otherwise under any intellectual property rights OVERVIEW FEATURES This document describes the development of Cytron PIC16F876A Technologies DIY Do It Yourself Project PR24 This 8 bit microcontroller with 22 I O project describes the application of PID control operate with 5V supply technique in motor position control Schematic and operating speed 20MHz source code is provided Please refer to Getting Start LCD 2X16 characters _ section on running the PR24 with sample program 2X16 characters display Operate at 5V L293D Driver 600mA output current capability per channel High noise immunity DC Gear Motor SPG
3. Typical voltage is 12V Anyhow LM7805 will still generate some heat at 12V There are two type of power connector for the circuit DC plug J1 and 2510 02 Power Connector Normally AC to DC adaptor can be plugged to JI type connector Created by Cytron Technologies Sdn Bhd All Rights Reserved 4 Cytron gt FigurelO Refer to Figure 10 the DI is use to protect the circuit from wrong polarity supply Cl and C2 is used to stabilize the voltage at the input side of the LM7805 voltage regulator while the C3 and C4 is used to stabilize the voltage at the output side of the LM7805 voltage supply LED is a green LED to indicate the power status of the circuit R1 is a resistor to protect LED from over current that will burn the LED Push Button as input for PIC microcontroller Figure 11 One I O pin RBO is needed for one push button as input or interrupt of PIC microcontroller Another push button is used for RESET and connected to MCLR pin The connections are shown in Figure 11 The pins should be pulling up to 5V using a resistor with value range 1K 10K and this configuration will result an active low input When the button is being pressed reading of I O pin will be in logic 0 while when the button is not pressed reading of that I O pin will be logic 1 ICSP for microcontroller programming PIC Figure 12 MCLR RB6 and RB7 need to be connected to the USB In Circuit Programmer UICOOA to program th
4. 521 3178 Fax 607 521 1861 URL www cytron com my Email support cytron com my sales cytron com my Created by Cytron Technologies Sdn Bhd All Rights Reserved 16
5. motor should not move electronic component before soldering it to board as you has turn the potentiometer to zero at steps 4 Figure 52 Created by Cytron Technologies Sdn Bhd All Rights Reserved 13 Cytron Technologie ROBOT HEAD to TOE PR24 PID Motor Controller Appendix A PCB Layout p y m f i Bee 00 ogoogo l Mi I gt gt AaAwOOoOO0o00a gt inatuction Run for exe Reset for Created by Cytron Technologies Sdn Bhd All Rights Reserved 14 Cytron ytron U connect r U4 J conn Motar 13 Driv r cap ip 7 Adaptor ju m connecter tt d ri Ee A a oy INA ran D2 f Q E cap R 4HW C6 47K A 2 Potenti neter Button X U Reseswitchegun Created by Cytron Technologies Sdn Bhd All Rights Reserved ways 2510 ROBOT HEAD to TOE PR24 PID Motor Controller Multi turn Potentiometer o PE cylinder fa 15 Cy tron ROBOT HEAD to TOE ytron PR24 PID Motor Controller i amp J m ee C3 nstruction 1 n for execute Q LE RI 2 Reset for stop C6 Press Reset before adjust ry T1 9 s hun Ange Cytron Technologies reserved the right to replace the component in the list with component of the same functionality without prior notice Prepared by Cytron Technologies Sdn Bhd 19 Jalan Kebudayaan 1A Taman Universiti 81300 Skudai Johor Malaysia Tel 607
6. 20 50K 2V input voltage 0 6W Rated speed of 130rpm and rated torque of 58 8mN m 60g of weight Created by Cytron Technologies Sdn Bhd All Rights Reserved 1 Cytron 3 SYSTEM OVERVIEW Set values of P I D and ANGLE GENERAL DESCRIPTION PR24 is an open source microcontroller DIY kit This PIC microcontroller based project was designed for user to understand the PID control technique The project uses the PID control technique to control the motor position so that the motor can point to the angle desired by user in the most stable manner User can physically indicate how the different values of P I and D can affect on the speed steady state error stability and overshoot during the transient response of the DC motor It also provides LCD 2x16 characters for user to indicate the values of P I D and angle which selected by user PID Controller PID proportional integral derivative controller is a type of closed loop control mechanism which widely used in industrial control system Closed loop control is used to correct the error of the output Besides this technique can also improve both steady state errors minimize the overshoot and improve the transient response P GAIN y us umm No INPUT SUM GAIN 4 SUM PLANT 4 DGAIN FEEDBACK Figure 1 Error set value output value Integral Integral error Derivativ
7. 93D and LED should be soldered in right polarity or it may cause the Figure 35 circuit board fail to work Refer to Figure 35 ai read is used to read data from analog input Bit 5 to Bit3 of ADCONO is set so that data will read from that specified input ADGO is used for wait data Since the P I D value need to be limited from O to 100 the return value of the ai read 2 ai read 3 ai read 4 need to multiplied by 100 and divided by 255 For PIC16F876A the interrupt cannot share the same function with main function another ai read2 used specially for interrupt function That is same for delay 2 Warning Before the battery Power is plugged in make sure the polarity is correct to prevent the explosion Wrong polarity of capacitor also may cause explosion Guide for soldering iron pin 9 Interrupt Function if TMRlIF li TMRIIF 0 feedback value ai readili set value ai read 0 error value set value feedback value integral integral error value derivative error value pre error output kp error value iki integral kd derivative if output gt 255 output 255 else if output Z55 output 255 if output gt 0 motor right unsigned char output else if output lt 0 motor leftiiunsigned char output else motor stopi pre error error value Figure 36 Interrupt function is used when the RUN button is pressed The Timerl will overflow
8. Figure 40 and the flag TMRIIF will set to 1 After using this function we need to clear the flag Read the feedback value from ai read 1 and the set value from ai read 0 By equation error is the difference between set value and output value All the equation can refer to page 2 We need to limit the value of output PWM to 255 as it only has 8bits Created by Cytron Technologies Sdn Bhd All Rights Reserved 10 Cytron 5 Guide for making 2510 02 for 9V battery connector ROBOT HEAD to TOE PR24 PID Motor Controller Figure 43 Solder the cable to potentiometer Then solder the Figure 41 not included in DIY project set cable to iron pin Make sure the Signal pin from multi turn potentiometer is connected to first pin DC motor connector of 2510 connector The wire given may not the same with wire inside the photo PA Figure 42 6 Make sure the polarity of the connector is correct The green wire should be the first pin of 2510 connector Guide for making 2510 03 for potentiometer connector 7 Im a Created by Cytron Technologies Sdn Bhd All Rights Reserved Please download the necessary files and document from Cytron Technologies website These included documentation sample source code schematic and software The next step is to install MPLAB IDE and PICC Lite into a computer The MPLAB IDE and PICC Lite can be downloaded from WWW cytron com my same director
9. REIH 0 THRIL 0 TICON ObOO110001 setup timerl interrupt THRIIF O THRITE 1 PEIE 1 GIE 1 Figure 27 Since RUN button SW1 is connected to the INT pin of PIC we used the interrupt to run our system To set up interrupt global interrupt enable bit GIE and Peripheral Interrupt Enable PIE need to be set to 1 Set GIE 1 to enable all unmasked interrupts Set PIE 1 to enable all unmasked peripheral interrupts Timer 1 is used in the interruption Set TMRIIE 1 to enables the TMRI overflow interrupt Set TMRIIF 0 to make TMRI register did not overflowed Configure the Timer 1 with TICON Ob00110001 to enables Timerl with 1 8 prescale value Initialize the register of TMRIH and TMRIL with 0 The registers will then increase until overflow Once overflow occur the flag TMRIIF will set become 1 interruption occur Functions for motor void motor right unsigned long speed motor 1 70 motor 2 1 motor speed speed void motor left unsigned long speed motor 1 1 motor 2 0 motor speed speed void motor stop void motor 1 1 motor 2 1 motor speed 0 Figure 28 Refer to Figure 28 the functions are used to control the motor In our system when error is positive motor will turn right when error is negative motor will turn left when error is zero motor is stop The pins of motor driver IN1 and IN2 is used for control the direction of motor When INI is HIGH and IN2 is LOW motor turn r
10. VREF L 4 RAJIANJNaEF 7 1 5 RAAITOCKIICIOUT 6 RASIANAISSIC2DUT 7 U 7 Vss L 8 OSC1 CLKI L 9 OSC2ICLKO lt 10 RCDIT1OSOIT1CKI e 011 RCAITTOSICCP2 112 RC2ICCP1 s 13 RC3ISCKISCL 44 PIC 16F87 3A 876A ES an ES 1 16 RONSDO 15 7 RCAISDI SDA Figure 3 L293D Driver L293D is a monolithic integrated high voltage high current four channel driver designed to accept standard DTL or TTL logic levels and drive inductive loads such as relays solenoids DC and stepping motors and switching power transistors Each pair of channels is equipped with an enable input to simplify use as two bridges Internal clamp diodes are included This device is suitable for use in switching applications at frequencies up to 5 kHz In this project L293D is applied to control the speed of motor ENABLE 1 and also control the direction of the DC motor INPUT I and INPUT 2 Figure4 shows the pin connection of L293D ENABLE 1 1 Uss INPUT 1 2 INPUT 4 OUTPUT 1 3 DUTPUT 4 GND 4 GND GND 5 END BND 6 GND END 7 GND OUTPUT 2 8 OUTPUT 3 INPUT 2 9 INPUT 3 Us 18 ENABLE 2 Figure 4 The L293D is assembled in a 16 lead plastic package which has 4 center pins connected together and used for heat sinking The block diagram is shown ROBOT HEAD to TOE PR24 PID Motor Controller Us OUT1 OUT3 Uss 92120901 81 DUT2 OUTA Figure 5 For more information about the L293D please refer to the datash
11. e ROBOT HEAD to TOE PR24 PID Motor Controller PIC microcontroller The programmer UICOOA is not included in DIY project set since it can be used several time for different project set User can also choose other type of PIC programmer to load the program For the instruction of using PIC programmer please refer to the particular PIC programmer user s manual at http www cytron com my listProductCategory asp ci d 81 Interface L293D with PIC16F876A Figure 13 L293D is used as motor driver in this project RC2 1s connected to enable pin ENI to give the PWM signal to L293D RCO and RCI are connected to IN2 and IN1 respectively to give control on motor direction OUTI and OUT2 are connected to DC motor Figure 13 shows the connection Interface PID Gains and Angle Adjusters with PIC16F876A VCC Figure 14 Four analog I O pins is needed for P I D and Angle value adjuster RAO is responsible for Angle value RA2 is responsible for P value RA3 is responsible for I value and RAS is responsible for D value Figure 14 shows the connection Interface 22mm Precision Wirewound Potentiometer with PIC16F876A 2510 03 Figure 15 Created by Cytron Technologies Sdn Bhd All Rights Reserved 5 Cytron 5 The potentiometer is used as the feedback of motor position 5V and ground is connected to provide power to the potentiometer The analog feedback is connected to RAI of PICI6F876A Figure 15 shows the c
12. e error previous error PWM P x error I x Integral D x Derivative ROBOT HEAD to TOE PR24 PID Motor Controller PIC 16F876A Feedback PIC16F876A This powerful 200 nanosecond instruction execution yet easy to program only 35 single word instructions CMOS FLASH based 8 bit microcontroller packs Microchip s powerful PIC architecture into an 28 pin package and is upwards compatible with the PICI6C5X PICI2CXXX and PICI6CTX devices Feature of the device e 256 bytes of EEPROM data memory e Self programming e ICD In Circuit Debugging function e 2 Comparators e 5 channels of 10 bit Analog to Digital A D converter e 2capture compare PWM functions e the synchronous serial port can be configured as either 3 wire Serial Peripheral Interface SPITM or the 2 wire Inter Integrated Circuit 12CTM bus e Universal Asynchronous Receiver Transmitter USART All of these features make it ideal for more advanced level A D applications in automotive industrial appliances and consumer applications Figure 3 shows the pin diagram for PICI6F876A For more information about the PIC microcontroller please refer to the datasheet The datasheet can be found in microchip web site at http www microchip com Created by Cytron Technologies Sdn Bhd All Rights Reserved 2 Cytron 5 28 Pin PDIP SOIC SSOP MOLRNpP RBTIPGD RAQ ANO L 2 27 RBAIPGC RATANT e LI 3 26 RBS RAZJANDIVREF C
13. e PWM value to control motor s speed fdefine Sil REO SA BUN switch Figure 19 Define the constant and symbol which related to the pins of PIC microcontroller 3 Declare and initialize global variable Global Variables unsigned char kp 0 unsigned char ki 0 unsigned char kd 0 Figure 20 The global variables above will used in the calculation and involved in many function initialize them with zero 4 Function prototype r Function Prototypes unsigned char ai readiunzigned char an zeli void motor right unsigned char speed void motor left unsigned char speed void motor ztopivoid void delayiunsigned long data void e pulse ivoid void led clrivoidi void lcd goto unsigned char data void send chariunsigned char data void send configiunsigned char data void send stringiconst char si void send deciunsigned long data unsigned char num dig Figure 21 The function prototype is used for declare the function used The function will be explained Main Function main function LII E void main void unsigned long rec data 0 set I O input output IRISB 0b00000001 IRISC 0b00000000 TRISA 0b11111111 initial port conditions Figure 22 Refer to Figure 22 the main function is void means not return any value TRIS is used to set the I O direction on each port of PIC Ob means binary If the pin used as input set it as 1 else s
14. eet The datasheet can be found at www datasheetcatalog com Potentiometer This multi turn variable resistor is used in this project for act as the feedback of motor position Since this multi turn variable resistor can be turned 10 cycles therefore the available angle in this project is 3600 degree Features e Special resistance tolerances to 1 Rear Shaft Extensions and Support Bearing Non turn lug Dual gang configuration and concentric shafts High torque and centre tap Special markings and front shaft extensions Servo unit available and slipping clutch Figure 6 Please refer to Getting Start section for cable connection Created by Cytron Technologies Sdn Bhd All Rights Reserved 3 Cytron 5 SPG20 50K Figure 7 SPG20 50K is a DC motor with rated speed of 130 rpm and rated torque of 58 8mN m The weight of this motor is 60g The rated input voltage is 12V For more information about this DC motor please refer to the datasheet The datasheet can be found at our website Please refer to Getting Start section for cable connection HARDWARE excluded add on gadget This project will require following hardware x PIC16F876A 1 x PR24 Printed Circuit Board PCB 1 x LCD 2x16 character 1 x L293D Driver 1 x DC Motor SPG20 50K x 22mm Precision Wire wound potentiometer g Related electronic components me RO sp Please refer to Appendix A for the board layout of PR24 The board layout is pro
15. et it as O After that initialize the condition of the port so that the system will refresh the condition every time it has been RESET PWM mode CCPl1CON 0Ob00001100 T2CON O0bO00000101 PRA OxFE CCERIL O aetup ADC ADCON1 QEOLIO0000 ADCONO ObooooooO1 Figure 23 PWM mode will be used in control the motor the PWM signal will be pass to the ENI of UA through RC2 To configure PWM CCPICON need to set as above Please refer to the datasheet of PIC 16F876A to get more information 72CON is set so that Timer 2 is ON Bit2 1 with prescale is 4 Bitl and BitO is 01 PR2 is used to set the PWM period ADCON Iis set where e Bit7 0 data is left justified where 6 least significant bits of ADRESL read as 0 Created by Cytron Technologies Sdn Bhd All Rights Reserved C yer on ROBOT HEAD to TOE Technologie PR24 PID Motor Controller e Bit6 l the clock conversion is Fosc 4 Bit 7 and Bit6 of ADCONO need to set to 0 e Bit3 to BitO is set to O so that all the pins in PORTA are analog I O ADCONO is set so that A D converter is powered up Bit0O 1 confiqure lcd send config 0500000001 send config 0b00000010 send config 0500000110 send config 0600001100 send config 0600111000 Figure 24 Figure 24 shows the configuration on LCD display LCD needs to configure before use The send config is used to configure LCD this function will be explained LCD display lcd clr
16. ight IN2 is HIGH and INI is LOW motor turn left When both of INI fron Cy Technologie ROBOT HEAD to TOE PR24 PID Motor Controller di and IN2 are HIGH the motor will stop After determine the direction the speed in the form of PWM will go to ENI of the motor driver to determine the speed of motor Function for LCD 7 1 send config Figure 29 shows the function to configure LCD In order to configure LCD we need to set RS 0 The configuration needs to detect one bit by one bit therefore a loop with 8 cycles is need for shift the data to right e pulse function is used after the loop for send the pulse to E pins of LCD The pin is used for start data read and write void send config unsigned char data unsigned char test i rs 0 for i 0 1i lt 8 1i test data gt gt i 0b00000001 switch i case O0 if test 1 d0 1 else d0 0 case 1 if test 1 d1 1 else d1 0 case 2 if test 1 d2 1 else d2 0 case 3 if test 1 d3 1 else d3 0 Figure 29 7 2 send char void send char unsigned char data unsigned char test i rs 1 for i 0 i lt 8 i test data gt gt i amp 0b00000001 switch i case 0 if test 1 d0 1 else d0 0 case 1 if test 1 di 1 else d1 0 case 2 if test 1 d2 1 ae Figure 30 Figure 30 shows the function to send character to LCD display RS is set for entering write mode The data needs to detect one bit by one bit
17. ltage signal at starting is OV Figure 48 5 Fit the shaft of the potentiometer with the hole on aluminum cylinder The screw nut is used to setup the potentiometer on the U junction Use pliers to screw the nut Figure 46 3 Put the PE cylinder on the middle of U junction and screw it firmly on the shaft of motor Figure 47 Figure 49 Created by Cytron Technologies Sdn Bhd All Rights Reserved 12 Cytron 5 ROBOT HEAD to TOE PR24 PID Motor Controller 6 Screw the shaft of potentiometer with the TEST METHOD cylinder firmly Turn the cylinder to make sure that the cylinder can be turn smoothly 1 After that connect the potentiometer and l motor respectively Switch ON the power e Power Led green will turn ON 2 Adjust the angle using potentiometer 3 LCD will display angle P I and D value 4 Press Run button 5 Motor run to the adjusted position The motor may not stop completely and shaking at that position That s mean the PID value is not suitable for this angle So you need to try an error to test again with different PID Should start with small P value first 6 Ifall steps mention above can be executed your project is done successfully Congratulations 2 WARRANTY 7 Now turn on the system Adjust your angle No warranty will be provided as this is DIY project probe to make your Angle value become zero Thus user is advice to check the polarity of each Click RUN button the
18. od is useful to show the numbers one by one This Created by Cytron Technologies Sdn Bhd All Rights Reserved C ytr on gt ROBOT HEAD to TOE Technologie PR24 PID Motor Controller function is able to show data up to 10 decimal places For this project we only GETTING START used it to show data with 4 decimal places 0x30 is added to data to make it as User can obtain the hardware set for this project PR23 ASCII code In ASCII 1 0x31 either by online purchasing www cytron com my or 2 20x32 and so on purchase it in Cytron Technologies Shop 1 Once user has the hardware set soldering process can be started Please solder the electronic components one by one according 8 Function for analog input Read the ADC auge ches ai c sad eed peed clad a celi the symbols or overlays on the Printed Circuit e Board PCB Ensure the component value ifian sel 0 ADCONO 0b00000001 else ifian sel 1 ADCONO 0500001001 and polarity is correctly soldered Take note else ifian sel 2 ADCONO 0b00010001 md MI E UL that this PR has a wire jumper that need to be mL DL kek Ls soldered Please refer to board layout in delayil00 Appendix A ADGO 1 3 while ADGO 1 Caution Make sure all the connectors 2510 are be an cei ms B an sal se ly JatxER XDRESH soldered in proper side Those electronic MER ANREDE s EIS components have polarity such as capacitor diode PIC LM2
19. onnection Interface UC00A with PIC16F876A Figure 16 RC6 and RC7 which serve as TX and RX pins in PICI6F876A are used for UART interface 5V and ground is connected to provide power to the module User can use this connector for interface with other devices For example show the output of this system to the screen of computer Figure 16 shows the connection PCB circuit board Figure 17 Components Reset button to reset the microcontroller Push button UICOOA box header connect to UICOOA programmer to load program L293D Motor driver 2510 02 connector motor connector Parallel LCD 2x16 Preset adjust P I D Crystal 20MH2Z 2510 03 connector for potentiometer 0 2510 04 connector UCOOA connector a ON ROBOT HEAD to TOE PR24 PID Motor Controller 11 Slide switch to ON or OFF the circuit 12 LM7805 voltage regulator supply 5V for PIC 13 AC DC adaptor socket to use power supply from AC DC adaptor 14 2510 02 connector to use 12V battery to power up the circuit 15 Potentiometer adjust Angle SOFTWARE Flow Chart Adjust P I D and Angle values Show the adjusted values on LCD display SWI Be pressed Yes Motor turn to the adjusted position i pressed For more information about the software for this system please refer to the source code provided The explanation of each instruction is provided in the source code as the commen
20. t of each line The source code is provided free and Cytron Technologies will not be responsible for any further modification or improvement Created by Cytron Technologies Sdn Bhd All Rights Reserved 6 Cytron X Technologie ROBOT HEAD to TOE PR24 PID Motor Controller Explanations on Source Code 1 Include library and Configure PIC ff Include CONFIG Ox3F32 1 Figure 18 To program the PIC microcontroller the first step we have to do 1s include the library pic h The configuration Ox3F32 used to make configuration on the PIC Ox refers to Hexadecimal whereas 3F32 means e Set the oscillator as high speed e Off the watchdog timer e On power timer e Off brown out detect e Disable low voltage program e Off data EE read protect e Off flash program write protection e Off code protect 2 Define ff Define f zzzzzzzzzzzzzzzzzzzzzzzzzlzlzzzlzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz fdefine rs BET ff BS pin of the LCD fdefine BEG E pin of the LCD fdefinae di BCS JA DB pin of the LCD define d EC4 ff LEE pin of the LCD define db BCS ff DES pin of the LCD define d BEL f f DEd pin of the LCD define di BE ff DBS pin of the LCD define d BEG ff DBZ pin of the LCD define dl BEA ff DBl pin of the LCD define dl BES f f DBO pin of the LCD fdefine motor l RCl ff lst terminal of the motor fdefins motor z RCO End terminal of the motor fdefine motor speed CCPRIL ff Th
21. therefore a loop with 8 cycles is need for shift the data to right e pulse function is used after the loop for send the pulse to E pins of LCD The E pin is used for start data read and write 7 3 lcd goto void led_goto unsigned char data if data lt 16 send config OxEOGO data pm data data zo0 send config DOxcO data delay 200 Figure 31 This function is used for set the cursor of LCD to a specific location of LCD The LCD has 2 rows with 16 characters for each row this function was set so that when data is greater to 16 data will display on second row 7 4 lcd clr void lcd clr void send config O0xO1 delay 600 Figure 32 Refer to Figure 32 this function is used for clear the LCD display by configure it with 0x01 7 5 send string void send string const char 3 unsigned char i 0 while s amp amp 3 send char 3 delay 300 Figure 33 Refer to Figure 33 the function is used for send a string to LCD display 7 6 send_dec void send_dec unsigned long data unsigned char num_dig if num_dig gt 10 data data 10000000000 send char data 1000000000 0x30 if num dig 9 data datat1000000000 send char data 100000000 0x30 Figure 34 This function 1s used for display a decimal on LCD display num dig makes user choose the number decimal place of data need to be shown Data will be divided The remainder will be taken again for divided This meth
22. vided free therefore Cytron Technologies will not be responsible for any further modification or improvement Interface LCD 2x 16 Characters with PIC16F877A To use the LCD display users have to solder 16 pin header pin to the LCD display LCD used in this project is JHD162A for other type of LCD please refer to its data sheet Figure 8 ROBOT HEAD to TOE PR24 PID Motor Controller Figure 8 is a 2X16 character LCD Figure 9 shows the connection of LCD display LCD connection pin and function of each pin is shown Name SS Ground GND CC Positive supply for LCD VEE Brightness adjust Connected to a preset to adjust brightness Select register RB7 select instruction or data register Select read or write write Databuspn RBS DBI Databuspn RB4 Databuspn RB3 Databuspn RB2 Databuspn RBI Databuspn RCS Databuspn RC4 Databuspn RC3 input LED Backlight negative input d vy Nin 7 Pin Ewa u i TO 8 2 10 EN 2 up KON E 0 DB2 DB3 DB4 DB DB DB7 L 10 11 12 13 14 15 m ON P E REERER RAG C e C Figure 9 Power supply for the circuit User can choose either AC to DC adaptor not included in the DIY project set or 12V battery not included in the DIY project set to power up the circuit Higher input voltage will produce more heat at LM7805 voltage regulator
23. y as this DIY project After the installation of MPLAB IDE and PICC Lite completed open the source file provided using MPLAB IDE Please refer to PRI and PR5 for the method to use MPLAB and PICC Lite Plug in power supply for the circuit User can choose to use battery or AD to DC adaptor Capable to supply circuit only need other power source for motor Build the project and load the hex file into the PIC microcontroller using the USB In Circuit Programmer UICOOA The programmer is not included in the hardware set but it can be purchase separately at Cytron website User s manual is provided at website PIC is now completely programmed Proceed to Set up Feedback to assemble the DC motor potentiometer and angle scale Set Up Feedback User is advised so that the components are soldered on PCB completely before set up this hardware First screw the U joint bracket on the PCB board using four 2 5mm bolts and nuts You will notice that one of the holes of U joint is bigger Make sure that bigger hole is at feedback side It is use to joint the multi turn potentiometer gt Fi gure 44 11 C ytr on 5 ROBOT HEAD to TOE Technologie PR24 PID Motor Controller 2 Secondly screw the motor on the U junction 4 Now take out the screw nut of the Make sure that you screw it on the correct side potentiometer like shows in Figure 48 Now PaL Me turn the potentiometer to right until the end so that the vo
Download Pdf Manuals
Related Search
Related Contents
Manuel de l`opérateur Fourth Edition 資料請求L KDC-BT6052U Samsung L170 User Manual PXI-1020 User Manual - National Instruments User's Manual Copyright © All rights reserved.
Failed to retrieve file