Home
Narrow screen resolution Wide screen resolution default color green color orange color
FDCS Card 1000 Data Control System - Software Programming base Print E-mail
Written by Administrator   
Monday, 18 February 2008

ImageCiftronik 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
adr01.jpg (28848 bytes)

 

 

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

 

oversrvr.jpg (13,817 bytes)

 

 

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 access
    NULL, // no security
    OPEN_EXISTING,
    0, // no overlapped I/O
    NULL); // 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.

m_bPortReady = GetCommState(m_hCom, &m_dcb);
m_dcb.BaudRate = 9600;
m_dcb.ByteSize = 8;
m_dcb.Parity = NOPARITY;
m_dcb.StopBits = ONESTOPBIT;
m_dcb.fAbortOnError = TRUE;
 
m_bPortReady = SetCommState(m_hCom, &m_dcb);

Communication timeouts are optional but can be set similarly to DCB values:

m_bPortReady = GetCommTimeouts (m_hCom, &m_CommTimeouts);
 
m_CommTimeouts.ReadIntervalTimeout = 50;
m_CommTimeouts.ReadTotalTimeoutConstant = 50;
m_CommTimeouts.ReadTotalTimeoutMultiplier = 10;
m_CommTimeouts.WriteTotalTimeoutConstant = 50;
m_CommTimeouts.WriteTotalTimeoutMultiplier = 10;
 
m_bPortReady = SetCommTimeouts (m_hCom, &m_CommTimeouts);

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;

bWriteRC = WriteFile(m_hCom, "RE\r",3,&iBytesWritten,NULL);

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.

bReadRC = ReadFile(m_hCom, &sBuffer, 6, &iBytesRead, NULL);

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

Comments
Add New Search RSS
gfefr   |122.6.9.xxx |2010-03-03 02:49:14
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?
Write comment
Name:
Email:
 
Website:
Title:
UBBCode:
[b] [i] [u] [url] [quote] [code] [img] 
 
 
:angry::0:confused::cheer:B):evil::silly::dry::lol::kiss::D:pinch:
:(:shock::X:side::):P:unsure::woohoo::huh::whistle:;):s
:!::?::idea::arrow:
 
Please input the anti-spam code that you can read in the image.

3.26 Copyright (C) 2008 Compojoom.com / Copyright (C) 2007 Alain Georgette / Copyright (C) 2006 Frantisek Hliva. All rights reserved."


Share & Save
Last Updated ( Saturday, 08 August 2009 )
 

My Information

Investasi emas dengan harga 1/3 harga emas...mau tahu caranya??? Daftar
di sini!
FORMULA BISNIS ala Joko Susilo...Terbukti! Buktikan sendiri
di sini!

My Webs

My Business

Adsense Indonesia

Join Vinefire!

My Language

My Tools

Yahoo bot last visit powered by MyPagerank.Net

Msn bot last visit powered by MyPagerank.Net

My Chat

My ShoutBox

Free chat widget @ ShoutMix Locations of visitors to this page

My Syndicate

Who's Online

We have 14 guests online

Visitors



Countries

42%Indonesia Indonesia
18%United States United States
5.4%China China
4.5%Australia Australia
3.8%India India

Visitors

Today: 1
Yesterday: 1
This Week: 8
Last Week: 26
This Month: 34
Last Month: 90
Total: 805


JoomlaWatch Stats 1.2.9 by Matej Koval

User