pastebin - collaborative debugging

pastebin is a collaborative debugging tool allowing you to share and modify code snippets while chatting on IRC, IM or a message board.

This site is developed to XHTML and CSS2 W3C standards. If you see this paragraph, your browser does not support those standards and you need to upgrade. Visit WaSP for a variety of options.

Advertising: Credit Card Consolidation - Cheap Car Insurance - Loans - Loans
C paste-bin - collaborative debugging tool View Help

Posted by prout on Thu 10th Apr 04:17 (modification of post by view diff)
download | new post

  1. void IonisProtoSender(void)
  2. {
  3.         static unsigned char Status = 0;
  4.         unsigned char Data;
  5.  
  6.         switch (Status)
  7.         {
  8.         case 0 ://sending syncro
  9.                         FlushSerialIonis();
  10.                         IonisSerialWrite(0x55);
  11.                         TryRead();
  12.                         Status ++;
  13.                         break;
  14.  
  15.         case 1 ://waiting for ok or time out
  16.                         if (IonisProto.STATUSbits.Ok)
  17.                         {
  18.                                 Status ++;      //syncro is done go to next step
  19.                         }
  20.                         if (IonisProto.STATUSbits.Error)
  21.                         {
  22.                                 Status = 0;     //no syncro retry ....
  23.                         }
  24.                         break;
  25.  
  26.         case 2 :
  27.                         //example of an transmission -> set color ON
  28.                         FlushSerialIonis();          //flush serial
  29.                         IonisSerialWrite(0x03); //write
  30.                         IonisSerialWrite(0x03); //size
  31.                         IonisSerialWrite(0x00); //module
  32.                         IonisSerialWrite(0x0c); //descriptor
  33.                         IonisSerialWrite(0x01); //data
  34.                         TryRead();                        //set flag for new transmission
  35.                         Status ++;                        //go to next step
  36.                         break;
  37.  
  38.  
  39.         case 3 :
  40.                         if (IonisProto.STATUSbits.Ok)
  41.                         {
  42.                                 Status ++;      //syncro is done go to next step
  43.                         }
  44.                         if (IonisProto.STATUSbits.Error)
  45.                         {
  46.                                 Status = 0;     //no syncro retry ....
  47.                         }
  48.                         break;
  49.  
  50.         case 4 :
  51.                         //capteur color
  52.                         FlushSerialIonis();          //flush serial
  53.                         IonisSerialWrite(0x02); //read
  54.                         IonisSerialWrite(0x03); //
  55.                         IonisSerialWrite(0x00); //module
  56.                         IonisSerialWrite(0x16); //descriptor
  57.                         IonisSerialWrite(0x03); //data
  58.                         TryRead();                        //set flag for new transmission
  59.                         Status ++;                        //go to next step
  60.                         break;
  61.  
  62.         case 5 :
  63.                         if (IonisProto.STATUSbits.Ok)
  64.                         {
  65.                                 Status ++;      //syncro is done go to next step
  66.                         }
  67.                         if (IonisProto.STATUSbits.Error)
  68.                         {
  69.                                 Status = 0;     //no syncro retry ....
  70.                         }
  71.                         break;
  72.  
  73.         case 6 :
  74.                         //capteur color
  75.                         Ionis_color();
  76.                         Status ++;
  77.                         break;
  78.  
  79.         case 7 :
  80.                         if (IonisProto.STATUSbits.Ok)
  81.                         {
  82.                                 Status = 4;     //syncro is done go to next step
  83.                         }
  84.                         break;
  85.         }
  86. }

Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.

Syntax highlighting:

To highlight particular lines, prefix each line with @@


Remember me
: