Author |
Message |
Topic: Using 12F1840 to control r/c servo |
BLL
Replies: 23
Views: 49663
|
Forum: General CCS C Discussion Posted: Sat Apr 11, 2020 11:04 am Subject: Using 12F1840 to control r/c servo |
What a clever idea - I hadn't thought of that.
I have now binned timer0 and controlled the strobes from inside timer1.
It's simple and works brilliantly!
Thank you so much for your suggestion.
... |
Topic: Using 12F1840 to control r/c servo |
BLL
Replies: 23
Views: 49663
|
Forum: General CCS C Discussion Posted: Sat Apr 11, 2020 7:05 am Subject: Using 12F1840 to control r/c servo |
Hi PCM Programmer
Thank you for your sample code. As expected, it works fine.
In order to get the double flash, followed by a long pause, I have modified the code as follows:
#INT_TIMER0
void t0 ... |
Topic: Using 12F1840 to control r/c servo |
BLL
Replies: 23
Views: 49663
|
Forum: General CCS C Discussion Posted: Fri Apr 10, 2020 2:28 pm Subject: Using 12F1840 to control r/c servo |
Hi all,
Now back at home, I have been playing with the 1840 to drive the servo and, hey, it works perfectly!
Now to the next problem:
The 1840 must also flash a pair of leds as an aircraft strobe ... |
Topic: Using 12F1840 to control r/c servo |
BLL
Replies: 23
Views: 49663
|
Forum: General CCS C Discussion Posted: Fri Feb 21, 2020 5:19 am Subject: Using 12F1840 to control r/c servo |
Hi Ttelmah
I have now reworked your example to use timer1 for the CCP and timer2 for the off time and using 400Hz. It is a miniature digital servo I am using, mainly because I can program its speed ... |
Topic: Using 12F1840 to control r/c servo |
BLL
Replies: 23
Views: 49663
|
Forum: General CCS C Discussion Posted: Fri Feb 21, 2020 3:33 am Subject: Using 12F1840 to control r/c servo |
Hi both
I did not know about the 400 Hz mode - my googling always talked about the 20ms gap. I have looked at your example. I would need to use timer1 as the 1840 doesn't have a timer3 and, as you ... |
Topic: Using 12F1840 to control r/c servo |
BLL
Replies: 23
Views: 49663
|
Forum: General CCS C Discussion Posted: Thu Feb 20, 2020 8:25 am Subject: Using 12F1840 to control r/c servo |
Hi all
Having figured out how to get 20ms out of timer2 for the space, I have been trying to understand how to use CCP1 to get my 830 or 1500 us mark pulse. The datasheet says "Compare mode make ... |
Topic: Using 12F1840 to control r/c servo |
BLL
Replies: 23
Views: 49663
|
Forum: General CCS C Discussion Posted: Tue Feb 18, 2020 2:01 pm Subject: Using 12F1840 to control r/c servo |
Hi Thanks for the reply. So, using the figures I gave, I can get my 19ms delay, using a post scale value and tyimer2 overflow interrupt function?
I can then use CCP1/timer1 to give me the 832 or 15 ... |
Topic: Using 12F1840 to control r/c servo |
BLL
Replies: 23
Views: 49663
|
Forum: General CCS C Discussion Posted: Tue Feb 18, 2020 12:04 pm Subject: Using 12F1840 to control r/c servo |
Hi all
A question on timer2. As the datasheet states, timer2 is fed by a prescaler, fed by Fosc/4. So for example, if I set the RC osc to 16MHz, then Fosc/4 = 4MHz or 1 pulse every o.25us. If I set t ... |
Topic: Using 12F1840 to control r/c servo |
BLL
Replies: 23
Views: 49663
|
Forum: General CCS C Discussion Posted: Sun Feb 16, 2020 10:38 am Subject: Using 12F1840 to control r/c servo |
Hi Temtronic
That's a good idea.
I understand (I think) that if timer1 is set to zeroand the CCP1 o/p pin is set high, and timer1 is enabled, it will count up and when its value = the CCP1 set value ... |
Topic: Using 12F1840 to control r/c servo |
BLL
Replies: 23
Views: 49663
|
Forum: General CCS C Discussion Posted: Sun Feb 16, 2020 4:52 am Subject: Using 12F1840 to control r/c servo |
Hi Ttelmah
Thank you for your reply.
Am I on the right lines here?
12F1840, internal osc at 16MHz:
#FUSES INTRC_IO
#use delay(internal=16M)
setup_timer1(T1_INTERNAL | T1_DIV_BY_1);
I on ... |
Topic: Using 12F1840 to control r/c servo |
BLL
Replies: 23
Views: 49663
|
Forum: General CCS C Discussion Posted: Sat Feb 15, 2020 5:37 am Subject: Using 12F1840 to control r/c servo |
Hi, Thanks for the replies. All I want to do is control ONE servo, using a 12F1840. The PIC also needs to flash some LEDs, but that's all.
The PIC has 2 CCP channels, so can I generate the pulses t ... |
Topic: Using 12F1840 to control r/c servo |
BLL
Replies: 23
Views: 49663
|
Forum: General CCS C Discussion Posted: Thu Feb 13, 2020 2:22 pm Subject: Using 12F1840 to control r/c servo |
Hi
I want to control an r/c servo, using a 12F1840. I have looked at various code but none seems to fit the 1840 timers. Can anyone help me please?
Thanks
Brian |
Topic: 12F1840 PWM Generation |
BLL
Replies: 3
Views: 11995
|
Forum: General CCS C Discussion Posted: Tue Aug 06, 2019 1:59 am Subject: 12F1840 PWM Generation |
Hi Ttelmah
Thanks again for your help - I shall go and study your code.
Brian |
Topic: 12F1840 PWM Generation |
BLL
Replies: 3
Views: 11995
|
Forum: General CCS C Discussion Posted: Mon Aug 05, 2019 12:11 pm Subject: 12F1840 PWM Generation |
Hi,
I want to control a model r/c servo from the 1840. I need to be able to select either 830 us or 1500us pulse width.
I have looked at lots of posts on PWM, but am still not seeing the wood for ... |
Topic: Help to understand SET_PWM1_DUTY function |
BLL
Replies: 8
Views: 34861
|
Forum: General CCS C Discussion Posted: Mon Mar 25, 2019 4:40 am Subject: Help to understand SET_PWM1_DUTY function |
I don't know how this happened. It was not intentional.
End of story. |
|