Servo issue with 16F88

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 6.

Moderator: Benj

Post Reply
EtsDriver
Posts: 444
Joined: Tue Apr 15, 2014 4:19 pm
Location: Kajaani, Finland
Has thanked: 345 times
Been thanked: 227 times
Contact:

Servo issue with 16F88

Post by EtsDriver »

Hi!
Im doing little bit of thorttle setting work here, and i get error when im trying to use servocontroller as component.

Thanks for any help to overcome this issue! But im not in hurry, have time until 5/2015 with this. :)

Here are the complier logs:

Code: Select all


KaasuSaato.c
Starting preprocessor: "C:\Program Files (x86)\Flowcode 6\compilers\pic\boostc\pp.exe" KaasuSaato.c -i "C:\Program Files (x86)\Flowcode 6\compilers\pic\boostc\include" -d _PIC16F88 -la -c2 -o KaasuSaato.pp -v -d _BOOSTC -d _PIC16 -d _CHAR_INDEX 

.................................
KaasuSaato.c(904:2): error: unknown identifier 'ccp2con'
KaasuSaato.c(904:2): error: invalid operand 'ccp2con'
KaasuSaato.c(904:10): error: failed to generate expression
KaasuSaato.c(906:21): error: unknown identifier 'CCP2IE'
KaasuSaato.c(906:21): error: failed to generate expression
KaasuSaato.c(906:21): error: invalid operand 'CCP2IE'
KaasuSaato.c(906:16): error: failed to generate expression
KaasuSaato.c(906:14): error: invalid operand '1 << ( CCP2IE)'
KaasuSaato.c(906:10): error: failed to generate expression
.
KaasuSaato.c(2712:2): error: unknown identifier 'ccpr2h'
KaasuSaato.c(2712:2): error: invalid operand 'ccpr2h'
KaasuSaato.c(2712:9): error: failed to generate expression
KaasuSaato.c(2713:2): error: unknown identifier 'ccpr2l'
KaasuSaato.c(2713:2): error: invalid operand 'ccpr2l'
KaasuSaato.c(2713:9): error: failed to generate expression
KaasuSaato.c(2739:24): error: unknown identifier 'CCP2IF'
KaasuSaato.c(2739:24): error: failed to generate expression
KaasuSaato.c(2739:24): error: invalid operand 'CCP2IF'
KaasuSaato.c(2739:19): error: failed to generate expression
KaasuSaato.c(2739:17): error: invalid operand '1 << ( CCP2IF)'
KaasuSaato.c(2739:14): error: failed to generate expression
KaasuSaato.c(2739:55): error: unknown identifier 'CCP2IE'
KaasuSaato.c(2739:55): error: failed to generate expression
KaasuSaato.c(2739:55): error: invalid operand 'CCP2IE'
KaasuSaato.c(2739:50): error: failed to generate expression
KaasuSaato.c(2739:48): error: invalid operand '1 << ( CCP2IE)'
KaasuSaato.c(2739:45): error: failed to generate expression
KaasuSaato.c(2739:7): error: invalid operand '(pir2) & (1 << ( CCP2IF))'
KaasuSaato.c(2739:38): error: invalid operand '(pie2) & (1 << ( CCP2IE))'
KaasuSaato.c(2739:34): error: failed to generate expression
KaasuSaato.c success

failure
Completed BoostC compilation, return = 1
And here is the test code:

Dropbox download
Ill just keep the good work up!

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: Servo issue with 16F88

Post by medelec35 »

Hi EtsDriver,
Servos will only work if there are two CCP channels.
Unfortunately 16F88 only has one CCP channel hence the errors. :(

I you would like to use 16F88 then you can bit bang servo using timer interrupts.
I can help you with that if you get stuck.
Alternatively you can choose a different target device with two or more CCP channels

Martin
Martin

EtsDriver
Posts: 444
Joined: Tue Apr 15, 2014 4:19 pm
Location: Kajaani, Finland
Has thanked: 345 times
Been thanked: 227 times
Contact:

Re: Servo issue with 16F88

Post by EtsDriver »

medelec35 wrote:Hi EtsDriver,
Servos will only work if there are two CCP channels.
Unfortunately 16F88 only has one CCP channel hence the errors. :(

I you would like to use 16F88 then you can bit bang servo using timer interrupts.
I can help you with that if you get stuck.
Alternatively you can choose a different target device with two or more CCP channels

Martin
Think have to use the PWM output for the servo then, try and error is the best teacher! :) And i have example code for the bitbanged servo output. I did that one myself for teaching the actuators card at old school.
Ill just keep the good work up!

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: Servo issue with 16F88

Post by medelec35 »

EtsDriver wrote:Think have to use the PWM output for the servo then, try and error is the best teacher!
I do agree with that!

You probably wont be able to use PWM component within flowcode, as the pulse has to be every 20ms which is too low for PWM.
Depending on servo, on duration will be from 0.75 to 2.25ms for the full 180deg.
others will be from 1ms to 2 ms
What I did with my latest version was to use a timer to interrupt every 20ms, then place a loop with a variable count within the interrupt.
I know its not that highly recommended to do that, but it works very well indeed.

Martin
Martin

Post Reply