View previous topic :: View next topic |
Author |
Message |
stoyanoff
Joined: 20 Jul 2011 Posts: 375
|
Display causes controller block |
Posted: Tue Apr 03, 2012 2:24 am |
|
|
I have connected 2 row LED display to controller. I'm using port C for data and port E for instruction set. When I'm using controllers like 4520, 4620 everything works just fine. When I exchange the controller with 4431 the controller blocks and even it doesn't initialize the display. I don't make any important changes to the program.
Any ideas where is the problem??? |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19513
|
|
Posted: Tue Apr 03, 2012 2:59 am |
|
|
Probably fuses.
The glaring difference on the 4431, is that some of the PortC/D pins have alternate functions controlled by fuse settings. Look for example at the EXCLKD0/C3 fuse, and SSP_RD/RC. Other thing is making sure the power PWM is off. (PWMPIN, and NOPWMPIN). Beware also here, check what fuse pattern your compiler generates (look at the end of the .LST file). Some versions of the compiler have these two fuses reversed, with NOPWMPIN turning the PWM on!.....
Best Wishes |
|
|
stoyanoff
Joined: 20 Jul 2011 Posts: 375
|
|
Posted: Tue Apr 03, 2012 6:11 am |
|
|
I`ve done some changes, but I can`t do it. It`s not a big problem.
I want to ask another thing. I looking at the 18F4431 datasheet and there there is a table (page 193) for the pwm frequency and the pwm register. So I want to know is there a parameter which I have to set to change the value in the PTPER register or only I when I set the period in the setup_power_pwm() is enough to set the output pwm period to appropriate value???
Thanks! |
|
|
Mike Walne
Joined: 19 Feb 2004 Posts: 1785 Location: Boston Spa UK
|
PWM |
Posted: Tue Apr 03, 2012 8:04 am |
|
|
Quote: |
I want to ask another thing. I looking at the 18F4431 datasheet and there there is a table (page 193) for the pwm frequency and the pwm register. So I want to know is there a parameter which I have to set to change the value in the PTPER register or only I when I set the period in the setup_power_pwm() is enough to set the output pwm period to appropriate value???
|
I believe you're correct, it looks like setup_power_pwm() should set pwm period etc.
You may need to peruse '4431 datasheet, CCS manual and the '4431 header file to get all the syntax elements you want.
Mike |
|
|
stoyanoff
Joined: 20 Jul 2011 Posts: 375
|
|
Posted: Tue Apr 03, 2012 9:44 am |
|
|
These are my adjustments to the pwm:
Code: | setup_power_pwm_pins(PWM_BOTH_ON,PWM_BOTH_ON,PWM_OFF,PWM_OFF);
setup_power_pwm(PWM_FREE_RUN, 1, 0, 310, 0, 1,15); |
This I suppose means: PWM 0 and 2 both channels on.
Second part:
Clock=25M
// Mode = Free Run
// Postscale = 1 (1-16) Timebase output postscaler
// TimeBase = 0 (0-65355) Initial value of PWM Timebase
// Period = 310 (0-4095) Max value of PWM TimeBase 50us
// Compare = 0 (Timebase value for special event trigger)
// Compare Postscale = 1 (Postscaler for Compare value)
// Dead Time =15 which correspond to >240ns real time value
Is this corrent???
I suppose this must generate output pulses with 20Mhz frequency. |
|
|
Mike Walne
Joined: 19 Feb 2004 Posts: 1785 Location: Boston Spa UK
|
PWM settings |
Posted: Sat Apr 07, 2012 2:28 am |
|
|
Quote: |
Second part:
Clock=25M
// Mode = Free Run
// Postscale = 1 (1-16) Timebase output postscaler
// TimeBase = 0 (0-65355) Initial value of PWM Timebase
// Period = 310 (0-4095) Max value of PWM TimeBase 50us
// Compare = 0 (Timebase value for special event trigger)
// Compare Postscale = 1 (Postscaler for Compare value)
// Dead Time =15 which correspond to >240ns real time value
Is this corrent???
I suppose this must generate output pulses with 20Mhz frequency.
|
This looks like it belongs to another thread you're running in parallel with this one.
I don't have a current licence or recent upgrade so can't check your parameters.
Are there no pre-scalers for time base and dead time generator?
With 25M clock, 1:1 prescale, 310 period; PWM pulses will be ~20kHz not 20MHz.
I'd expect initial time base setting to only affect your first PWM pulse.
With 1:2 prescale, 15 period; dead time will be 2 * 15 * 40ns = 1200ns.
Mike |
|
|
|