LTPS C++ API
Public Member Functions | List of all members
Pic Class Reference

Class for PWM/ADC PIC16F1824 tibbit control (Tibbit #16, Tibbit #17 and Tibbit #31) More...

#include <pic.h>

Public Member Functions

void initPic (const char *socket, PicFreq freq)
 PIC initialization (call before PIC first usage) More...
 
void configurePwm (const char *socket, int channel)
 Configure PIC as PWM (supported by Tibbit's #16, #17 and #31) More...
 
void configureAdc (const char *socket, int channel)
 Configure PIC as ADC (supported by Tibbit #31) More...
 
void startPwm (const char *socket, int channel, int pulse, int period, int prescaler)
 Start PWM (configurePwm must called before) More...
 
void stopPwm (const char *socket, int channel)
 Stop PWM (initPic or configurePwm must called before) More...
 
int getAdcVoltage (const char *socket, int channel)
 Get ADC voltage (0...4000 mV) (configureAdc must called before) More...
 

Detailed Description

Class for PWM/ADC PIC16F1824 tibbit control (Tibbit #16, Tibbit #17 and Tibbit #31)

Examples:
tibbit16.cpp, tibbit17.cpp, and tibbit31.cpp.

Member Function Documentation

void Pic::configureAdc ( const char *  socket,
int  channel 
)

Configure PIC as ADC (supported by Tibbit #31)

Parameters
socketI2C bus name (eg: s1, s15)
channel1, 2, 3 or 4
Examples:
tibbit31.cpp.
void Pic::configurePwm ( const char *  socket,
int  channel 
)

Configure PIC as PWM (supported by Tibbit's #16, #17 and #31)

Parameters
socketI2C bus name (eg: s1, s15)
channel1, 2 or 3
Examples:
tibbit16.cpp, tibbit17.cpp, and tibbit31.cpp.
int Pic::getAdcVoltage ( const char *  socket,
int  channel 
)

Get ADC voltage (0...4000 mV) (configureAdc must called before)

Parameters
socketI2C bus name (eg: s1, s15)
channelChannel number (1, 2, 3 or 4)
Returns
Voltage in mV
Examples:
tibbit31.cpp.
void Pic::initPic ( const char *  socket,
PicFreq  freq 
)

PIC initialization (call before PIC first usage)

Parameters
socketI2C bus name (eg: s1, s15)
freqFrequency of internal oscillator for PWM
Examples:
tibbit16.cpp, tibbit17.cpp, and tibbit31.cpp.
void Pic::startPwm ( const char *  socket,
int  channel,
int  pulse,
int  period,
int  prescaler 
)

Start PWM (configurePwm must called before)

Parameters
socketI2C bus name (eg: s1, s15)
channelChannel number (1, 2 or 3)
pulsePWM pulse width is defined as the base frequency clock count (0, 1, 2...1023)
periodPWM period is defined as the base frequency clock count (0, 4, 8...1023)
prescalerPrescaler affects the base frequency (the period is multiplied to the prescaler) (1, 4, 16 or 64)
Examples:
tibbit16.cpp, tibbit17.cpp, and tibbit31.cpp.
void Pic::stopPwm ( const char *  socket,
int  channel 
)

Stop PWM (initPic or configurePwm must called before)

Parameters
socketI2C bus name (eg: s1, s15)
channelChannel number (1, 2 or 3)
Examples:
tibbit16.cpp, tibbit17.cpp, and tibbit31.cpp.

The documentation for this class was generated from the following file: