flow rate
Tue Jul 29 2008, 02:22 pm
How to interface LPC2106 with L293D
make use of any two available gpios.
are u using PWM in IRQ maode??
Tue Jul 29 2008, 04:10 pm
Hi every body
I required some programming help. I am using LPC2106 for my project
Can you provide one example program for generation of 60% duty cycle PWM wave using keil ‘c’?
How to configure the PWM registers, how to find out match register value
I am using 14.7C61Mhz crystal & not using PLL
Thank you
Regards
chandu
I required some programming help. I am using LPC2106 for my project
Can you provide one example program for generation of 60% duty cycle PWM wave using keil ‘c’?
How to configure the PWM registers, how to find out match register value
I am using 14.7C61Mhz crystal & not using PLL
Thank you
Regards
chandu
Tue Jul 29 2008, 10:47 pm
hope u have a fair understanding of timers in LPC21xx controllers.. it is important for the PWM to be produced..
here take a look of this sample code based on 214x controller hope it helps ..
here take a look of this sample code based on 214x controller hope it helps ..
#include "LPC214x.h" /* LPC21xx definitions */ #include "type.h" #include "irq.h" #include "timer.h" #include "pwm.h" volatile DWORD match_counter; /****************************************************************************** ** Function name: PWMHandler ** ** Descriptions: PWM interrupt handler ** For now, it only deals with PWM match 0 ** ** parameters: None ** Returned value: None ** ******************************************************************************/ // mthomas: +static static void PWMHandler (void) __irq { DWORD regVal; regVal = PWMIR; IENABLE; /* handles nested interrupt */ if ( regVal & MR0_INT ) { match_counter++; } PWMIR |= regVal; /* clear interrupt flag on match 0 */ IDISABLE; VICVectAddr = 0; /* Acknowledge Interrupt */ } /****************************************************************************** ** Function name: PWM_Init ** ** Descriptions: PWM initialization, setup all GPIOs to PWM0~6, ** reset counter, all latches are enabled, interrupt ** on PWMMR0, install PWM interrupt to the VIC table. ** ** parameters: Duty cycle ** Returned value: true or fase, if VIC table is full, return false ** ******************************************************************************/ DWORD PWM_Init( DWORD cycle ) { match_counter = 0; PINSEL0 = 0x000A800A; /* set GPIOs for all PWMs */ PINSEL1 = 0x00000400; PWMTCR = TCR_RESET; /* Counter Reset */ PWMPR = 0x00; /* count frequency:Fpclk */ PWMMCR = PWMMR0I | PWMMR0R; /* interrupt on PWMMR0, reset on PWMMR0, reset TC if PWM0 matches */ PWMMR0 = cycle; /* set PWM cycle */ PWMMR1 = cycle * 5/6; PWMMR2 = cycle * 2/3; PWMMR3 = cycle * 1/2; PWMMR4 = cycle * 1/3; PWMMR5 = cycle * 1/6; /* all PWM latch enabled */ PWMLER = LER0_EN | LER1_EN | LER2_EN | LER3_EN | LER4_EN | LER5_EN | LER6_EN; if ( install_irq( PWM0_INT, (void *)PWMHandler ) == FALSE ) { return (FALSE); } return (TRUE); } /****************************************************************************** ** Function name: PWM_Set ** ** Descriptions: PWM cycle setup ** ** parameters: PWM cycle and offset ** Returned value: None ** ******************************************************************************/ void PWM_Set( DWORD cycle, DWORD offset ) { PWMMR0 = cycle; /* set PWM cycle */ PWMMR1 = cycle * 5/6 + offset; PWMMR2 = cycle * 2/3 + offset; PWMMR3 = cycle * 1/2 + offset; PWMMR4 = cycle * 1/3 + offset; PWMMR5 = cycle * 1/6 + offset; /* The LER will be cleared when the Match 0 takes place, in order to load and execute the new value of match registers, all the PWMLERs need to reloaded. all PWM latch enabled */ PWMLER = LER0_EN | LER1_EN | LER2_EN | LER3_EN | LER4_EN | LER5_EN | LER6_EN; return; } /****************************************************************************** ** Function name: PWM_Start ** ** Descriptions: Enable PWM by setting the PCR, PTCR registers ** ** parameters: None ** Returned value: None ** ******************************************************************************/ void PWM_Start( void ) { /* All single edge, all enable */ PWMPCR = PWMENA1 | PWMENA2 | PWMENA3 | PWMENA4 | PWMENA5 | PWMENA6; PWMTCR = TCR_CNT_EN | TCR_PWM_EN; /* counter enable, PWM enable */ return; } /****************************************************************************** ** Function name: PWM_Stop ** ** Descriptions: Stop all PWM channels ** ** parameters: None ** Returned value: None ** ******************************************************************************/ void PWM_Stop( void ) { PWMPCR = 0; PWMTCR = 0x00; /* Stop all PWMs */ return; }
Fri Aug 01 2008, 10:04 am
Hi Ajay
I am very sorry for creation of one more thread
I have not seen my thread in the “Project Help forumâ€, that’s why I have posted one more thread to the project help
After your reply I got my thread in the "ARM Development forum†now I will continue same thread
Thank you
Regards
chandu
I am very sorry for creation of one more thread
I have not seen my thread in the “Project Help forumâ€, that’s why I have posted one more thread to the project help
After your reply I got my thread in the "ARM Development forum†now I will continue same thread
Thank you
Regards
chandu
Sat Aug 02 2008, 04:39 pm
Hay
What are the default settings for CLOCK in the LPC2106? I am using 14.7C64MHZ crystal
With out PLL & VPB Divider can I write programs, can I use 14.7MHZ crystal directly?
If i have not did any setting s in the LPC2106, then what is default clock
Thank you
Regards
chandu
What are the default settings for CLOCK in the LPC2106? I am using 14.7C64MHZ crystal
With out PLL & VPB Divider can I write programs, can I use 14.7MHZ crystal directly?
If i have not did any setting s in the LPC2106, then what is default clock
Thank you
Regards
chandu
Mon Aug 04 2008, 10:55 pm
the above picture shows how it is...
i would really like to know why you are against using PLL .
Pll and MAM increase the fuctionality of arm tremendously.
still if not using arm .. just use the external crystal.. and the clock will be same as in any controller . in your case 14.745Mhz.
if not using pll i wud suggest u to go for a crystall anywhere from 10-30Mhz.. but choose a round figure equation say 20Mhz. rather than 14.745
that will make your calculations easier.
nattu like this.
Fri Aug 08 2008, 10:23 am
hay
my circuit is generating 1KHz PWM pulses using LPC2106 micro controller My software is working well
I required some hardware help
I am planning to use L298 H Bridge Driver for my application, it have current sensing pins.
Please suggest switching optoisolater to isolate the LPC2106 with driver circuit & what hardware precautions I have to take to minimize the noise
Reagrds
chandu
my circuit is generating 1KHz PWM pulses using LPC2106 micro controller My software is working well
I required some hardware help
I am planning to use L298 H Bridge Driver for my application, it have current sensing pins.
Please suggest switching optoisolater to isolate the LPC2106 with driver circuit & what hardware precautions I have to take to minimize the noise
Reagrds
chandu
Fri Aug 08 2008, 01:00 pm
try MCT2E or 4N32 opto coupler (single isolation), or MCT6E (2 isolators).
Powered by e107 Forum System