pwm

Forum for problems or queries regarding other Flowcode Components. Eg LEDs, Switches, LCD, Gfx LCD etc

Moderators: Benj, Mods

Post Reply
Dompelpompje
Posts: 8
Joined: Thu Mar 13, 2008 10:57 am
Contact:

pwm

Post by Dompelpompje »

Hallo

Question

I am using a 16F876A at 10 Mhz
I trying to get a analog output at RC1 ( CCP2) or RC2 (CCP1)
I have placed variabel input at RA0/AN0
At the output placed a risistor(4,7K) and C (10uF) to ground( filter)
But it seems noting happends at the output
Is there a tutorial some where ?

On the internet a found at

http://WWW.picbasic.nl
Cursus 7 and then simpel DAC



DEVICE 16F628A ;Gebruik een 16F628A type
CONFIG INTRC_OSC_NOCLKOUT, WDT_OFF, PWRTE_ON, LVP_OFF, MCLRE_OFF
ALL_DIGITAL TRUE ;Alle ingangen digitaal

WHILE 1 = 1 ;Oneindige lus
PWM PORTA.6, 127, 20 ;20 PWM pulsjes met 127/255 duty naar PORTA.6
DELAYMS 5000 ;5 seconden wachten, de spanning zal zakken
WEND

But how do we place this in flowcode ?
Is there anyone that has a tutorial ?


Meeuwes Kuijer Holland

chevy6600
Flowcode V4 User
Posts: 115
Joined: Fri Feb 22, 2008 6:38 pm
Contact:

Re: pwm

Post by chevy6600 »

Hi Dompelpompje, i am not an expert so may not be able to help, i am not sure what you are trying to do. There are examples from matrix, have you tried them?.
i have the v3 development board so if you have also got it i may be able to help if you explain what are trying to do.

is this example any good to you?
Attachments
ADC Controlled PWM.fcf
(4.5 KiB) Downloaded 465 times

Dompelpompje
Posts: 8
Joined: Thu Mar 13, 2008 10:57 am
Contact:

Re: pwm

Post by Dompelpompje »

Yes a did try
But when i conenct a multimeter at the output
there is no voltage reaction ?

Sean
Valued Contributor
Valued Contributor
Posts: 548
Joined: Tue Jun 26, 2007 11:23 am
Has thanked: 6 times
Been thanked: 44 times
Contact:

Re: pwm

Post by Sean »

Hello Meeuwes,

The PWM program you sent us worked correctly when we tested it. Problems of this type are often caused when the chip configuration settings do not match the hardware.

A you able to confirm that the device is running (correct clock selection, watchdog setting etc.).

You mentioned that you are driving an LCD, does it display the expected output? A low frequency software controlled square wave output or counting sequence on an unused port can also be used to confirm that the device is running, and at the expected frequency.

chevy6600
Flowcode V4 User
Posts: 115
Joined: Fri Feb 22, 2008 6:38 pm
Contact:

Re: pwm

Post by chevy6600 »

Hi Dompelpompje, I am using pic 16F877a on the HP488 development board, using the above example, setup to use Xtal, using the potentiometer on the development board, the output on the pin `ccp1` shows a voltage 0v to 3v.
Has the pic 16F876a got a pwm function on?
Are you testing the right pin? it needs to be the ccp1 pin.

Dompelpompje
Posts: 8
Joined: Thu Mar 13, 2008 10:57 am
Contact:

Re: pwm

Post by Dompelpompje »

I did test on ccp1 (RC2) and on ccp2 (RC2) no signal with multimeter
I did also look with scoop but nothing is happening on scoop
It seems that PWM is not on ?
But how do i set PWM on ?
My programmer has no function to put it on ?

User avatar
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

Post by Benj »

Hello
I did test on ccp1 (RC2) and on ccp2 (RC2) no signal with multimeter
By this do you mean
I did test on ccp1 (RC2) and on ccp2 (RC1) no signal with multimeter
If not then hopefully the problem is just the pin you were testing,

Remember to check your configuration settings are correct in Flowcode.

It may also be wise to do a simple program eg a flashing LED to make sure that the chip is running. Your programmer does not have to do anything special to start the PWM. Simply program the chip and as long as the chip is running the PWM should be working correctly.

Dompelpompje
Posts: 8
Joined: Thu Mar 13, 2008 10:57 am
Contact:

Re: pwm

Post by Dompelpompje »

My pic is running
I have connected lcd and this is working
I checked with a scoop at the ossilator this gives me good signal
I did try a different type of pic but stil no signal at output
I did try different ossilators 4 Mhz and 10 Mhz
but no signal at output

The compiler gives some warnings
Is my licence not oke ?


Warning unreferenced functions removed:
FCD_PWM0_Disable in: C:\flowcode tut new\ADC Controlled PWM meeuwes.c
FCD_PWM0_ChangePeriod in: C:\flowcode tut new\ADC Controlled PWM meeuwes.c
FCD_ADC0_ReadAsInt in: C:\flowcode tut new\ADC Controlled PWM meeuwes.c
FCD_LCDDisplay0_GetDefines in: C:\flowcode tut new\ADC Controlled PWM meeuwes.c
FCD_LCDDisplay0_Clear in: C:\flowcode tut new\ADC Controlled PWM meeuwes.c
FCD_LCDDisplay0_PrintASCII in: C:\flowcode tut new\ADC Controlled PWM meeuwes.c
FCD_LCDDisplay0_Command in: C:\flowcode tut new\ADC Controlled PWM meeuwes.c
FCD_LCDDisplay0_RawSend in: C:\flowcode tut new\ADC Controlled PWM meeuwes.c
FCD_LCDDisplay0_PrintString in: C:\flowcode tut new\ADC Controlled PWM meeuwes.c
LCD_1311264_Dummy_Function in: C:\flowcode tut new\ADC Controlled PWM meeuwes.c

Dompelpompje
Posts: 8
Joined: Thu Mar 13, 2008 10:57 am
Contact:

Re: pwm

Post by Dompelpompje »

When a copy the C file into MPLAB v6.60

A get the following message

Clean: Deleting intermediary and output files.
Clean: Done.
Executing: "C:\Program Files\MPLAB IDE\MCHIP_Tools\mpasmwin.exe" /q /p16F676 "ADC Controlled PWM meeuwes.asm" /l"ADC Controlled PWM meeuwes.lst" /e"ADC Controlled PWM meeuwes.err"
Message[301] C:\PROGRAM FILES\MPLAB IDE\MCHIP_TOOLS\P16F876A.INC 36 : MESSAGE: (Processor-header file mismatch. Verify selected processor.)
Message[302] C:\NIEUWE MAP\ADC CONTROLLED PWM MEEUWES.ASM 607 : Register in operand not in bank 0. Ensure that bank bits are correct.
Message[302] C:\NIEUWE MAP\ADC CONTROLLED PWM MEEUWES.ASM 608 : Register in operand not in bank 0. Ensure that bank bits are correct.
Message[302] C:\NIEUWE MAP\ADC CONTROLLED PWM MEEUWES.ASM 609 : Register in operand not in bank 0. Ensure that bank bits are correct.
Message[302] C:\NIEUWE MAP\ADC CONTROLLED PWM MEEUWES.ASM 610 : Register in operand not in bank 0. Ensure that bank bits are correct.
Message[302] C:\NIEUWE MAP\ADC CONTROLLED PWM MEEUWES.ASM 611 : Register in operand not in bank 0. Ensure that bank bits are correct.
Message[302] C:\NIEUWE MAP\ADC CONTROLLED PWM MEEUWES.ASM 612 : Register in operand not in bank 0. Ensure that bank bits are correct.
Message[302] C:\NIEUWE MAP\ADC CONTROLLED PWM MEEUWES.ASM 674 : Register in operand not in bank 0. Ensure that bank bits are correct.
Message[302] C:\NIEUWE MAP\ADC CONTROLLED PWM MEEUWES.ASM 675 : Register in operand not in bank 0. Ensure that bank bits are correct.
Message[302] C:\NIEUWE MAP\ADC CONTROLLED PWM MEEUWES.ASM 680 : Register in operand not in bank 0. Ensure that bank bits are correct.
Message[302] C:\NIEUWE MAP\ADC CONTROLLED PWM MEEUWES.ASM 681 : Register in operand not in bank 0. Ensure that bank bits are correct.
Message[302] C:\NIEUWE MAP\ADC CONTROLLED PWM MEEUWES.ASM 702 : Register in operand not in bank 0. Ensure that bank bits are correct.
Message[302] C:\NIEUWE MAP\ADC CONTROLLED PWM MEEUWES.ASM 704 : Register in operand not in bank 0. Ensure that bank bits are correct.
Message[302] C:\NIEUWE MAP\ADC CONTROLLED PWM MEEUWES.ASM 727 : Register in operand not in bank 0. Ensure that bank bits are correct.
Message[302] C:\NIEUWE MAP\ADC CONTROLLED PWM MEEUWES.ASM 729 : Register in operand not in bank 0. Ensure that bank bits are correct.
Loaded C:\Nieuwe map\ADC Controlled PWM meeuwes.COD
BUILD SUCCEEDED: Mon Mar 17 20:52:27 2008

User avatar
Steve
Matrix Staff
Posts: 3422
Joined: Tue Jan 03, 2006 3:59 pm
Has thanked: 114 times
Been thanked: 422 times
Contact:

Re: pwm

Post by Steve »

You can safely ignore those messages and warnings.

Dompelpompje
Posts: 8
Joined: Thu Mar 13, 2008 10:57 am
Contact:

Re: pwm

Post by Dompelpompje »

If someone is reading this
The anser is is following
I am using a student version
In this version the compiler thus not compile the PWM
you have to have the professional version

Post Reply