Dec 7, 2006 #1 T tom_hanks Full Member level 5 Joined Aug 28, 2003 Messages 243 Helped 14 Reputation 28 Reaction score 1 Trophy points 1,298 Activity points 1,571 Hi, I want to detect the incoming string with following message...... "01,F0,F1" as a start of message flag.... i am storing the incoming data in static char comm[128]; can any one, guide me, to detect the start of message ? TIA, tom
Hi, I want to detect the incoming string with following message...... "01,F0,F1" as a start of message flag.... i am storing the incoming data in static char comm[128]; can any one, guide me, to detect the start of message ? TIA, tom
Dec 7, 2006 #2 S sharadbags Junior Member level 3 Joined Oct 1, 2006 Messages 26 Helped 1 Reputation 2 Reaction score 0 Trophy points 1,281 Activity points 1,466 Re: simple C program ? you can input the message on a character by character basis using getchar() and keep a check when is the getchar() first being called for that case write the printf function with what you wish to display
Re: simple C program ? you can input the message on a character by character basis using getchar() and keep a check when is the getchar() first being called for that case write the printf function with what you wish to display
Dec 13, 2006 #3 A ahmedsalah00 Member level 2 Joined Nov 27, 2006 Messages 47 Helped 2 Reputation 4 Reaction score 1 Trophy points 1,288 Location Cairo - Egypt Activity points 1,550 simple C program ? #include <conio.h> main() { char c=0; static char comm[128]; c=getche(); if (c==0x01) { c=getche(); if (c==0xF0) { c=getche(); if (c==0xF1) { for (char i=0;i<128;i++) { c=getche(); comm=c; } } } } }
simple C program ? #include <conio.h> main() { char c=0; static char comm[128]; c=getche(); if (c==0x01) { c=getche(); if (c==0xF0) { c=getche(); if (c==0xF1) { for (char i=0;i<128;i++) { c=getche(); comm=c; } } } } }
Dec 22, 2006 #4 B btbass Advanced Member level 5 Joined Jul 20, 2001 Messages 1,896 Helped 438 Reputation 880 Reaction score 288 Trophy points 1,363 Location Oberon Activity points 12,887 simple C program ? The SLIP protocol is good for this sort of thing and quite easy to impliment. Just type slip into google, look for 'Serial Line Internet Protocol'
simple C program ? The SLIP protocol is good for this sort of thing and quite easy to impliment. Just type slip into google, look for 'Serial Line Internet Protocol'
Apr 10, 2007 #5 S shabab Member level 3 Joined Apr 3, 2007 Messages 57 Helped 3 Reputation 6 Reaction score 0 Trophy points 1,286 Activity points 1,537 simple C program ? take input character by character then check it by if statements if mached then print what you want
simple C program ? take input character by character then check it by if statements if mached then print what you want
Apr 11, 2007 #6 G goosecool Junior Member level 3 Joined Jul 29, 2005 Messages 28 Helped 2 Reputation 4 Reaction score 1 Trophy points 1,283 Activity points 1,484 Re: simple C program ? I would say, depending on the type of machine, XOR can be used. Just XOR the incoming signal with the FLAG and if the result is Zero thats the FLAG.
Re: simple C program ? I would say, depending on the type of machine, XOR can be used. Just XOR the incoming signal with the FLAG and if the result is Zero thats the FLAG.