tag:blogger.com,1999:blog-4049389000246339680.post3963204622237226712..comments2024-03-24T08:03:15.334-07:00Comments on lordvon's stuff: Easy pulse width modulation (PWM) with PICs to control brushless motor ESCs, servos, and other thingslordvonhttp://www.blogger.com/profile/05681123007982690331noreply@blogger.comBlogger35125tag:blogger.com,1999:blog-4049389000246339680.post-35332307265398561632016-02-05T04:18:39.732-08:002016-02-05T04:18:39.732-08:00Dear Lordvon,
I wonder if you initialize/calibrate...Dear Lordvon,<br />I wonder if you initialize/calibrate the esc with max and min..Because at forums with arduino they firstly calibrate esc and then esc goes to programm mode and then they programm it..Also, i use pic16f877a..Should i do any changes to your code if i want to do the same(sent a pwm to BLCD via esc)??Thank you in advance!!!<br /><br />my e-mail is: sosat1991@gmail.comAnonymoushttps://www.blogger.com/profile/07189775033707337267noreply@blogger.comtag:blogger.com,1999:blog-4049389000246339680.post-86288138207521768252016-02-05T04:12:49.871-08:002016-02-05T04:12:49.871-08:00I had the same error ANSEL and GO_DONE..I google i...I had the same error ANSEL and GO_DONE..I google it and find out that it was spelling mistakes..try this<br /><br />//Using default Internal Clock of 4 Mhz<br />//To use TMR1 at 50 Hz and 1:1 prescaler, set offset to 45535.<br />//TMR0 can vary from 7 to 132, or 2 ms to 1 ms, at 1:1 prescaler.<br />//Use TMR0 to control pulse width, even though TMR1 has much higher resolution, because TMR1 offset is 16 bits and may require lots of time to compute proper TMR1 offset from ADC value.<br /><br />#include <br />__CONFIG(INTIO & WDTDIS & PWRTEN & MCLRDIS & UNPROTECT \<br />& UNPROTECT & BORDIS & IESODIS & FCMDIS);<br /><br />unsigned int pulse = 0;<br /><br />//Interrupt function<br />static void interrupt isr(void)<br />{<br />if(T0IF)<br />{<br />RC0 = 0;<br />}<br />if(TMR1IF)<br />{<br />TMR1IF = 0;<br />//Start 50 Hz cycle period.<br />TMR1L = 0b11011111;<br />TMR1H = 0b10110001;<br />//Turn on variable pulse.<br />RC0 = 1;<br />if(RC1 == 1) //safety switch (must be pressed).<br />{<br />TMR0 = pulse;<br />T0IF = 0;<br />}<br />else //off.<br />{<br />TMR0 = 132;<br />T0IF = 0;<br />}<br />}<br />}<br /><br />void main(void)<br />{<br />//Setting ports.<br />TRISA = 0x00001001; // Set A0 (for ADC) and A3 (MCLR) to input, others output<br />PORTA = 0x00;<br />TRISC = 0b00000010; //Set C1 to input for safety on switch.<br />PORTC = 0x00;<br />//ADC configuration.<br />ADCON1 = 0x00;//So that ADC conversion clock is set to Fosc/2.<br />ADCON0 = 0b00000001;//ADC enabled.<br />ANSEL = 0x01; // Set A0 to analog, others digital<br /><br />//Timer configuration<br />OPTION_REG = 0b00000010; // Timer0 configuration, 1:8 prescaler.<br />TMR1L = 0b11011111;<br />TMR1H = 0b10110001;<br />T1CON = 0b00000001; // Timer1 configuration, including 1:1 Prescaler and TMR1ON = 1.<br /><br />//Timer interrupt enabling.<br />T0IE = 1;<br />TMR1IE = 1; // Timer1 interrupt enable, needed with PEIE and GIE bits set.<br />PEIE = 1; // Peripheral interrupt enable, for Timer1.<br /><br />//General interrupt enabling.<br />GIE = 1; // Global interrupt enable, for Timer1 and Timer0.<br /><br />while(1)<br />{<br />GO_DONE =1; // initiate conversion.<br />while(GO_DONE ) continue; // Wait for conversion to finish.<br />pulse = 7+ADRESH*125/255;<br />}<br />}Anonymoushttps://www.blogger.com/profile/07189775033707337267noreply@blogger.comtag:blogger.com,1999:blog-4049389000246339680.post-62302056848352570462016-01-20T20:07:03.203-08:002016-01-20T20:07:03.203-08:00hello sir i used this code to pic 16f877a but is h...hello sir i used this code to pic 16f877a but is have not the comment of ANSEL = 0x01; // Set A0 to analog, others digital and i want circuit of pic connection please reply me or mail me @ dkdinesheee715@gmail.comAnonymoushttps://www.blogger.com/profile/17430963391986739919noreply@blogger.comtag:blogger.com,1999:blog-4049389000246339680.post-22320115032946019412016-01-20T20:04:00.505-08:002016-01-20T20:04:00.505-08:00This comment has been removed by the author.Anonymoushttps://www.blogger.com/profile/17430963391986739919noreply@blogger.comtag:blogger.com,1999:blog-4049389000246339680.post-64814042361632020532014-11-17T22:08:09.636-08:002014-11-17T22:08:09.636-08:00hey i have the same problem, can you tell me what ...hey i have the same problem, can you tell me what is the answer please, my email is bgzt_11@hotmail.comAnonymoushttps://www.blogger.com/profile/03880890271970042491noreply@blogger.comtag:blogger.com,1999:blog-4049389000246339680.post-35082797841521122922014-11-17T08:43:23.982-08:002014-11-17T08:43:23.982-08:00this is my error
CONFIG(INTIO & WDTDIS & ...this is my error<br /><br />CONFIG(INTIO & WDTDIS & PWRTEN & MCLREN & UNPROTECT & UNPROTECT & BORDIS & IESODIS & FCMDIS);Anonymoushttps://www.blogger.com/profile/03880890271970042491noreply@blogger.comtag:blogger.com,1999:blog-4049389000246339680.post-42134830682211864962014-11-17T08:17:54.119-08:002014-11-17T08:17:54.119-08:00You used MPLAB XC8 ?You used MPLAB XC8 ?Anonymoushttps://www.blogger.com/profile/03880890271970042491noreply@blogger.comtag:blogger.com,1999:blog-4049389000246339680.post-63633970173213701022014-11-16T21:43:22.333-08:002014-11-16T21:43:22.333-08:00Hi
im using this motor i want to program wit pic ...Hi <br />im using this motor i want to program wit pic but your code is not work so i dont kwnow if you could help me with the diagram and the code, im using pic 16f877a mis ESC is 30A please help me, i add that im usin mplab x ide mi email is bgzt_11@hotmail.com , i hope hear you as soon as possible<br />thanksAnonymoushttps://www.blogger.com/profile/03880890271970042491noreply@blogger.comtag:blogger.com,1999:blog-4049389000246339680.post-48905873996332882762014-03-05T05:24:24.412-08:002014-03-05T05:24:24.412-08:00Dhilip, you should be able to find that out very e...Dhilip, you should be able to find that out very easily.<br /><br />My particular ESC had a battery-eliminator circuit (BEC), which takes power from the same battery as the motor and regulates it to so that it can safely power the micro-controller. This way you do not need separate batteries for the micro-controller.<br /><br />The two other wires are the positive and negative supply voltages provided by the BEC. Connect these wires to the Vcc and ground of your micro-controller. Of course make sure the voltages are right for your micro-controller (it probably will be).lordvonhttps://www.blogger.com/profile/05681123007982690331noreply@blogger.comtag:blogger.com,1999:blog-4049389000246339680.post-10860291290996096622014-03-03T00:30:00.538-08:002014-03-03T00:30:00.538-08:00hi i am also same project.. 1st question why u cho...hi i am also same project.. 1st question why u choose the 18f6520???Anonymoushttps://www.blogger.com/profile/12867926012435990424noreply@blogger.comtag:blogger.com,1999:blog-4049389000246339680.post-17301336543783002302014-03-03T00:15:49.311-08:002014-03-03T00:15:49.311-08:00hi i am also same project.. 1st question why u cho...hi i am also same project.. 1st question why u choose the 18f6520???Anonymoushttps://www.blogger.com/profile/12867926012435990424noreply@blogger.comtag:blogger.com,1999:blog-4049389000246339680.post-64707051805590282032014-02-06T06:00:50.269-08:002014-02-06T06:00:50.269-08:00Hi.. Im new to building quadcopters. We are buildi...Hi.. Im new to building quadcopters. We are building a quadcopter for our college project.<br />We are trying to control the four motors using PIC18f6520.<br /><br />My ESC:<br />http://www.rcbazaar.com/products/806-avionic-20amp.aspx<br /><br />My motor:<br />http://www.rcbazaar.com/products/1999-avionic-c2836-kv1120-brushless-motor.aspx<br /><br />I've connected the motor and battery with the ESC. <br /><br />The thing is I dont know what to do with the 3 cables coming out of the ESC. I know one of them is the PWM input to the ESC.<br />I also generated a PWM wave and sent it to the ESC via the white cable. The motor keeps on beeping and it doesnt run.<br /><br />I dont know what to do with the rest two wires. Please help me. Can you give me a circuit diagram of some sort ? Because it can help me a lot Thank you.Anonymoushttps://www.blogger.com/profile/10733699137645741068noreply@blogger.comtag:blogger.com,1999:blog-4049389000246339680.post-33385883469813875752013-06-11T08:39:58.264-07:002013-06-11T08:39:58.264-07:00I think using the PIC is a good way to build your ...I think using the PIC is a good way to build your own controller. There aren't any pitfalls that I am aware of. I just Google whatever it is I need, and I do not have any sites in particular to recommend.<br />Thanks for reading, and good luck with your project!lordvonhttps://www.blogger.com/profile/05681123007982690331noreply@blogger.comtag:blogger.com,1999:blog-4049389000246339680.post-56704286700101729132013-06-09T16:32:12.203-07:002013-06-09T16:32:12.203-07:00Awesome work! And thanks sharing. I was cruising ...Awesome work! And thanks sharing. I was cruising for exactly this topic, so this was very helpful. I know zilch when it comes to RC components, but just finished a pretty intensive PIC-based MCU course. Naturally, all I want to do now is build a quadcopter (and I'm the first one, right?). But I don't know how to interface the PIC with whatever signals are used in RC motor/servo-control.<br /><br />PWMs seem to describe control very well. In general when it comes to RC components, are they fairly easy to control/interface with the PIC, as long as you define your PWM frequency ranges right? Are there pitfalls? Good resources for the RC components newbie? Thanks much for any response!Anonymoushttps://www.blogger.com/profile/18364478332743154399noreply@blogger.comtag:blogger.com,1999:blog-4049389000246339680.post-88064320150273950732013-04-01T06:21:13.467-07:002013-04-01T06:21:13.467-07:00hi guys, can you give me that connections of this ...hi guys, can you give me that connections of this circuit diagram please..<br />thanks <br />u can send to my email ixxitdomi@gmail.comdomiNickhttps://www.blogger.com/profile/12351907256753555626noreply@blogger.comtag:blogger.com,1999:blog-4049389000246339680.post-86683127817178457652013-02-18T04:23:50.183-08:002013-02-18T04:23:50.183-08:00hi, great work. Is it possible that u upload schem...hi, great work. Is it possible that u upload schematic of the circuit been used? Or email it to my mail, asperodz@rocketmail.com. Thx. Anonymoushttps://www.blogger.com/profile/14777749314336782053noreply@blogger.comtag:blogger.com,1999:blog-4049389000246339680.post-74863489370917337292012-06-30T23:52:05.621-07:002012-06-30T23:52:05.621-07:00try already it errors
Error [192] C:\Microchip ...try already it errors<br /><br />Error [192] C:\Microchip Solutions v2010-10-19\Project_NECTEC\Test_16F877\ESC2.c; 44.1 undefined identifier "ANSEL"<br />Error [192] C:\Microchip Solutions v2010-10-19\Project_NECTEC\Test_16F877\ESC2.c; 47.1 undefined identifier "OPTION"<br />Error [192] C:\Microchip Solutions v2010-10-19\Project_NECTEC\Test_16F877\ESC2.c; 62.1 undefined identifier "GODONE"Anonymoushttps://www.blogger.com/profile/10484706331704761531noreply@blogger.comtag:blogger.com,1999:blog-4049389000246339680.post-35187168465041649642012-06-30T18:30:37.821-07:002012-06-30T18:30:37.821-07:00Have you tried Googling it?
It would help to have ...Have you tried Googling it?<br />It would help to have the lines of code, too. Those sound like very basic errors. I did some quick searches of the errors, and the first results look promising.lordvonhttps://www.blogger.com/profile/05681123007982690331noreply@blogger.comtag:blogger.com,1999:blog-4049389000246339680.post-56327714486544780532012-06-30T13:32:10.143-07:002012-06-30T13:32:10.143-07:00try already it errors
Error 20 "ESC1.c"...try already it errors<br /><br />Error 20 "ESC1.c" Line 2(1,2): Filename must start with " or <<br />Error 128 "ESC1.c" Line 6(1,2): A #DEVICE required before this lineAnonymoushttps://www.blogger.com/profile/10484706331704761531noreply@blogger.comtag:blogger.com,1999:blog-4049389000246339680.post-77840047659772681432012-06-30T03:18:42.539-07:002012-06-30T03:18:42.539-07:00Help me please?Help me please?Anonymoushttps://www.blogger.com/profile/10484706331704761531noreply@blogger.comtag:blogger.com,1999:blog-4049389000246339680.post-22327681318131321452012-06-29T22:28:22.319-07:002012-06-29T22:28:22.319-07:00try already it errors
Error 20 "ESC1.c"...try already it errors<br /><br />Error 20 "ESC1.c" Line 2(1,2): Filename must start with " or <<br />Error 128 "ESC1.c" Line 6(1,2): A #DEVICE required before this lineAnonymoushttps://www.blogger.com/profile/10484706331704761531noreply@blogger.comtag:blogger.com,1999:blog-4049389000246339680.post-89887913072209363072012-06-29T22:21:05.849-07:002012-06-29T22:21:05.849-07:00Did you try out my code? If so, did you get errors...Did you try out my code? If so, did you get errors?lordvonhttps://www.blogger.com/profile/05681123007982690331noreply@blogger.comtag:blogger.com,1999:blog-4049389000246339680.post-68227832509235243302012-06-29T22:05:43.802-07:002012-06-29T22:05:43.802-07:00yes,I have pickit2 and I want to know about drive ...yes,I have pickit2 and I want to know about drive brushless with ESC same you<br />Can you help me please...Anonymoushttps://www.blogger.com/profile/10484706331704761531noreply@blogger.comtag:blogger.com,1999:blog-4049389000246339680.post-91673401793941370952012-06-29T14:07:31.702-07:002012-06-29T14:07:31.702-07:00Hi, have you looked at MPLAB?
http://www.microchip...Hi, have you looked at MPLAB?<br />http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=1406&dDocName=en019469&part=SW007002<br /><br />I use this along with the PicKit programmer hardware. I have a pickit 2, but I think there is now a pickit 3.lordvonhttps://www.blogger.com/profile/05681123007982690331noreply@blogger.comtag:blogger.com,1999:blog-4049389000246339680.post-55039731855679475182012-06-29T12:26:26.920-07:002012-06-29T12:26:26.920-07:00I want drive brushless with PIC 16F877 by c langua...I want drive brushless with PIC 16F877 by c language<br /><br />Can you help me please.....<br />My e-mail Air_force50@hotmail.comAnonymoushttps://www.blogger.com/profile/10484706331704761531noreply@blogger.com