Page 1 of 1

pwm

Posted: Thu Mar 13, 2008 9:57 pm
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

Re: pwm

Posted: Thu Mar 13, 2008 11:43 pm
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?

Re: pwm

Posted: Fri Mar 14, 2008 7:35 am
by Dompelpompje
Yes a did try
But when i conenct a multimeter at the output
there is no voltage reaction ?

Re: pwm

Posted: Fri Mar 14, 2008 10:24 am
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.

Re: pwm

Posted: Fri Mar 14, 2008 11:23 am
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.

Re: pwm

Posted: Fri Mar 14, 2008 6:40 pm
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 ?

Re: pwm

Posted: Mon Mar 17, 2008 11:02 am
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.

Re: pwm

Posted: Mon Mar 17, 2008 7:48 pm
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

Re: pwm

Posted: Mon Mar 17, 2008 8:56 pm
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

Re: pwm

Posted: Mon Mar 17, 2008 8:59 pm
by Steve
You can safely ignore those messages and warnings.

Re: pwm

Posted: Tue Mar 18, 2008 5:32 pm
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