Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Library : Other (not classified elsewhere) » Serial.cpp for 64bit
Serial.cpp for 64bit [message #36978] Fri, 03 August 2012 14:53 Go to next message
nlneilson is currently offline  nlneilson
Messages: 644
Registered: January 2010
Location: U.S. California. Mojave &...
Contributor
I have been using the serial.h and .cpp that was referenced in the forum which works good on 32bit but not 64bit.

Serial.cpp has
#ifdef PLATFORM_WIN32

Has someone used Serial files that work on 64bit in upp and preferably that the .exe will work on 32bit AND 64bit.

Re: Serial.cpp for 64bit [message #36996 is a reply to message #36978] Mon, 06 August 2012 08:40 Go to previous messageGo to next message
nlneilson is currently offline  nlneilson
Messages: 644
Registered: January 2010
Location: U.S. California. Mojave &...
Contributor
An update on the problem after debugging with MSC9.

In my upp app there is hard coded on a known port:
CommPort.Open(11,57600);

In Serrial.cpp
bool SerialPort::Open( int nPort, int nBaud )
The nPort and nBaud both have bogus numbers like:
59380608 and 80019228

Building with MSC9x64 Optimal there are no errors but will not open ports.
MSC9x64 Debug will build but will not with Run (in debugger)
Re: Serial.cpp for 64bit [message #36997 is a reply to message #36996] Mon, 06 August 2012 10:49 Go to previous messageGo to next message
jerson is currently offline  jerson
Messages: 202
Registered: June 2010
Location: Bombay, India
Experienced Member

Hi Neil

I am not sure if I am able to help. I have used the serial files and made changes to suit my needs. See if this helps you. I am able to use these on WinXP and also Win7 64b edition. I am not sure if I need to compile these differently, but the normal tdm-mingw compile works for both platforms.

Attached my modbus serial files. Not ideal stuff as I am quite new to C++ and also U++. But, it works.

Regards
Jerson
Re: Serial.cpp for 64bit [message #36998 is a reply to message #36997] Mon, 06 August 2012 11:32 Go to previous messageGo to next message
nlneilson is currently offline  nlneilson
Messages: 644
Registered: January 2010
Location: U.S. California. Mojave &...
Contributor
Hi Jerson

Thanks as I will try it.

You were a big help on this thread also:
http://www.ultimatepp.org/forum/index.php?t=msg&goto=298 39&&srch=Jerson#msg_29839

I will post how ModbusComm.zip works.

[Updated on: Mon, 06 August 2012 11:33]

Report message to a moderator

Re: Serial.cpp for 64bit [message #37001 is a reply to message #36997] Tue, 07 August 2012 06:04 Go to previous messageGo to next message
nlneilson is currently offline  nlneilson
Messages: 644
Registered: January 2010
Location: U.S. California. Mojave &...
Contributor
Hi Jerson

I replaced the Serial.h and Serial.cpp in my app and tried it.
The data passed needs to be a string rather than int.
That is what was done in Python, Java and a previous C++ app.
I will make the changes to my app.

I fired up an older laptop and found a C++ project using the Eclipse C++.

Here is a .zip that includes the src and the SerialCom.h and .cpp.
It also has a compiled COMcheck1.exe which works on 32bit and 64bit. I am not sure if that was made with the same project.
Note that this is probably only for Windows.
http://www.nlneilson.com/apps/GPS4.zip

The serial code may be easier than the code you have and you may be able to get ideas from. I like to stay away from pointers.
But since your code works with Linux I will try that.

[Updated on: Tue, 07 August 2012 06:53]

Report message to a moderator

Re: Serial.cpp for 64bit [message #37113 is a reply to message #37001] Sat, 25 August 2012 13:31 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Would it be possible to add serial port handling to bazaar in some form?

Mirek

Re: Serial.cpp for 64bit [message #37115 is a reply to message #37113] Sat, 25 August 2012 16:42 Go to previous messageGo to next message
nlneilson is currently offline  nlneilson
Messages: 644
Registered: January 2010
Location: U.S. California. Mojave &...
Contributor
That would be great if it was incorporated in upp.

M$VC has good serial code, it may be tied in with their managed CL or whatever. Python has a good PySerial.

The code I am tinkering with works on WinXP but not Win7 32bit or 64bit. I am just getting a last error dwWord 6 which I have no idea what that is. A M$VC app just to check the ports works as well as the Sirfdemo, Python, ....

I am having the same problem with Jerson's code.

[Updated on: Wed, 29 August 2012 19:33]

Report message to a moderator

Re: Serial.cpp for 64bit [message #37137 is a reply to message #37115] Tue, 28 August 2012 21:51 Go to previous messageGo to next message
nlneilson is currently offline  nlneilson
Messages: 644
Registered: January 2010
Location: U.S. California. Mojave &...
Contributor
As previously mentioned:
http://www.nlneilson.com/apps/GPS4.zip

COMcheck1.exe dated 2008
This works on WinXP and Win7 32bit and 64bit.
It checks the ports that can be opened and then the baud rate.
It then parses the GPGGA NMEA sentence and prints it out.
Checking COM: 1 2 3 4 5 6 7 8 9 10 11    COM 11: opened
 12    COM 12: opened
 13 14 15 16 17 18 19 20

COM 11: check baud rate
  9600 ▬Imk▬x  19200 ♀↔???  38400 ???▲?♂  57600 $GPGGA->OK

COM 12: check baud rate
  4800 ?=▬???  9600 ▬I? ??  19200 ♀↔???  38400 ???▲?♂  57600 $GPGGA->OK

COM 11 at 57600
$GPGGA,223705.631,3412.7486,N,11911.6111,W,1,06,1.0,-24.5,M,-33.8,M,0.0,0000*5E
Lat 34.21248  Lon -119.19352  Alt 30ft      GPS fix,  # of Sat. 6

COM 12 at 57600
$GPGGA,223706.395,3412.7444,N,11911.6102,W,1,06,2.6,-14.3,M,-33.8,M,0.0,0000*5A
Lat 34.21241  Lon -119.19350  Alt 63ft      GPS fix,  # of Sat. 6

11.408 sec
N.L. Neilson (c)


It will check as many GPS receivers that are plugged in.

This may have been made with M$VC as the code in the GPS4 folder is from 2010 and doesn't seem to relate to the COMcheck1.exe

From the Serial.cpp from Jerson and nixnixnix this fails in Win7 but works OK with WinXP
	if( !SetCommState( m_hIDComDev, &dcb ) ||
		!SetupComm( m_hIDComDev, 10000, 10000 ) ||


If someone works on a project for bazaar I would be glad to help with parsing or whatever.

edit: fixed link for GPS4.zip

[Updated on: Wed, 29 August 2012 19:36]

Report message to a moderator

Re: Serial.cpp for 64bit [message #37138 is a reply to message #37137] Tue, 28 August 2012 22:59 Go to previous messageGo to next message
nlneilson is currently offline  nlneilson
Messages: 644
Registered: January 2010
Location: U.S. California. Mojave &...
Contributor
I found the folder the COMcheck code is in. It also has COMcheck2 that fixed a few glitches in COMcheck1.
http://www.nlneilson.com/wwposts/COMcheck.zip

Windows has:
using namespace System::IO::Ports;

If upp had something similar or could access that it would help.


edit: I just built the app again with the above code on Win7 64bit with M$VC 10 with the /clr option. I would like to connect to serial port in U++.

[Updated on: Wed, 29 August 2012 19:40]

Report message to a moderator

Re: Serial.cpp for 64bit [message #37139 is a reply to message #37138] Tue, 28 August 2012 23:27 Go to previous messageGo to next message
nlneilson is currently offline  nlneilson
Messages: 644
Registered: January 2010
Location: U.S. California. Mojave &...
Contributor
http://www.ultimatepp.org/forum/index.php?t=msg&goto=298 39&&srch=Jerson#msg_29839

koldo wrote on Thu, 19 August 2010 23:23

jeremy_c wrote on Fri, 20 August 2010 01:30

Where can one find wxSerial? It seems to be hiding from me :-/

Jeremy

Hello Jeremy

wxSerial refers to wxWindows serial support. It cannot be used here.

I am not sure about the status of the serial support in U++. Now it seems to be:

- nixnixnix has included in Forum (in this post) a serial class for Linux and Windows
- jerson has done a class for Windows to be posted
- Mindtraveller has done a more complete class but is part of a closed source package


"wxSerial refers to wxWindows serial support. It cannot be used here."

It would be good to have serial support included in U++.
Re: Serial.cpp for 64bit [message #37151 is a reply to message #37139] Fri, 31 August 2012 06:27 Go to previous message
nlneilson is currently offline  nlneilson
Messages: 644
Registered: January 2010
Location: U.S. California. Mojave &...
Contributor
First step.

After time searching found this:
http://stackoverflow.com/questions/3783842/converting-a-stri ng-to-lpcwstr-for-createfile-to-address-a-serial-port

With that example this portion of the code works OK on Win7 64bit in U++.
	    std::wstring comID = L"\\\\.\\COM11";
	    HANDLE hSerial;
	    hSerial = CreateFileW(comID.c_str(),
		GENERIC_READ | GENERIC_WRITE,
                ...


using namespace System::IO::Ports; is not required

I don't know about c_str(), LPCWSTR, or value (pointer to const wchar_t). There may be an easier way if/when included in U++.



Previous Topic: DropList events
Next Topic: uppsrc/web directory
Goto Forum:
  


Current Time: Tue Apr 16 11:28:05 CEST 2024

Total time taken to generate the page: 0.01303 seconds