04-27-2012 11:04 PM
hello everyone, i am trying to find out checksum for my serial communication using NI VISA. I am sending 1 byte data, 1 byte checksum of that data over UART communications... i would liek to save just the data to a file w/o the
checksum,
the algo i would like to use is
can anyone suggest me logic/snapshot of how to achieve this?
Thanks,
04-28-2012 02:45 AM
04-28-2012 09:24 AM
hello GerdW, currently I am using the serial port property "Read Bytes at Port", and that way I am reading the entire bytes how many ever occurs at the serial port... so are you suggesting instead of using this property, have a constant (i.e. 2 number of bytes to read ) from NI Visa Read? that will probably
make the whole communication very slow...
04-28-2012 10:02 AM
04-28-2012 11:11 AM
Dennis_Knutson, no, what i meant was to analyze 1 byte at time of all the in-coming stream of data... sorry for the confusion... for example, if the incoming stream is
0xAA 0xBB 0xCC 0xDD 0xEE 0xFF 0x11 and so on... my labview code should be such that it should understand that 0xAA is data byte and 0xBB is checksum byte and it shud just sav 0xAA to a file... i hope this clarifies
04-28-2012 11:58 AM
04-28-2012 12:42 PM
Dennis_Knutson,
yes, the whole point is to sync, actually, i am having issues with bytes being lost, i am having a baud rate of 921600, hence, i wanted to add some kind of error check, just to make sure no bytes are being lost...
what you just described below is what i intend to achieve, can you please post a snippet/code to help me understand? it would be really greatful if u can do that...
thanks,
04-28-2012 01:10 PM
04-28-2012 02:18 PM
helo, i dnt have the optino of hardware handshaking.. i am not using that... i think i will have to double the number of bytes if i want to send 1 byte cheksum for every byte... thanks for your inputs
04-28-2012 06:32 PM
hello, i think i have implemented what i wanted ... however, 1 last issue... i am observing that labview is reading the data twice of the serial port... for example..
the actual data is :
0x120x280x04; however, labview is reading 0x12 0x12 0x28 0x28 0x04 0x04.... i think that labviw clock is way faster than my uC clock, and before uC is sendin new data, labview is reading watever is in its internal buffer.. no matter if it is updated by uC or not...