PWM update
This commit is contained in:
parent
72c34b6ba4
commit
198feef12f
|
@ -3,12 +3,14 @@
|
||||||
#include <b15f/b15f.h>
|
#include <b15f/b15f.h>
|
||||||
#include <b15f/plottyfile.h>
|
#include <b15f/plottyfile.h>
|
||||||
|
|
||||||
const char PLOT_FILE[] = "plot.bin";
|
/*
|
||||||
|
* Erzeugt ein PWM Signal an PB4 mit 100KHz.
|
||||||
|
* Beste Frequenz: 31300
|
||||||
|
*/
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
|
|
||||||
B15F& drv = B15F::getInstance();
|
B15F& drv = B15F::getInstance();
|
||||||
std::cout << "TOP: " << (int) drv.pwmSetFrequency(100000) << std::endl;
|
std::cout << "TOP: " << (int) drv.pwmSetFrequency(31300) << std::endl;
|
||||||
drv.pwmSetValue(40);
|
drv.pwmSetValue(127);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,6 @@
|
||||||
#include <iostream>
|
|
||||||
#include <cmath>
|
|
||||||
#include <b15f/b15f.h>
|
#include <b15f/b15f.h>
|
||||||
#include <b15f/plottyfile.h>
|
#include <b15f/plottyfile.h>
|
||||||
|
|
||||||
const char PLOT_FILE[] = "plot.bin";
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Dieses Beispiel erzeugt einen 300ms langen Impuls an PB0.
|
* Dieses Beispiel erzeugt einen 300ms langen Impuls an PB0.
|
||||||
*
|
*
|
||||||
|
|
|
@ -202,6 +202,7 @@ public:
|
||||||
/**
|
/**
|
||||||
* Setzt die Register so, dass näherungsweise die gewünschte Frequenz erzeugt wird.
|
* Setzt die Register so, dass näherungsweise die gewünschte Frequenz erzeugt wird.
|
||||||
* Ist freq == 0 wird PWM deaktiviert.
|
* Ist freq == 0 wird PWM deaktiviert.
|
||||||
|
* Standardfrequenz: 31300 (empfohlen, da dann TOP == 255)
|
||||||
* \param freq PWM Frequenz
|
* \param freq PWM Frequenz
|
||||||
* \return Top Wert des PWM Value für die gesetzte Frequenz
|
* \return Top Wert des PWM Value für die gesetzte Frequenz
|
||||||
* \throws DriverException
|
* \throws DriverException
|
||||||
|
|
Loading…
Reference in a new issue