PWM component and PIC 16F777
PWM component and PIC 16F777
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?
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: PWM component and PIC 16F777
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.
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.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Re: PWM component and PIC 16F777
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
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
-
- Posts: 258
- Joined: Wed Nov 29, 2006 6:32 pm
- Location: Finland
- Has thanked: 7 times
- Been thanked: 36 times
- Contact:
Re: PWM component and PIC 16F777
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
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
- Steve
- Matrix Staff
- Posts: 3424
- Joined: Tue Jan 03, 2006 3:59 pm
- Has thanked: 114 times
- Been thanked: 422 times
- Contact:
Re: PWM component and PIC 16F777
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.
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.
-
- Posts: 258
- Joined: Wed Nov 29, 2006 6:32 pm
- Location: Finland
- Has thanked: 7 times
- Been thanked: 36 times
- Contact:
Re: PWM component and PIC 16F777
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?
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?
Last edited by Mikat on Mon Apr 28, 2008 12:06 pm, edited 1 time in total.
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: PWM component and PIC 16F777
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.
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.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Re: PWM component and PIC 16F777
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.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
Thank you for your help.
-
- Posts: 258
- Joined: Wed Nov 29, 2006 6:32 pm
- Location: Finland
- Has thanked: 7 times
- Been thanked: 36 times
- Contact:
Re: PWM component and PIC 16F777
The ccp3 usage is very easy..WalkOver wrote: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.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
Thank you for your help.
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..
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: PWM component and PIC 16F777
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.
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.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Posts: 258
- Joined: Wed Nov 29, 2006 6:32 pm
- Location: Finland
- Has thanked: 7 times
- Been thanked: 36 times
- Contact:
Re: PWM component and PIC 16F777
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)...
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)...
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: PWM component and PIC 16F777
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.
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.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Re: PWM component and PIC 16F777
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).Mikat wrote:The ccp3 usage is very easy..WalkOver wrote: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.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
Thank you for your help.
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