Difference: BoardSupportPackageH743 (12 vs. 13)

Revision 132022-06-30 - PeterSchmid

Line: 1 to 1
 
META TOPICPARENT name="MecrispCubeH74x"
%DASHBOARD{ section="banner"
Line: 76 to 76
  pwmpin! ( u a -- ) sets the digital output port pin a (D3=3, D4=4, D5=5, D6=6, D9=9, and D10=10) to a PWM value u (0..1000). Default frequency is 1 kHz, TIMER3/TIMER4
Changed:
<
<
pwmprescale ( u -- ) Sets the PWM prescale for TIMER3/TIMER4. 42 kHz / prescale, default 42 -> PWM frequency 1 kHz
>
>
pwmprescale ( u -- ) Sets the PWM prescale for TIMER3/TIMER4. 60 kHz / prescale, default 60 -> PWM frequency 1 kHz
 
Changed:
<
<
ICOCprescale ( u -- ) Sets the input capture / output compare prescale for TIMER2. default 42 -> 42 MHz / 42 = 1 MHz, timer resolution 1 us
>
>
ICOCprescale ( u -- ) Sets the input capture / output compare prescale for TIMER2. default 60 -> 60 MHz / 60 = 1 MHz, timer resolution 1 us
 ICOCperiod! ( u -- ) Sets the input capture / output compare (TIMER2) period. default $FFFFFFFF (4'294'967'295). When the up counter reaches the period, the counter is set to 0. For prescale 32 the maximum time is about 1 h 11 m
Line: 189 to 189
 

Control the Neopixel

Changed:
<
<
apin@ ( a -- u ) returns the ADC value (12 bit, 0 .. 4095) from one of the analog pins A0 to A5 (0 .. 5). Here I use the A0 to control the neopixel blue led brightness.
>
>
apin@ ( a -- u ) returns the ADC value (16 bit, 0 .. 65535) from one of the analog pins A0 to A5 (0 .. 5). Here I use the A0 to control the neopixel blue led brightness.
 
: neo-blue ( -- ) 
  begin

Changed:
<
<
0 apin@ 16 / neopixel!
>
>
0 apin@ 256 / neopixel!
  10 osDelay drop key? until key drop
Line: 202 to 202
 

Control the Knightrider Pace

Changed:
<
<
apin@ ( a -- u ) returns the ADC value (12 bit, 0 .. 4095) from one of the analog pins A0 to A5 (0 .. 5). Here I use the A0 to control the delay.
>
>
apin@ ( a -- u ) returns the ADC value (12 bit, 0 .. 65535) from one of the analog pins A0 to A5 (0 .. 5). Here I use the A0 to control the delay.
 
Line: 211 to 211
 : left ( -- ) 7 0 do 1 i pin dpin!
Changed:
<
<
0 apin@ 10 / osDelay drop \ delay depends on A0
>
>
0 apin@ 160 / osDelay drop \ delay depends on A0
  0 i pin dpin! loop ;
Line: 222 to 222
 : right ( -- ) 8 1 do 1 8 i - pin dpin!
Changed:
<
<
0 apin@ 10 / osDelay drop \ delay depends on A0
>
>
0 apin@ 160 / osDelay drop \ delay depends on A0
  0 8 i - pin dpin! loop ;
Line: 239 to 239
 

Using the PWM (Analog Output Pins)

Six port pins are supported so far.

Changed:
<
<
The 16 bit timers TIM3 (D5 and D6) and TIM4 (D9, D10, D14, and D15) are used for the timebase, time resolution is 1 us (42 MHz SysClk divided by 42). The PWM scale is from 0 (0 % duty cycle) to 1000 (100 % duty cycle), this results in a PWM frequency of 1 kHz. If you need higher PWM frequencies, decrease the divider and/or the scale.
>
>
The 16 bit timers TIM1 (D3, D4, D5 and D6) and TIM4 (D9, D10) are used for the timebase, time resolution is 1 us (60 MHz SysClk divided by 60). The PWM scale is from 0 (0 % duty cycle) to 1000 (100 % duty cycle), this results in a PWM frequency of 1 kHz. If you need higher PWM frequencies, decrease the divider and/or the scale.
 
Changed:
<
<
PWM port pins: D5 (TIM3CH2), D6 (TIM3CH1), D9 (TIM4CH3), D10 (TIM4CH4), D14 (TIM4CH2), and D15 (TIM4CH1).
>
>
PWM port pins: D3 (TIM1CH2), D4 (TIM1CH1), D5 (TIM1CH3), D6 (TIM1CH4), D9 (TIM4CH2), D10 (TIM4CH1).
 
Changed:
<
<
Simple test program to set brightness of a LED on pin D6 with a potentiometer on A0. Default PWM frequency is 1 kHz (prescaler set to 42). You can set the prescale with the word pwmprescale from 42 kHz (value 1) down to 0.5 Hz (64000).
>
>
Simple test program to set brightness of a LED on pin D6 with a potentiometer on A0. Default PWM frequency is 1 kHz (prescaler set to 60). You can set the prescale with the word pwmprescale from 60 kHz (value 1) down to 0.5 Hz (64000).
 
5 6 dmod   \ set D6 to PWM

Line: 265 to 265
  A servo pulse of 1.5 ms width will typically set the servo to its "neutral" position (typically half of the specified full range), a pulse of 1.0 ms will set it to 0°, and a pulse of 2.0 ms to 90° (for a 90° servo). The physical limits and timings of the servo hardware varies between brands and models, but a general servo's full angular motion will travel somewhere in the range of 90° – 180° and the neutral position (45° or 90°) is almost always at 1.5 ms. This is the "standard pulse servo mode" used by all hobby analog servos.
Changed:
<
<
The BSPs default PWM frequency is 1 kHz, 50 Hz is 20 times slower. The divider is therefore 42 * 20 = 840.
>
>
The BSPs default PWM frequency is 1 kHz, 50 Hz is 20 times slower. The divider is therefore 60 * 20 = 1200.
 
1 ms 50
45° 1.5 ms 75
90° 2 ms 100
Line: 280 to 280
 


Changed:
<
<
840 pwmprescale
>
>
1200 pwmprescale
 5 5 dmod \ set D5 to PWM

: servo ( -- )

Line: 389 to 389
 

Using EXTI line

Changed:
<
<
D11, D12, and D13 can be used as an EXTI line. EXTIs are external interrupt lines, D13 uses EXTI1 (EXTI Line1 interrupt), D12 EXIT2, and D11 EXTI3.
>
>
D0, D11, and D12 can be used as an EXTI line. EXTIs are external interrupt lines, D0 uses EXTI7 (EXTI Line7 interrupt), D11 EXIT5, and D12 EXTI6.
 
: exti-test ( -- )

 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback