NAME

k8055m_set_pwm_out, k80ffm_get_pwm_out -- Set/get the duty cycle of a pwm output port.

LIBRARY

k8055-pic18f access library

SYNOPSIS

#include "k8055m.h"

int
k8055m_set_pwm_out(int cardNumber, int port, int value);

int
k8055m_get_pwm_out(int cardNumber, int port);
    

DESCRIPTION

k8055m_set_pwm_out() sets the duty cycle of pwm output port port to value. ports are numbered 0 .. 1. The value is the theoretically possible 10 bit duty cycle in the range of 0 .. 1023. In the current firmware implementation, the duty cycle has only 9 bits resolution and the value is scaled down (divided by two) inside of the library.

The call only has an effect if the output port is currently configured to normal mode. The call is ignored otherwise.

If the card's auto-flush feature is turned off, then a call to k8055m_set_pwm_out() will not be sent to the card and the resulting changes will be accumulated until k8055m_flush() is called or the card's auto-flush feature is enabled.

The k8055-pic18f modified card retains its output port states while the USB is disconnected, as long as it keeps running on a powered USB hub or similar power supply. k8055m_open() actually queries the card for its current configuration and output port settings. k8055m_get_pwm_out() returns those initial or the latest requested duty cycle.

RETURN VALUES

k8055m_set_pwm_out() returns 0 on success, -1 on error. k8055m_get_pwm_out() returns the current duty cycle or -1 on error.