FDCS Card 1000 Data Control System - Software Programming base
Written by Administrator
Monday, 18 February 2008
Ciftronik manufactures low-cost, high quality, serial data acquisition and control interfaces that allow data acquisition and computer control via a serial port (RS232 or USB ). {mosgoogle}
When connected to a serial port the FDCS boards allow control of analog (A/D and D/A), digital I/O, relay contacts and event counters using simple ASCII commands. Easy to interface to LED's, switches, potentiometers, analog sensors or stepper motors. Programming is easy using VB.NET, Visual Basic, Basic, LINUX, C, Visual C++ or any language that allows access to a serial port. {mosgoogle}
Serial Data Acquisition Made Easy
Example Visual Basic Program
Private Sub Start_Click()
Rem Ensure Relay K0 is off.
MSComm1.Output = "RK0" + Chr (13)
Rem Enable interrupts.
MSComm1.Output = "IE" + Chr (13)
Rem Wait for interrupt from switch.
Do
Dummy = DoEvents()
Loop Until MSComm.InBufferCount >= 3
Rem Display interrupt in text window. ( Empties input buffer )
Text1.Text = MSComm1.input
Rem Clear event counter
MSComm1.Output = "CE" + Chr (13)
Rem Load trigger register with 160 ( also enables counter interrupt )
MSComm1.Output = "TL160" + Chr (13)
Rem Wait for interrupt from event counter.
Do
Dummy = DoEvents()
Loop Until MSComm.InBufferCount >= 3
Rem Display interrupt in text window. ( Empties input buffer )
Text1.Text = MSComm1.input
Rem Energize relay K0 ( Turns on RED lamp.)
MSComm1.Output = "SK0" + Chr (13)
End Sub
Example Visual C++ Program
CONFIGURING THE SERIAL PORT
The first step in accessing the serial port is setting up a file handle.
// variables used with the com port
BOOL m_bPortReady;
HANDLE m_hCom;
CString m_sComPort;
DCB m_dcb;
COMMTIMEOUTS m_CommTimeouts;
BOOL bWriteRC;
BOOL bReadRC;
DWORD iBytesWritten;
DWORD iBytesRead;
char sBuffer[128];
m_sComPort = "Com1";
m_hCom = CreateFile(m_sComPort,
GENERIC_READ | GENERIC_WRITE,
0, // exclusive accessNULL, // no security
OPEN_EXISTING,
0, // no overlapped I/ONULL); // null template
Check the returned handle for INVALID_HANDLE_VALUE and then set the buffer sizes.
m_bPortReady = SetupComm(m_hCom, 128, 128); // set buffer sizes
Port settings are specified in a Data Communication Block (DCB). The easiest way to initialize a DCB is to call GetCommState to fill in its default values, override the values that you want to change and then call SetCommState to set the values.
If all of these API's were successful then the port is ready for use.
SENDING COMMANDS TO THE FDCS1000
To send commands to the FDCS1000 the WriteFile call is used. For example, the following call sends an RE ( read event counter ) command to the FDCS1000;
The \r escape embeds a carriage return character at the end of the transmitted string. The FDCS1000 uses this to recognize a command.
RECEIVING DATA FROM THE FDCS1000
If a command sent to the FDCS1000 is a responsive command, that is, one that results in data being sent back to the host, the data is retrieved using the ReadFile call.
When you are through using the file handle simply close the file.
CloseHandle(m_hCom);
I hope that this assists you in your programming efforts.
If you want to FDCS-1000 board, you can order and contact me at :
This e-mail address is being protected from spam bots, you need JavaScript enabled to view it
wow...High Heels,women's good friends,we can not live without,as it can make us look more tall and charming.Now Christian shoes is more and more popular.I believe you must have ever heard of Christian shoes,right?