Re: How to send bits of data through RS232
- From: "Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam DOT com>
- Date: Tue, 15 Apr 2008 09:24:49 -0700
There is a version of MFC shipped with the device SDK for the device you are
targeting? If so, yes, you can target that version of MFC with your code.
If not, no, you really can't; it's up to the SDK.
I can throw together some pseudocode to do this serial I/O without even
consulting the help. Any Win32 serial I/O program from the desktop should
give you a reasonable example, too.
h = CreateFile( <port name>, ... ); // Note that you must include the
colon in COM1:, etc.
GetCommState( h, &dcb );
// Modify the comm state to fit how you want to communicate: baud, data
bits, parity, etc.
SetCommState( h, &dcb );
SetCommTimeouts( h, &to );
// Now we're going to write the byte.
BYTE b = 0x83;
DWORD bytesWritten = 0;
WriteFile( h, &b, 1, &bytesWritten, NULL ); // Note that overlapped is
not
//
supported in CE.
There you go. One byte sent.
Paul T.
"garlic" <garlic@xxxxxxxxxxxx> wrote in message
news:439AD6A6-6B68-4E8D-B901-11C9A9605256@xxxxxxxxxxxxxxxx
MFC object/class can be used in evc++ also right?
why avoid like a plague?
can you write a simple sample program on how to send ascii 0x83 to another
external device?
Do you have a good link for me to climb the learning curve
"Chris Tacke, eMVP" wrote:
I have no idea what CSerial is - looks suspiciously like MFC, which I
avoid
like the plague.
USB is not like serial communication. You don't just open up a port and
start writing (unless it's a USB to serial converter of course). For USB
you typically have a driver, and that driver dictates how you "talk" to
the
connected device.
--
Chris Tacke, Embedded MVP
OpenNETCF Consulting
Giving back to the embedded community
http://community.OpenNETCF.com
"garlic" <garlic@xxxxxxxxxxxx> wrote in message
news:AA24B32C-AA21-4E98-A961-EAF74826A950@xxxxxxxxxxxxxxxx
will the below code do the work?
What is the class for USB comunication, any good links, you can
recommend?
'''''''''''''''''''''''''
void function (void)
{
CSerial Serial;
if (Serial.Open(2,9600))
{
static char *szMessage[]= " 0x42";
int nBytesSent;
nBytesSent = Serial.SendData(szMessage, strlen(szMessage));
}
}
"Chris Tacke, eMVP" wrote:
It's no different than the desktop. Open the serial port with a call
to
CreateFIle, then send and receive data with ReadFile/WriteFile
--
Chris Tacke, Embedded MVP
OpenNETCF Consulting
Giving back to the embedded community
http://community.OpenNETCF.com
"garlic" <garlic@xxxxxxxxxxxx> wrote in message
news:0329F786-8845-4F3A-8234-783DF99B9FB9@xxxxxxxxxxxxxxxx
I am now writing application using evc++ 4.0.
I would like to enquire if there is any video or help that you have
documented or sites that you know that can help?
I have managed to create a GUI on my MDT (Mobile Data Terminal)
I need to set up MSMQ and serial, USB communication using my MDT
device
to
speak with other device (Taximeter)
alvin
.
- References:
- How to send bits of data through RS232
- From: garlic
- Re: How to send bits of data through RS232
- From: Chris Tacke, eMVP
- Re: How to send bits of data through RS232
- From: garlic
- Re: How to send bits of data through RS232
- From: Chris Tacke, eMVP
- Re: How to send bits of data through RS232
- From: garlic
- How to send bits of data through RS232
- Prev by Date: Re: How to send bits of data through RS232
- Next by Date: Re: Help with CE.Net and Bluetooth/socket communication
- Previous by thread: Re: How to send bits of data through RS232
- Next by thread: Re: How to send bits of data through RS232
- Index(es):