flowcode pic16F88 and output
flowcode pic16F88 and output
Hi,
I whant to know if the 16F88 chip has en analog outpout and how can i use it with flowcode ( v2 i prefer )
thanks
I whant to know if the 16F88 chip has en analog outpout and how can i use it with flowcode ( v2 i prefer )
thanks
- 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:
You can create an analogue output by using a PWM output connected to a capacitor. It will take some tweaking to get the PWM frequency to match the capacitor charge rate. Then you should be able to set a mark space on the PWM and get a linear analogue voltage out.
Code: Select all
PWM O/P ------ Cap + --------- Analogue out
Cap -
|
GND
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
Hi thanks for your help, the current needed is 2mA. How can i initialised the pwm in flowcode v2 ?Benj wrote:You can create an analogue output by using a PWM output connected to a capacitor. It will take some tweaking to get the PWM frequency to match the capacitor charge rate. Then you should be able to set a mark space on the PWM and get a linear analogue voltage out.Code: Select all
PWM O/P ------ Cap + --------- Analogue out Cap - | GND
- 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:
Hello
In flowcode 2 you will need to create your own C or assembler functions to control the PWM.
Flowcode V3 comes with a PWM component that makes this task a lot easier.
In flowcode 2 you will need to create your own C or assembler functions to control the PWM.
Flowcode V3 comes with a PWM component that makes this task a lot easier.
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
OK but if you can copy the code genereted by flowcode v3 for the PWM component, i'll be happyBenj wrote:Hello
In flowcode 2 you will need to create your own C or assembler functions to control the PWM.
Flowcode V3 comes with a PWM component that makes this task a lot easier.
thanks
ps : is there a solution with Add Defines pwm ?
- Steve
- Matrix Staff
- Posts: 3422
- Joined: Tue Jan 03, 2006 3:59 pm
- Has thanked: 114 times
- Been thanked: 422 times
- Contact:
The code generated by Flowcode V3's PWM component is very bloated for your needs. Also, it is designed for a different compiler than C2C and so it will not work without modification.
I suggest you look at the datasheet for the PICmicro you want to use instead. The section on PWM generation is pretty good and should explain everything you require. For example:
I suggest you look at the datasheet for the PICmicro you want to use instead. The section on PWM generation is pretty good and should explain everything you require. For example:
15.4.4 SETUP FOR PWM OPERATION
The following steps should be taken when configuring
the CCP module for PWM operation:
1. Set the PWM period by writing to the PR2 register.
2. Set the PWM duty cycle by writing to the CCPRxL register and CCPxCON<5:4> bits.
3. Make the CCPx pin an output by clearing the appropriate TRIS bit.
4. Set the TMR2 prescale value, then enable Timer2 by writing to T2CON.
5. Configure the CCPx module for PWM operation.
hi
i found the solution see this site in french
http://isi-si.chez-alice.fr/flowcode/flowcode.htm
I've a new problem. I whant to change the light of a seven digit display by using the pwm. Is someone knows the frequence to have a output 1V< CCP1< 5V ?
thanks
i found the solution see this site in french
http://isi-si.chez-alice.fr/flowcode/flowcode.htm
I've a new problem. I whant to change the light of a seven digit display by using the pwm. Is someone knows the frequence to have a output 1V< CCP1< 5V ?
thanks
- 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:
Thanks for the link.
You need a PWM frequency that is fast enough to acheive a good refresh rate. Then you can simply change to mark space ratio to control the brightness of the display.
You need a PWM frequency that is fast enough to acheive a good refresh rate. Then you can simply change to mark space ratio to control the brightness of the display.
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