Click here to Skip to main content
16,006,348 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: PictureBox Pin
Guffa5-Aug-07 20:44
Guffa5-Aug-07 20:44 
QuestionCDROM Pin
VB.NET_learner5-Aug-07 6:44
VB.NET_learner5-Aug-07 6:44 
AnswerRe: CDROM Pin
saeed_rezaei5-Aug-07 10:14
saeed_rezaei5-Aug-07 10:14 
GeneralOpens Only first CD ROM Pin
MohammadAmiry6-Aug-07 6:19
MohammadAmiry6-Aug-07 6:19 
QuestionHow to process data from serial device Pin
Fu Manchu5-Aug-07 2:31
Fu Manchu5-Aug-07 2:31 
AnswerRe: How to process data from serial device Pin
Luc Pattyn5-Aug-07 2:38
sitebuilderLuc Pattyn5-Aug-07 2:38 
GeneralRe: How to process data from serial device Pin
Fu Manchu5-Aug-07 12:15
Fu Manchu5-Aug-07 12:15 
GeneralRe: How to process data from serial device Pin
Luc Pattyn5-Aug-07 13:04
sitebuilderLuc Pattyn5-Aug-07 13:04 
Hi,

thanks for the info. This seems to be a very nice device, it allows for very safe
data transmission. These are my ideas now, they relate to the SerialPort class, not
to your current code; I prefer the synchronous read mode, that is: some thread
does all the communication, both sending and receiving, in lock step, there is no
need to have asynchronous reads since you can be in charge of everything.

SYNCHRONOUS COMM MODE

1. clear the serial input buffer (with DiscardInBuffer)
2. send command to start the communication
3. wait some time (say 1 sec)
4. read available bytes, no more than 9 are required; if they are not present, reject all
(there is a Read that fills a byte buffer, I'll call it b)
5. send command to stop the communication

DATA PROCESSING

1. check that 9 bytes obey xycabCABz pattern; i.e. make sure bytes 5to7 are same as 2to4;
if not reject everything
we will use xyc or yca or cab (normally x=a, y=b, z=c but we dont need that)
2. begin loop three times, with i=0/1/2
3. check b(i+2)=b(i)+b(i+1), if so goto step 6
4. next loop iteration (this means if for some reason a strange byte got in, ignore it)
5. we failed to find a valid checksum, reject everything
6. we got valid data in bytes i,i+1,i+2

IMPLEMENTATION IDEAS

I would have:
- a byte array b holding 9 bytes (it can be reused over and over)
- a method doing the comm part, i.e. filling b
- a method doing postprocessing, returning the index i of the first useful byte,
or -1 to indicate rejection


Hope I explained it well.






Luc Pattyn [Forum Guidelines] [My Articles]


this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/AllLanguages/General
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google


GeneralRe: How to process data from serial device Pin
Fu Manchu5-Aug-07 23:25
Fu Manchu5-Aug-07 23:25 
QuestionDatagrid view to DataBase - Update Pin
NANCO5-Aug-07 2:17
NANCO5-Aug-07 2:17 
AnswerRe: Datagrid view to DataBase - Update Pin
Johan Hakkesteegt6-Aug-07 20:36
Johan Hakkesteegt6-Aug-07 20:36 
QuestionRe: Datagrid view to DataBase - Update Pin
Trupti Mehta7-Aug-07 19:25
Trupti Mehta7-Aug-07 19:25 
AnswerRe: Datagrid view to DataBase - Update Pin
Johan Hakkesteegt7-Aug-07 22:51
Johan Hakkesteegt7-Aug-07 22:51 
GeneralRe: Datagrid view to DataBase - Update Pin
Trupti Mehta8-Aug-07 0:33
Trupti Mehta8-Aug-07 0:33 
GeneralRe: Datagrid view to DataBase - Update Pin
Johan Hakkesteegt8-Aug-07 22:49
Johan Hakkesteegt8-Aug-07 22:49 
GeneralRe: Datagrid view to DataBase - Update Pin
Trupti Mehta9-Aug-07 1:02
Trupti Mehta9-Aug-07 1:02 
Questioncrystal reportviewr problem Pin
magedhv4-Aug-07 22:04
magedhv4-Aug-07 22:04 
AnswerRe: crystal reportviewr problem Pin
Rupesh Kumar Swami6-Aug-07 0:57
Rupesh Kumar Swami6-Aug-07 0:57 
QuestionDecimal Point Pin
WestSideRailways4-Aug-07 19:22
WestSideRailways4-Aug-07 19:22 
AnswerRe: Decimal Point Pin
Luc Pattyn5-Aug-07 0:13
sitebuilderLuc Pattyn5-Aug-07 0:13 
GeneralRe: Decimal Point Pin
WestSideRailways5-Aug-07 9:44
WestSideRailways5-Aug-07 9:44 
GeneralRe: Decimal Point Pin
Luc Pattyn5-Aug-07 10:07
sitebuilderLuc Pattyn5-Aug-07 10:07 
QuestionDatagridview Comboboxs Pin
ryan1174-Aug-07 11:19
ryan1174-Aug-07 11:19 
QuestionWhich programing Language is best for me? Pin
Benjamin Dodd4-Aug-07 9:40
Benjamin Dodd4-Aug-07 9:40 
AnswerRe: Which programing Language is best for me? Pin
Rareed4-Aug-07 10:18
Rareed4-Aug-07 10:18 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.