Device: PIC.12F.12F1572
Generated by: Flowcode v7.2.1.4
Microchip MPLAB XC8 C Compiler (Free Mode) V1.40
Build date: Nov 30 2016
Part Support Version: 1.40
Servo1330.c: main()
109: {
^ (314) ";" expected
122: if (FCV_0dd21_Servo_Controller1__SERVO_IDX < 1)
^ (192) undefined identifier "FCL_SERVOCAL"
(981) pointer required ^
(981) pointer required ^
280: MX_SERVO_REG_CCPR2H = ( FCL_SERVOCAL >> 8 );
^ (192) undefined identifier "MX_SERVO_REG_CCPR2H"
281: MX_SERVO_REG_CCPR2L = ( FCL_SERVOCAL & 0xFF );
^ (192) undefined identifier "MX_SERVO_REG_CCPR2L"
306: MX_SERVO_REG_CCP1Fbits.MX_SERVO_FLAG_CCP1F = 0;
^ (192) undefined identifier "MX_SERVO_REG_CCP1Fbits"
(196) struct/union required ^
Servo1330.c:
314: {
^ (374) missing basic type; int assumed (warning)
^ (314) ";" expected
321: if (FCV_0dd21_Servo_Controller1__SERVO_IDX < 1)
^ (285) no identifier in declaration
^ (374) missing basic type; int assumed (warning)
^ (314) ";" expected
^ (194) ")" expected
^ (285) no identifier in declaration
^ (374) missing basic type; int assumed (warning)
^ (314) ";" expected
Servo1330.c: 330: too many errors (21)
(908) exit status = 1
(908) exit status = 1
Internal oszilator 32mHz. component servo activated for the project. I tried to use the example and only changed the chip. The simulation works fine, but i can't compile without errors.
What do i have to do, to use the Servo with this type of pic?
Hi Speed64,
Servos will only work if there are at lease two CCP channels.
Unfortunately 12F1572 only has one CCP channel hence the errors.
The only way to control servo with 12F1572 is the bit-bang method using a timer interrupt.
I can post an example tomorrow if interested?
The other way is choose a microcontroller with at least two ccp channels.
If you want to stay with 8 pins and use servo component then you can use 12F1612 as that has 2 ccp channnels
Speed64 wrote:I can also use an external interrupt for the RS232 interface?
i / o Pin change interrupt on RX Pin.
It may not work that well with this application.
If you use not timer bit bang method with RX interrupt, the issue could be stretching of the pulse during RX interrupt times.
That will cause the servo to move slightly then back again.
You are best using the servo component if want to use RX interrupt at the same time.
The Arduino Uno and other AVR based Arduinos will work with the Servo component as they have 2 capture compare peripherals available.
We use 2 capture compare peripherals in the component as they allow us to specify the channel period (the length of time a single servo channel is active) as well as the channel duty (the length of time a single servo channel is outputting high) all based on interrupts leaving your program free to do other things.
50Hz is correct for driving servo motors. Does your motor specifically require 60Hz? It's more the pulse then the frequency that the controller works from.
the picture shows a curve with 64Hz.
it just checked again.
How can I switch to 50Hz?
Question: Can I use any pin for the servo if the chip has 2 CCPs?
Question: Does the servo also work with a chip that has a CCP and an ECCP?
PIC18F4553 with 44PINs for example
Q: Do I take a pin labeled CCP?
PIC18F4553 PIN35 RC1 CCP2, 36 RC2 CCP1 or 11 RB3 CCP2
Are the 44pins not included in the simulation?