4 #include "../hubolib.h"
28 void CycleTickCallback (
unsigned long* pADChannelValues,
unsigned char* pDigitalInputValues,
unsigned char* pDigitalOutputValues);
29 void BreakingCycleTickCallback (
unsigned long* pADChannelValues,
unsigned char* pDigitalInputValues,
unsigned char* pDigitalOutputValues);
36 printf (
"Error: Initialize\n");
52 unsigned long adcCount;
54 for (
int i=0; i<10; i++)
57 printf (
"Main thread: Channel=%d ADC count=0x%02lX Volts=%lf\n\n", channel, adcCount, volt);
67 printf (
"Now breaking the cycle time.\n");
78 for (
int i=0; i<10; i++)
81 printf (
"Main thread: Channel=%d ADC count=0x%02lX Volts=%lf\n\n", channel, adcCount, volt);
121 void CycleTickCallback (
unsigned long* pADChannelValues,
unsigned char* pDigitalInputValues,
unsigned char* pDigitalOutputValues)
125 printf (
"CycleTickCallback called.\n");
126 if (pADChannelValues)
128 for (
int i=0; i<8; i++)
129 printf(
"0x%04lX ", pADChannelValues[i]);
133 if (pDigitalInputValues)
134 printf (
"Digital input 0x%02X\n", *pDigitalInputValues);
136 if (pDigitalOutputValues)
137 printf (
"Digital output 0x%02X\n", *pDigitalOutputValues);
142 void BreakingCycleTickCallback (
unsigned long* pADChannelValues,
unsigned char* pDigitalInputValues,
unsigned char* pDigitalOutputValues)
144 printf (
"BreakingCycleTickCallback called.\n");
155 printf (
"ChannelDelayCallback called\n");
156 printf (
"delay: count = %lld time[ms] = %lld\n\n", cycleCount, t_Overrun_ms);
#define MAX_MCP3x08_CHANNELS
bool Unregister_ChannelDelayCallback(T_pfn_ChannelDelayCallback pFnChannelDelayCallback)
Unregister a callback previouly registered by a call to Register_ChannelDelayCallback().
bool Initialize()
Initializes the library.
bool Set_Cycle_Time(long cycleTime)
Sets the backgrounds threads polling interval in ms.
void CycleTickCallback(unsigned long *pADChannelValues, unsigned char *pDigitalInputValues, unsigned char *pDigitalOutputValues)
void ChannelDelayCallback(__int64 cycleCount, __int64 t_Overrun_ms)
void BreakingCycleTickCallback(unsigned long *pADChannelValues, unsigned char *pDigitalInputValues, unsigned char *pDigitalOutputValues)
bool Unregister_CycleTickCallback(T_pfn_CycleTickCallback pFnCycleTickCallback)
Unregister a callback previouly registered by a call to Register_CycleTickCallback().
void Uninitialize()
Releases any resources bound to the library.
bool Register_ChannelDelayCallback(T_pfn_ChannelDelayCallback pFnChannelDelayCallback)
Register a callback to be called whenever the cycle time has been violated by more than one cycle tim...
bool Register_CycleTickCallback(T_pfn_CycleTickCallback pFnCycleTickCallback)
Registers a callback function called on every cycle tick.