LabVIEW Embedded

cancel
Showing results for 
Search instead for 
Did you mean: 

How to make a PWM period of 20 ms and a pulse duration 0,8-2,0 ms

Hi

How to make a PWM period of 20 ms and a pulse duration 0,8-2,0 ms. deskret pulse length 0.01 ms. for MCB2300. Are there examples of such implementation?

thanks

0 Kudos
Message 1 of 10
(8,599 Views)

Sergiv,

 

I would look at this article: KB 4Q2C8TXY: How Can I Offset a PWM Channel on My ARM Microcontroller?

This article discuss double-edged PWMs.  You would just want to use a single-edged PWM.  You set the PWM period beforehand.  You then specify the duty cycle during run time.

 

Kevin S.

Applications Engineer

National Instruments

0 Kudos
Message 2 of 10
(8,591 Views)

thanks for the reply

 

as an offset to make it understandable. how to implement the duty cycle (0,8-2,0 ms deskretnostyu 0.01 ms for a period PWM (20ms)?

if the supply frequency of 50 Hz (period 20 ms) durations are as follows:
4% - 0,8 ms
5% - 1.0 ms
6% - 1,2 ms
7% - 1,4 ms
8% - 1,6 ms
9% - 1,8 ms
10% - 2,0 ms
11% - 2,0 ms

0 Kudos
Message 3 of 10
(8,584 Views)

Sergiv,

 

Your theory appears to be correct.  Here's the help file outlining what you've done as well: Using Elemental I/O Resources (ARM)

(For 11%, that would correspond to 2.2ms.)

 

Kevin S.

Applications Engineer

National Instruments

0 Kudos
Message 4 of 10
(8,567 Views)

Kevin_S,

 

I have read this help. (11% - 2,0 ms) - this is my typo.
and how to make the duration of 1.57 ms for a period of 20 ms? because the percentage figure should be a whole (25%)

0 Kudos
Message 5 of 10
(8,559 Views)

Sergiv,

 

I see you as having two options (if you want finer resolution):

1) Lower the period of the PWM (such that the percentage values would be of finer resolution with regards to the overall PWM period).

2) Alter the duty cycle of the PWM with an Inline C node.

 

From what I understand, LabVIEW simply calls into the PWM driver distributed by Keil (for the MCB2300).  You can call into the PWM driver directly and/or change register values on the chip if you want in order to do whatever you want.  Both would require you to look through/program in C code.

 

Kevin S.

Applications Engineer

National Instruments

0 Kudos
Message 6 of 10
(8,521 Views)

Hi, Kevin_S

 

1) Lower the period of the PWM (such that the percentage values would be of finer resolution with regards to the overall PWM period).

 

how to implement it

 

 

 

 

2) Alter the duty cycle of the PWM with an Inline C node.

 

где можно поменять этот файл ?

0 Kudos
Message 7 of 10
(8,494 Views)

1) Change your PWM period (to be less than 20ms).  (Then the percentage values will be of finer resolution.)

2) Part of the driver that LabVIEW calls into is located here:
C:\Program Files\National Instruments\LabVIEW 2010\Targets\Keil\Embedded\lib\MCB2300_PWM.c

I would recommend potentially just accessing the PWM registers directly for your chip.  That way you don't have to worry about existing drivers - you're creating your own.  (Look on Keil's Web site potentially for how to do this directly.)

 

Kevin S.

Applications Engineer

National Instruments

Message 8 of 10
(8,489 Views)

1) is not suitable, because need a period of just 20 ms
2) If I delete or change MCB2300_PWM.c something to work with PWM did not change (at first I removed MCB2300_PWM.c and created a new project)

0 Kudos
Message 9 of 10
(8,460 Views)

You're basically wanting to use the hardware in a way not supported by the current driver.  You can access the hardware registers directly.  You will need to look up the datasheet for the LPC2378 in order to find out information specific to that chipset and its PWM hardware capabilities (and how to configure/use it).

 

Kevin S.

Applications Engineer

National Instruments

Message 10 of 10
(8,447 Views)