|
I'm also using a baudrate of 115200, thought that might help a bit cause I have heard and read people have problems with higher baudrates.
|
|
|
|
|
Well yes and no. Serial anything, especially low level serial port, can be problematic, but data corruption is highly unusual. I can only tell you what I would do. I would write a small test program (or use the current program - easier) that creates/opens a file during start up and then add code that writes to it every time you receive any data at the lowest level. If there is corruption at that level then you have a major problem, which only the current programmer (you) can solve, usually by writing your own version of that unknown piece of code. If there is no corruption at that level (normal), then you need to start working you way up, adding new code to write to the file, until you see corruption. At that point you can limit the file writing code to what shows good data and bad data. Keep adding file writing code until you have the offending code in sight and then add file writing code to each line of the offending function (if you do not see the problem).
I suspect that you know all that already, but it is the best I can do without the code.
P.S. Remember to delete the temporary file after you have found the problem and post the results (to the author of CSerial or what ever).
INTP
"Program testing can be used to show the presence of bugs, but never to show their absence."Edsger Dijkstra
|
|
|
|
|
do{
SerialLib.Read(recvbuf, 5, &BytesRead);
if(BytesRead == 0)
return 0;
for(i=0; i<int(BytesRead); i++)
storebuf[i] = recvbuf[i];
TotalBytes = int(BytesRead);
while(TotalBytes <5){
BytesNeeded = 5 - BytesRead;
SerialLib.Read(recvbuf, BytesNeeded, &BytesRead);
for(i=TotalBytes; i<int(TotalBytes+BytesRead); i++)
storebuf[i] = recvbuf[i];
TotalBytes += int(BytesRead);
}
recievedbytepackage.byte0 = storebuf[0];
recievedbytepackage.byte1 = storebuf[1];
recievedbytepackage.byte2 = storebuf[2];
recievedbytepackage.byte3 = storebuf[3];
recievedbytepackage.byte4 = storebuf[4];
TotalBytes = 0;
}
while(BytesRead > 0);
This is the code that I'm using to read the data, and the problem is being caused in here as we have another program written in TCL that recieves that date from the controller just fine so we know it's not a hardware issue.
Any help would be great thanks.
|
|
|
|
|
Hi all,
I have CListBox with selection set to Extended in resource editor.
In my prog I need to set selection to single.
Please point me, how can I do this?
|
|
|
|
|
Remove the LBS_MULTIPLESEL style.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
* waiting for the other shoe *
|
|
|
|
|
This one doesn't work
m_listFiles.ModifyStyle( 0, LBS_EXTENDEDSEL | LBS_MULTIPLESEL );
|
|
|
|
|
Romiks wrote: This one doesn't work
How are you verifying this? After this runs, you should be able to use Spy++ to see the list of styles that particular control has. You should see LBS_EXTENDEDSEL and LBS_MULTIPLESEL in that list. Of course if you want the control to be single-select, I doubt that adding the LBS_MULTIPLESEL style will work.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Ok, I did single select ListBox and trying to add styles like this:
m_listFiles.ModifyStyle( 0, LBS_EXTENDEDSEL | LBS_MULTIPLESEL );<br />
m_listFiles.UpdateWindow();
SPY shows me LBS_EXTENDEDSEL and LBS_MULTIPLESEL styles present, but actually the list is single select
|
|
|
|
|
Then you may have found a style that cannot be altered at run-time. There are several.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
What about not using ModifyStyle?
I mean get the style, style = style | ~NonDesiredMode and SetStyle (style) another time... can it work?
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
|
|
|
|
|
Nelek wrote: can it work?
Why not try it and see?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
You are quite right, thanks
I'll try to find another way.
|
|
|
|
|
Can anybody tell me with VC++ 6.0 which latest version of MFC we use and release
date of MFC 4.0???
ThankXXX
There Is Nothing Right & Wrong
|
|
|
|
|
|
Fish see here.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
NOOOOO! Now we have three (you, me and Mark), is that enough to start a club?
Oh frack I guess I should have googled that[^]!
|
|
|
|
|
Hi -
I have a problem that's been bothering me for quite a while. I really hope that someone can help me...
I'm writing my code in visual C++, which seems to have very poor documentation for the datagrid. I've seen some C# code to do this, but it can't really be transferred to C++, it seems.
I have a DataGrid with 2 checkbox columns. I also have a button called "update". The goal is the following:
1) When the user clicks the update button, the application scans through the datagrid and determines which checkboxes are currently checked (for both columns)
2) This information is then used for something else, which is not relavant here.
Thanks in advance.
Kim
|
|
|
|
|
|
please help me i want read some of hardware serial ?
hamed
|
|
|
|
|
Have you considered the Win32_MotherboardDevice and Win32_DiskDrive WMI classes?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hello,
Is there any posibility in MFC/WinAPI to bring a parent dialog window for a modeless dialog on top of the modeless dialog ?
I've tried BringWindowToTop and SetWindowPos but the results are limited on activating the parent dialog only and not bringing it on top of the modeless one.
(I want to know if it is possible or not exactly the way that I specified. I know that it is possible if on the Create call for the modeless dialog I specify another window as parent and not the calling dialog.)
Many thanks in advance for any replies
|
|
|
|
|
to make the nextBuf and workBuf in the following code multi-thread save,
is it correct to replace "static" with "__declspec(thread)" in the code?
or it should be "__declspec(thread) static" ?
THANKS FOR THE HELP!
------
static int nextBuf ;
static char workBuf[8][64] ;
char * GetBuf()
{
nextBuf++ ;
if( nextBuf >= 8 ) nextBuf = 0 ;
return workBuf[nextBuf] ;
}
|
|
|
|
|
chenggong wrote: multi-thread save
I guess you meant "safe"? You did not specify your problem. So deducing your intent from your code it seems you are trying to share the workbuf[] array across threads? If so, you need to synchronize access to the GetBuf() function, not put the array into TLS as _declspec(thread) would do. Not to mention putting the array but not the indexer into TLS would certainly produce undesired behavior.
Also your design is, well less than [whatever]. Have you ever heard of the Singleton Design Pattern? Any Design Patterns?
Are you sure you should be writing multi-threading code?
|
|
|
|
|
The static just says that the variables are local to the module (.cpp file).
That is, they are not going to be directly used (by name) in any other module.
Both will work, but since you have already marked them as static i would keep that.
Also, you should init your global vars, even though in this case it still works without doing so.
Also, since the variables are (should be) only used in the function you may want to put them there.
i.e.
char* gb( void ) {
__declspec(thread) static int i = 0;
__declspec(thread) static char b[8][64];
if( i >= 8 ) i = 0;
return( b[i++] );
}
...cmk
Save the whales - collect the whole set
|
|
|
|