Skip to content

Strange behavior of FDwfDigitalOutDividerSet() #21

@micheledellaciana1

Description

@micheledellaciana1

Hi,
I'm not understanding how it works FDwfDigitalOutDividerSet(). From the C doc I saw that It sets the divider of the internal clock for the counter. Here it sets the frequency in Hz of the counter?
If it's so, it works properly only is you set as frequency the maximum frequency (i.e. 1e8 Hz). With lower frequency, It behaves differently.

For example, if you put the frequency of the counter to 10 kHz, and low and high counter to 5 and 5, I expect to see a square wave with a period of 1 ms, (0.1 * 5 + 0.1 *5 = 1), but I get a square wave of period 2ms.

    FDwfDigitalOutEnableSet(pin, true);
    FDwfDigitalOutDividerSet(pin, (int) 1e4); // Frequency of counter
    FDwfDigitalOutCounterInitSet(pin, true, 0);
    FDwfDigitalOutCounterSet(pin, 5, 5);
    FDwfDigitalOutConfigure(true);

By the way, If I set the counter frequency to the max, everything works fine, but the sum of the values of the counters cannot exide unsigned int maximum (I think because c function has that limitation).

am I missing something about FDwfDigitalOutDividerSet() ?

Thk in advance,

Michele

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions