Page 1 of 1

PWM component and PIC 16F777

Posted: Tue Apr 01, 2008 8:40 pm
by wim314
According to the datasheet of the PIC 16F777, this chip has 3 PWM channels. But in Flowcode I can only address 2 PWM modules. Has someone any idea how I can use the 3rd PWM channel from within flowcode?

Re: PWM component and PIC 16F777

Posted: Wed Apr 02, 2008 11:26 am
by Benj
Hello Wim

Currently Flowcode can only process a maximum of 2 PWM channels. This is something that will be improved over time. At the moment you can control the 3rd PWM channel via C code. Alternatively you can use a timer based interrupt combined with a bit of control logic to bit bang out a PWM signal. Eg toggling the output pin when the interrupt is triggered a certain number of times.

Re: PWM component and PIC 16F777

Posted: Wed Apr 02, 2008 8:33 pm
by wim314
Hi Ben,

Thanks for the answer. I have printed the C-code generated by Flowcode and I will study it to know how to address the 3rd PWM of the 16F777.
Hopefully it will work. In any case, I am highly interested in a version of Flowcode which supports more than 2 PWM channels.

Best regards,
Wim

Re: PWM component and PIC 16F777

Posted: Mon Apr 28, 2008 6:06 am
by Mikat
Hello.
The pwm channel 3 works simple c commands ccp3con = OxOC,it enables the pwm,and ccpr3l set the duty...
BUT i have notice that if i use a/c conversion,it disturbs the pwm3 output..
Steve,Ben could you check the a/d con,does it turn ALL the an channels input?
Because if i use only an0 a/d con,it brings port b5 high / input,so it seems to disable the ccp3 output at the time of a/d conversion..
And thats not nice...

Ben any news for that ks108 lcd?


Mika

Re: PWM component and PIC 16F777

Posted: Mon Apr 28, 2008 9:09 am
by Steve
Hello Mika,

Which chip are you using?

I've looked at the most recent version of the 16F777 FCD file and this seems to be ok, but this file may have been updated fairly recently. In the C file that is created by Flowcode, you should see the definition <MX_ADC_TRIS_REG> used in the ADC routine. If this is not present, then you might be using an older version of the FCD file.

Re: PWM component and PIC 16F777

Posted: Mon Apr 28, 2008 11:47 am
by Mikat
Thanks Steve,updating the Flowcode solved problem.
Can you tell me anything about the ks108 glcd,Ben was working it for some times ago..
Btw,Steve can you tell me what is the type of the glcd display,witch is use in flowcode3?

Re: PWM component and PIC 16F777

Posted: Mon Apr 28, 2008 11:59 am
by Benj
Hello Mikat

Im afraid this is currently still a work in progress but hopefully there should be something along the lines of a beta Flowcode component available for this fairly soon.

Re: PWM component and PIC 16F777

Posted: Thu May 29, 2008 5:12 pm
by WalkOver
Mikat wrote:Hello.
The pwm channel 3 works simple c commands ccp3con = OxOC,it enables the pwm,and ccpr3l set the duty...
BUT i have notice that if i use a/c conversion,it disturbs the pwm3 output..
Steve,Ben could you check the a/d con,does it turn ALL the an channels input?
Because if i use only an0 a/d con,it brings port b5 high / input,so it seems to disable the ccp3 output at the time of a/d conversion..
And thats not nice...

Ben any news for that ks108 lcd?


Mika
Mika, Can you put online your .fcf file ? I am very interested in the use of a third hardware pwm but I don't know the C code.

Thank you for your help.

Re: PWM component and PIC 16F777

Posted: Mon Jun 02, 2008 4:02 pm
by Mikat
WalkOver wrote:
Mikat wrote:Hello.
The pwm channel 3 works simple c commands ccp3con = OxOC,it enables the pwm,and ccpr3l set the duty...
BUT i have notice that if i use a/c conversion,it disturbs the pwm3 output..
Steve,Ben could you check the a/d con,does it turn ALL the an channels input?
Because if i use only an0 a/d con,it brings port b5 high / input,so it seems to disable the ccp3 output at the time of a/d conversion..
And thats not nice...

Ben any news for that ks108 lcd?


Mika
Mika, Can you put online your .fcf file ? I am very interested in the use of a third hardware pwm but I don't know the C code.

Thank you for your help.
The ccp3 usage is very easy..
Put the code "ccp3con = OxOC;",without the "" in c ode block,this enables the pwm...
And the duty can be set "ccpr3l = FCV_DYTY;",,without the "" in c ode block..
The FCV_DUTY is flowcode variable named duty,so you can use any variable you like,all you have to do is make variable on fc variable manager and REMEMBER to use CAPS and FCV_ in the front of the variable...
The third pwm work fine,i had the old version of flowcode,that causes the a/d con problem...
Hope that helps..

Re: PWM component and PIC 16F777

Posted: Mon Jun 02, 2008 8:39 pm
by Benj
Hi Mika

Thanks for the post.

Regarding the KS108 LCD I have a prototype circuit sitting on my desk at work. Im currently looking into reducing the i/o pin count eg via serial data so it can sit on a single port.

With any luck there may be a beta component available for this soon. Do you know of any good C code examples to get me up to speed with programming these devices.

Re: PWM component and PIC 16F777

Posted: Tue Jun 03, 2008 7:22 am
by Mikat
Hi Ben,i sent you some files,witch are for ks108,hope those help you..
Is there any change the the upcoming component supports the ks108 at 8bit paraller mode,because seems that at least my display dont have connetions to run it serial,or is it some pins on paraller connections (havent read the datasheet so much)...

Re: PWM component and PIC 16F777

Posted: Tue Jun 03, 2008 12:33 pm
by Benj
Hello Mika

Thanks for the code I will look at it when I get time. The LCD im using does not have a serial option but I will implement a coding method that can either use 2 ports (eg standard straight through connections) or 1 port (serial via a logic chip and a small bit of circuitry). This second option will then probably be made into the E-Block if we choose to develop it further.

Re: PWM component and PIC 16F777

Posted: Tue Jun 03, 2008 7:05 pm
by WalkOver
Mikat wrote:
WalkOver wrote:
Mikat wrote:Hello.
The pwm channel 3 works simple c commands ccp3con = OxOC,it enables the pwm,and ccpr3l set the duty...
BUT i have notice that if i use a/c conversion,it disturbs the pwm3 output..
Steve,Ben could you check the a/d con,does it turn ALL the an channels input?
Because if i use only an0 a/d con,it brings port b5 high / input,so it seems to disable the ccp3 output at the time of a/d conversion..
And thats not nice...

Ben any news for that ks108 lcd?


Mika
Mika, Can you put online your .fcf file ? I am very interested in the use of a third hardware pwm but I don't know the C code.

Thank you for your help.
The ccp3 usage is very easy..
Put the code "ccp3con = OxOC;",without the "" in c ode block,this enables the pwm...
And the duty can be set "ccpr3l = FCV_DYTY;",,without the "" in c ode block..
The FCV_DUTY is flowcode variable named duty,so you can use any variable you like,all you have to do is make variable on fc variable manager and REMEMBER to use CAPS and FCV_ in the front of the variable...
The third pwm work fine,i had the old version of flowcode,that causes the a/d con problem...
Hope that helps..
Thank you very much for your help. I finally managed to activate the third PWM. I just had to put a 0 on RG0 (CCP3).

Thank you very much 8)