|
Re: Usage of serial port on cRio
Quote:
Originally Posted by mikets
I don't have Wind River in front of me at the moment so I can't verify the com class especially the Read method, but my instinct tells me that you declare buffer as a "char *" which means there is no buffer associated with it. buffer is an uninitialized pointer. If the Read method is going to put bytes into buffer, it is going to trash random memory locations.
I could be wrong 
|
Nope, you are 100% correct. They have declared/reserved no storage. Change char *buffer to char buffer[X] where X is big enough to hold the data. It should work then but it is a bit of a kludge, you probably want a bigger buffer declared as a global or allocate the memory so it is not on the stack (as all local variables are).
HTH
__________________
Fast, cheap or working - pick any two!
Last edited by wireties : 08-02-2012 at 15:06.
|