WiCard PWM (+Tutorial Video)

WiCard - Smart Programmable WiFi Controller Module

WiCard PWM (+Tutorial Video)

wicard pwm slider

WiCard PWM (Pulse Width Modulator)

The WiCard has 19 PWM lines which are able to be set at the same time. The following table shows which pins are able to be set as PWM:

PIN PortBit Pulse Width Modulator Output
A01 VCC 3.3v
A02 Ground
A03 0 *
A04 1 *
A05 2 *
A06 3 *
A07 4 *
A08 5 *
A09 6 *
A10 7
A11 16 *
A12 17 *
A13 18 *
A14 19
A15 25
B01 24  
B02 23
B03 22 *
B04 21 *
B05 20 *
B06 15 *
B07 14 *
B08 13 *
B09 12 *
B10 11 *
B11 10 *
B12 9
B13 8
B14 Ground
B15 VCC 3.3v

 

The high output level of output pulse is almost equal with the VCC (3.3V) and the low level of output pulse is equal with Ground (0V).

 

Setting PWM Channels

The “SetPinAsPWM(ucChannel, ucLowTime, ucHighTime)” function sets the channel as PWM. The first argument is the channel number (PortBit number),  the second argument is the time of low level voltage of the pulse modulator channel, and the third argument is the time of high level voltage of the pulse modulator channel. The unit of the times is milliseconds and the range of timers is 0-255.

Example:

main()
{
    SetPinAsPWM(1, 200, 200);
}

 

The Slider:

In our simulator we put a slider to setting the pins as PWM channels automatically. To using sliders, drag and drop the slider into the control box. Then double click it.

wicard pwm slider simulator

Select the pin that you want to set as PWM channel. Then Set the PWM Times (The unit is mS):

wicard pwm slider simulator 12

For example if you set 1 as start on time, 4 as end on time, 4 as start off time and 1 as end of time, the slider level and PWM will be like this:

0 (Level of the slider is equal with 0): 0 mS on and 255 mS off (Always off) – “On” means output 1 – “Off” means output 0.

1: 1 mS on and 4 mS off (200Hz, also 20% duty cycle).

2: 1 mS on and 3 mS off (250Hz, also 25% duty cycle).

3: 1 mS on and 2 mS off (333Hz, also 33% duty cycle).

4: 1 mS on and 1 mS off (500Hz, also 50% duty cycle).

5: 2 mS on and 1 mS off (333Hz, also 66% duty cycle).

6: 3 mS on and 1 mS off (250Hz, also 75% duty cycle).

7: 4 mS on and 1 mS off (200Hz, also 80% duty cycle).

 

Tutorial Video:

This video shows you how to use slider and set the PWM channels:

Here’s the schematic of the circuit in the video:

wicard gpio toggle push pwm

 

To downloading the plans, schematics and firmware, please refer to: https://trial.wicard.net

Also to finding out another stuff about WiCard WiFi Module, please refer to our home page and blog.

 

Leave a Reply

Your email address will not be published. Required fields are marked *

16 − 7 =