C/Ch program output.cpp sends
digital and analog
outputs to a K8055 USB board
/* File name: output.cpp.
This program shows how to write digital and analog
outputs to a K8055 USB board.
Created by Rudy Elyn, info@re-applications.be
*/
#include
#include
void Delay() {
// Make the changes visible
long lngDelay;
for(lngDelay = 0; lngDelay < 100000; lngDelay++) {
}
}
int main() {
int intCardAddress = 0; // USB card address
int intCount;
int intDigitalOut = 1; // Init First Output bit
int intAnalogValue;
long lngDelay;
OpenDevice(intCardAddress); //Open card
for(intCount = 0; intCount < 8; intCount++) {
Delay();
WriteAllDigital(intDigitalOut << intCount);
}
Delay();
intAnalogValue = ReadAnalogChannel(1);
printf("Analog Value Channel 1 = %d\n", intAnalogValue);
Delay();
OutputAnalogChannel(1, 30);
OutputAnalogChannel(2, 150);
Version();
ClearAllAnalog();
ClearAllDigital();
CloseDevice();
return 0;
}
|
|