HWPWM
 
Syntax

 

#include <HWPWM.bas>                         ' source in /Program Files/Coridium/BASIClib 

SUB HWPWM ( channel, cycletime, hightime )  

Description --- available on ARMmite and ARMexpress LITE but not on the original ARMexpress


ARMmite version

The ARMmite supports up to 8 channels of hardware driven PWM.  The IO direction of the pin will be set to output.  Once programmed these will continue to generate the specified PWM until re-programmed or reset.

Cycletime is in microseconds, is the time for a single PWM cycle. Hightimes are also in microseconds and represent the amount of time during the cycle that the corresponding outputs are high.  If the value is -1, then that IO is left as a digital IO.

 hightime1  IO(0)          
 hightime2  IO(1)
 hightime3  IO(2)
 hightime4  IO(3)
 hightime5  IO(4)
 hightime6  IO(9)
 hightime7  IO(10)
 hightime8

 IO(11)

ARMmite PRO version

The ARMmite PRO supports up to 8 channels of hardware driven PWM.  The IO direction of the pin will be set to output.  Once programmed these will continue to generate the specified PWM until re-programmed or reset.

Cycletime is in microseconds, is the time for a single PWM cycle. Hightimes are also in microseconds and represent the amount of time during the cycle that the corresponding outputs are high.  If the value is -1, then that IO is left as a digital IO.

 hightime1  IO(0)          
 hightime2  IO(1)
 hightime3  IO(2)
 hightime4  IO(3)
 hightime5  IO(4)
 hightime6  IO(9)
 hightime7  IO(10)
 hightime8

 IO(11)


ARMexpress LITE version

The ARMexpress LITE supports up to 6 channels of hardware driven PWM.  The IO direction of the pin will be set to output.  Once programmed these will continue to generate the specified PWM until re-programmed or reset.  The format of the command uses 8 channel assignments, but 2 of the channels are not available on the pins.

Cycletime is in microseconds, is the time for a single PWM cycle. Hightimes are also in microseconds and represent the amount of time during the cycle that the corresponding outputs are high.  If the value is -1, then that IO is left as a digital IO.

 hightime1  IO( 5 )
 hightime2  IO( 6 )
 hightime3  IO( 3 )
 hightime4  not available
 hightime5  IO( 14 )
 hightime6  not available
 hightime7  IO( 13 )
 hightime8

 IO( 15 )

PROplus SuperPRO LITE version

The PROplus/SuperPRO supports up to 6 channels of hardware driven PWM.  The IO direction of the pin will be set to output.  Once programmed these will continue to generate the specified PWM until re-programmed or reset.  Use the <HWPWM17.bas> include file.

Cycletime is in microseconds, is the time for a single PWM cycle. Hightimes are also in microseconds and represent the amount of time during the cycle that the corresponding outputs are high.  If the value is -1, then that IO is left as a digital IO.

 hightime1 P2(0)
 hightime2 P2(1)
 hightime3 P2(2)
 hightime4 P2(3)
 hightime5 P2(4)
 hightime6 P2(5)

Example

#include <HWPWM.BAS>
...

'generate 1KHz with 750 and 100 uSec high signals on pins 1,2

HWPWM (2,1000,750)
HWPWM (3,1000,100)

'250 Hz with 1000, 500, 100 uSec high and LOW signals on pins 0,1,2,3

HWPWM (1,4000,1000)
HWPWM (2,4000,500)
HWPWM (3,4000,100)
HWPWM (4,4000,0)


Differences from other BASICs

See also