|
What happens if you press the ALT key?
i.e. see (for instance) this page [^].
Also wonderful things would happen if I press the browser refresh button...
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
I would like to thank the group for their responses in this matter. Some how, it is now working. I do not understand why?
Bob
|
|
|
|
|
so I have a data stream I'm getting through on a GPIB that was supposed to be passed through using labview, we've since determined that this isn't possible so we need to do it via C since that is what the hardware likes. the problem is that I don't know how to take the data stream I'm getting in and simply just have it output to the serial port and most of my searches haven't yielded answers.
thank you
|
|
|
|
|
Michael Lutkenhouse wrote: GPIB
is it IEC-488 you are talking about?
I used to use it a lot some 30 years ago, that is before PC's got invented...
out of curiosity what are the make and model of the interface card? does the vendor provide a driver? do you have the documentation?
what is your data rate? how will you handle data flow when outputting to RS232C?
IEC488 could deliver up to a few megabits/second, something RS232C could not sink...
How big is your stream?
|
|
|
|
|
IEEE-488 is the standard, I'm using the National Instruments GPIB to USB adapter, found here...
http://sine.ni.com/nips/cds/view/p/lang/en/nid/201586[^]
data rate is 9600 baud, not quite sure with the outputting question, the data stream is just angular data , so it should just be ~12 digits.
|
|
|
|
|
OK, that looks like a modern device (not cheap though) and it comes with a driver, so it should be rather easy to create an app that interacts with your 488 device.
I suggest you first get it to work without any serial port, just make sure you send the right commands and start getting measurement data (which you could show in a listbox or something similar). Receiving the data correct all the time is the only tricky part, since you are probably not in control as to when and how fast data arrives.
Only when that works to perfection, start adding code to send these data through the serial port; transmitting is easy as long as you can assume the target device can cope.
|
|
|
|
|
I have a sample program already compiled from the company that makes the device I'm trying to talk to which works fine, and using NI spy along with the manual I know the commands to get the data stream coming, I just don't know how to then pass it through to the serial, is there a way to just do a simple re-direct, do I need to write to a temp file, I'm just not familiar with the concept of passing a stream through since ideally it'd never be written to a file other then in memory possibly.
thank you for the help too
|
|
|
|
|
AFAIK you can't just pass a stream of data, you have to receive it, possibly in chuncks, and then transmit it, possibly in chunks; and of course when chunked you can achieve concurrency, in the end it may look as if the stream is passing through.
So you must really have the PC read the data correctly, so you later will be able to transmit it (with WriteFile if you use C++/MFC). As I said earlier reading is the tricky part.
|
|
|
|
|
The ever classic Flounder has a page on serial I/O I suggest you read.
http://www.flounder.com/serial.htm[^]
The clever parts are largely to do with serial reading, but I've used the same techniques to read from USB ADC devices in the past. As has been said in other replies, once your happy you're reading chunks at a time into a RAM buffer, spitting them out on the serial port is the easy part.
The niggles I can see:
Setting up the COM port. Then DCB structure has always been a black art. But I recently came across BuildCommDCB which looks like a handy utility function.
Buffer size for reading from the USB/GPIB device. If you can read in larger chunks, then the PC load will be lighter. But you risk getting a partial chunk, waiting an age, then getting enough data to fill up the rest of the buffer. Depending on how the NI device driver presents itself, you may be able to ask for a large buffer with a small timeout which will help. I do that with FTDI's USB devices. And they seem to popup in all sorts of places.
Iain.
Codeproject MVP for C++, I can't believe it's for my lounge posts...
|
|
|
|
|
Hello everyone, I'm relatively new to writing code in C++ and I've been running into a problem. You see, I got a chunk of code off the internet for use in my program and it includes:
using namespace System
But the compiler doesn't like it. From what I can tell it isn't declared in the body of the code and it sounds rather like a predefined namespace. Is there something I need to include to fix this or what? Thanks in advace
|
|
|
|
|
That sounds rather like C++/CLI, i.e. C++ using .NET.
To get that working, you'll want to pass the /clr flag to the C++ compiler - and probably point questions at the C++/CLI forum, as they'll have more of a clue with C++/CLI.
|
|
|
|
|
I am thinking that the statement you want is:
using namespace std;
The namespace std is predefined in C++. The statement:
using namespace System;
should work if you have already defined the name space called System. Have you done so? I hope this helps, if not feel free to ask a follow up question.
Bob
|
|
|
|
|
linkfitz wrote: But the compiler doesn't like it.
Exactly what error message you got while compiling?
Make sure the following,
1) System namespace is applicable only for Managed C++.
2) Did you forget to put a semi-column? Apparently its missing from the code snippet that you've provided.
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
How would I go about making it Managed? (I'm sorry but I'm really bad with that kind of stuff.) And yes, I have a semi-colon, Ha-ha.
|
|
|
|
|
I hope you are using Visual Studio with CLR support. You can create a managed C++ project by File -> New Project > CLR -> <lot of="" managed="" templates=""> I referred Visual Studio 2008 and the sequence can vary depends on the version you are using.
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
Good Morning All
I am currently working on a project involving an ultrasound machine.
The ultrasound machine puts out audio and a PC is supposed to receive it through the line in port. I was wondering if any of you kind users could point me in the right direction to receive this data with C++.
I have of course done some searching but the words "line" and "c++" are causing my search results to be horribly inaccurate.
Thank you in advance
Shane
|
|
|
|
|
Maybe try looking into using DirectShow, at the first look it might seem complicated but if you get to know it's not that hard. True, i didn't use it for capturing audio yet though.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
|
|
|
|
|
DirectSound has audio capture capabilities[^]. That page also mentions waveInOpen[^], which looks like it does audio capture.
The main trick then is identifying how to specify the line-in port!
|
|
|
|
|
Hello,
I've got a few projects I'm attempting to cleanup. They are all in VSS and in the parent directory for a few projects reside a file with the '.vssscc' extension.
Should they be removed? I thought they were a local repository for what files have been added to VSS. Doing some reading I understand that the information contained in the files is supposed to represent which files to exclude from the project's source tree in VSS.
Upon inspection in find:
""<br />
{<br />
"FILE_VERSION" = "9237"<br />
"ENLISTMENT_CHOICE" = "NEVER"<br />
"PROJECT_FILE_RELATIVE_PATH" = ""<br />
"NUMBER_OF_EXCLUDED_FILES" = "0"<br />
"ORIGINAL_PROJECT_FILE_PATH" = ""<br />
"NUMBER_OF_NESTED_PROJECTS" = "0"<br />
"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROJECT"<br />
}<br />
which seems to contradict file exclusion.
Is it safe to remove these files from source control?
|
|
|
|
|
Hi~I am working a window form , with a picture box,label and numericUpDown
the picture box's image is like a compass ,when I change the value in numericUpDown->value, it is from 180 to -180, left is +ve and right side is -ve.
The label will show the corresponding value like north,N30E....
but when I work in the from 90 to 180,
what I decide is an eqatuion like numericUpDown->value - 2*n,where n is from 1 to 89.
There is no problem when I increase it from 91 to 179,it will shw the correct value from N89E to N1E, but when from 179 to 91,there will be problem. Moreover, if the numericUpDown->value is just change up and down, bb will also accumulate..so the value display in the label will be wrong...I really don't know how to write...
if(numericUpDown2->Value > 90 && numericUpDown2->Value < 180)
{ //a= numericUpDown2->Value;
cc = Convert::ToDouble(numericUpDown2->Value);
cc=cc-(2*bb);
aa=Convert::ToString(cc);
if(bb<89)
{bb=bb+1;}
else
{bb=1;}
label12->Text="N"+aa+"E";
}
|
|
|
|
|
OK, I am very confused by this. You seem to have 3 things going on, and I'm not sure where the problem actually is. It doesn't help that your code is looking very un-MCF/C++ like. Maybe you should be in the Managed C++/CLI forum?
1/ You have an Up-Down control (which I think of as a spinner, but you're actually correct). I'm confused what you're setting the range to. I think it's from -180 to +180
2/ You handle either the WM_NOTIFY/UDN_DELTAPOS or WM_HSCROLL/WM_VSCROLL messages sent from the up/down control. Do you get the correct values?
3/ Then you have to translate the -180 to +180 bearing value into a nice text representation. You can probably be hyper clever, but I'd suggest you do something like:
if (bearing >= 0 && bearing <= 45)
{
} else if (bearing >= 45 && bearing <= 90)
...
As I suspect you're posting in the wrong forum, I'll stop now. But the idea is to just break your problem down into ever smaller bits, and see where you fail.
Iain.
Codeproject MVP for C++, I can't believe it's for my lounge posts...
|
|
|
|
|
Hi,
I need to display ~ 100000 entries in a windows list which are stored in an SQL database (queried by a SELECT query with a few JOINs).
1st question: In only need to display a simple list. I would really like to use a Listbox Control for the sake of simplicity. Do I really need to choose a (complex) List Control?
2nd question: I tried a virtual list with a simple SQL query:
OnInitDialog()
...
m_ctrlWords.SetItemCountEx(count);
....
OnLvnGetdispinfoWords(...)
...
sql.Format("SELECT keywordID, keyword FROM keywords ORDER BY keyword LIMIT %d, 1", index);
const char *res = query.getStringField("keyword");
lstrcpy(pItem->pszText, res);
but this is really too slow.
I think I need OnLvnOdcachehintWords but it's somehow complicated. I could not find any concepts (which data structure to choose??) or examples concerning this
The problem is that I have to remove old entried in cache (or my app's memory consumption would explode).
Does anyone have implemented such a virtual list (with data in SQL) already?
Are there some examples or concepts available?
Thank you very much,
Niki
|
|
|
|
|
You'll probably be better off executing something like "SELECT keywordID, keyword FROM keywords ORDER BY keyword" within OnInitDialog and caching the results in a resultset or whatever equivalent your database interface technology offers. Then you can interrogate the cache within OnLvnGetdispinfoWords and don't need to bother with OnLvnOdcachehintWords .
|
|
|
|
|
Hello,
I have to correct: The entries are much more than 100000...it's a fulltext recherche of a huge database system.
So it's definitifely too large to just read out all entries and cache them.
Regards,
Niki
|
|
|
|
|
I have tried it using caching and virtual list controls. Even if I read only the elements from LVN_ODCACHEHINT and cache them into a map, the list is really, really tooo slow.
What could be the solution? I just want to have the same as WinHelp32's keyword (or topic) search. For some reason, this list is very very fast since over 10 years (with slow computers).
Regards,
Niki
|
|
|
|