Skip to main content
mhdizgah
Associate III
December 31, 2015
Question

best way of monitoring & capturing usart protocol for finding & storing of a desire characters

  • December 31, 2015
  • 1 reply
  • 622 views
Posted on December 31, 2014 at 16:02

hi every one

is there any special function for this purpose ? i am currently read characters byte by byte and compare them with desire character but i dont know why it does not work some time my way :

do
R_Buffer=usart_reci(1);//function of receiving characters from usart 1 its work correctly
while( R_Buffer=='o'| R_Buffer=='O');

best regards
    This topic has been closed for replies.

    1 reply

    Tesla DeLorean
    Guru
    December 31, 2015
    Posted on December 31, 2014 at 18:34

    Well C has a number of string and tokenizing functions.

    The kind of stuff you're taking about at a character level really requires you to do the work, perhaps with a state machine implementation, with the ability to resynchronize at a line or character level if the expected sequencing fails.

    Note also that you want the '||' form of OR not the ''|' form for the loop test you are using.
    Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..