dac2ch Library  v0.50
Send D/A signals that can be converted to voltage outputs through low pass filters. 2 Channels per cog. multiple cogs can be used for more channels.
Data Structures | Typedefs | Functions
dac2ch.h File Reference

Functions for up to 2 channels per cog of duty modulated signals for D/A conversion through a low pass filter. More than one cog may be launched, so for example, if 5 signals are desired, use 3 cogs for up to 6 channels. More...

#include "simpletools.h"

Go to the source code of this file.

Data Structures

struct  dac2ch_st
 

Typedefs

typedef struct dac2ch_st dac2ch_t
 
typedef dac2ch_t dac2ch
 

Functions

dac2chdac2ch_start (int bits)
 Start duty modulation process in another cog for D/A conversion through a low pass filter. More...
 
void dac2ch_set (dac2ch *device, int pin, int channel, int dacVal)
 Set a DAC signal's level. More...
 
void dac2ch_stop (dac2ch *device)
 Shut down dac2ch process and reclaim cog and I/O pins for other uses. More...
 

Detailed Description

Functions for up to 2 channels per cog of duty modulated signals for D/A conversion through a low pass filter. More than one cog may be launched, so for example, if 5 signals are desired, use 3 cogs for up to 6 channels.

Author
Andy Lindsay
Version
0.5
Help Improve this Library
Please submit bug reports, suggestions, and improvements to this code to edito.nosp@m.r@pa.nosp@m.ralla.nosp@m.x.co.nosp@m.m.

Function Documentation

◆ dac2ch_set()

void dac2ch_set ( dac2ch device,
int  pin,
int  channel,
int  dacVal 
)

Set a DAC signal's level.

Parameters
*deviceThe dac2ch pointer/process ID returned by dac2ch_start.
pinThe pin to send the duty modulated DAC signal.
channel0 or 1.
dacValFor D/A, use 0 to (2^bits) - 1. For example, for 9 bits, that would be 0 to 511. To shut down a channel and set the I/O pin to input, use -1.

◆ dac2ch_start()

dac2ch* dac2ch_start ( int  bits)

Start duty modulation process in another cog for D/A conversion through a low pass filter.

Parameters
bitsNumber of bits for the D/A converter. The number of voltage settings will be 2^bits. For example, setting bits to 8 gives 2^8 = 256 voltage settings, from 0 -> 0 V to 255 -> 3.287 V on a 3.3 V scale.
Returns
*device A pointer that should be stored in a dac2ch *variable and used as a process ID in other dac2ch_... function calls.

◆ dac2ch_stop()

void dac2ch_stop ( dac2ch device)

Shut down dac2ch process and reclaim cog and I/O pins for other uses.

Parameters
*deviceThe dac2ch pointer/process ID returned by dac2ch_start.