macsbug

Just another WordPress.com site

MONITOR PROCESSOR FLAG WORD of Processing

with one comment

MONITOR PROCESSOR FLAG WORD of Processing                                               2014.09.21

With Monitor circuit(Arinc 429 Receiver) of Arduino

//---------------------------------------------------------------------------
// A429_MON_FLAG_20101222
// XXX-XXX RADIO ALT TRANSCEIVER MONITOR Processor Flag Word MONITOR
// ORG Altitude Flag Word Copy                     2010.12.20    S.mac
// REV Serial error pass                           2010.12.22    S.mac
// REV x display size                              2014.09.21    S.mac
// REC DISABLE on=9.8msec/off=25ms,A429 32bit=2.54ms,Serial=2ms
//---------------------------------------------------------------------------
import processing.serial.*;         // serial liblary include
Serial PortA;                       // seria read position
int c=1;                            // Read data count
int d=2;                            // xline width
int x1=350;                         // xline start position
int xw=1020;                        // x display size
int pwr=0;                          // PAUSE Position
int pcg=0;                          // Pause memo
char [] bit = new char [33];        // A429 SERIAL RECEIVE DATA Buffer
char [] bix = new char [33];        // before 32bit
String [] m = {                     // FLAG WORD 32BIT LIST(0 to 31)
  "PAD (always high)","ALTIMETER STATUS","MATH","COUNTER MODE",
  "PAD (always low)","SELF-TEST","SELF-TEST DELTA","SELF-TEST ERROR",
  "MONITOR","PASS COUNTER","MODE ERROR","UART","SSM",
  "BINALY ALTITUDE COMPARISION","VALID DATA","LIFSPST","INPUT",
  "CURRENT ALTIMETER MODE-(LSB)","CURRENT ALTIMETER MODE-(MSB)",
  "LO IF SIGNAL PRESENCE","HI IF SIGNAL PRESENCE","LIFSPDR","HIFSPDR",
  "PAD","40 FOOT AID","57 FOOT AID","80 FOOT AID","RAM PASS LOW",
  "RAM PASS HIGH","ROM PASS","POWER","PARITY"};
String [] n = {"01","02","03","04","05","06","07","08","09","10",
               "11","12","13","14","15","16","17","18","19","20",
               "21","22","23","24","25","26","27","28","29","30","31","32"};
//---------------------------------------------------------------------------

void setup(){                                    // Windows : COM*
  //PortA=new Serial(this,"COM4",115200);          // 2msec(32bit)
  PortA=new Serial(this,"/dev/cu.usbserial-A900acDW",115200);// Mac
  size(xw,740);                                  // Graphic area size(x,y)
  noStroke();background(0);                      // BackGround Color=Black
  fill(255); text("XXX-XXX MONITOR Processor Flag Word",100,0,600,48);
  //fill(255); text( "*.*.co.,Ltd. / RA Group",480,0,600,48);
  //fill(255); text( "by oono 2010",492,20,600,48);                       
  for ( int i=0; i<32; i=i+1 ){ fill(255); text( n[i],20,60+20*i,600,48);
        fill(255); text( m[i],100,60+20*i,600,48);}
  for ( int i=0; i<640; i=i+20 ){ fill(153,255,0); rect(50,60+i,34,12);}
  fill(255,0,0); rect(50,20,17,12); fill(120,140,255); rect(67,20,17,12);
  fill(255); text( "bit       1   0     FLAG WORD",20,19,600,48);  
  noStroke();fill(120,140,255);rect(x1-d,60,d*2,635);  
  setButton(120,140,255);                        // PAUSE Button color set
}

//---------------------------------------------------------------------------
// ARINC429 SERIAL DATA RECEIVE AND DATA STORE   //
void draw(){                                     //
  if ( pwr==0 ){ noStroke();                     // PAUSE ON/OFF pwr=0(OFF)
  fill(120,140,255);rect(x1+d,60,d*2,635);       // wave start bar
  stroke(255);                                   // Line Set
  //---------------------------------------------// 32Bit Read start
  if (PortA.available()>33){                     // 32+1Bit(end data)
    for ( int i=0; i<32; i=i+1 ){                // 32bit = 0 to 31
      bit[i] = PortA.readChar();                 // SerialRead & Store
    }                                            //
    PortA.clear();                               // Serial Port Clear
  }                                              // 32Bit Read end
  //---------------------------------------------//    
    if (bit[0]=='0' || bit[4]=='1'){             // PAD1 or 2 NG Pass
  //---------------------------------------------// 32Bit Display  
    for ( int i=0; i<32; i=i+1 ){                // 32bit = 0 to 31   
      int HI=62+i*20; int LO=70+i*20;            // LOGIC Level HI/LO pos
      if (bit[i] != bix[i]){line(x1,LO,x1,HI);}  // bit changed V-line
      if (bit[i] == '0'){fill(120,140,255);      // bit 0 --------------
       line(x1,LO,x1+d,LO);                      // bit 0 level set LO
      }                                          // --------------------
      else{ println(m[i]);fill(255,0,0);         // bit 1 , STATUS print
       line(x1,HI,x1+d,HI);                      // bit 1 level set HI
      }                                          // --------------------
      rect(50,60+i*20,34,12);                    // Draw bit
      bix[i]=bit[i];                             // store bit "0" or "1"
    }                                            // --------------------
  //---------------------------------------------// Draw Line Next
    x1=x1+d;                                     // next x1
    if ( x1 > xw-10 ){ x1=350 ;}                 // x line reset
    println (c);                                 // Counter display
    c=c+1;                                       // Read data count up
   }                                             // PAD NG
  //---------------------------------------------//        
  }                                              // end pause
  //---------------------------------------------//
   if(keyPressed) {                              // PAUSE Key ( p or P )
    if(key == 'p' || key == 'P'){PauseSet();}    // PAUSE ON/OFF Button set
   }                                             //
  //---------------------------------------------//   
}                                                // end void draw

//---------------------------------------------------------------------------
void mousePressed(){                             // Mouse press
  if(mouseX>340 && mouseX<420 && mouseY>35 && mouseY<55){
    PauseSet();}                                 // PAUSE ON/OFF Button set
}                                                //
//---------------------------------------------------------------------------
void setButton(color c1,color c2,color c3){      // PAUSE Button Bar set
  fill(c1,c2,c3); rect(345,35,73,20);            // Bar color set
  fill(255); text("PAUSE",363,50);               // text set
}                                                //
//---------------------------------------------------------------------------
void PauseSet(){                                 // PAUSE ON/OFF set
  if ( pwr==0) { pcg=1; setButton(255,0,0);}     // PAUSE ON  Button set
  else { pcg=0; setButton(120,140,255);}         // PAUSE OFF Button set
  pwr = pcg; delay(500); PortA.clear();          // PAUSE memo, chataring
}                                                //
//---------------------------------------------------------------------------

Written by macsbug

9月 21, 2014 @ 3:39 am

カテゴリー: Processing

コメント / トラックバック1件

Subscribe to comments with RSS.

  1. Hi,
    saw your arduino Arinc 426 project .Just wandering if you be interested DME Arinc568 Conversion to Ardunio Display. my email Dave.Ramsey@StealthAviation.com.au Will pay for your support.
    regards
    Dave

    Dave Ramsey

    9月 17, 2016 at 3:41 am


コメントを残す

以下に詳細を記入するか、アイコンをクリックしてログインしてください。

WordPress.com ロゴ

WordPress.com アカウントを使ってコメントしています。 ログアウト / 変更 )

Twitter 画像

Twitter アカウントを使ってコメントしています。 ログアウト / 変更 )

Facebook の写真

Facebook アカウントを使ってコメントしています。 ログアウト / 変更 )

Google+ フォト

Google+ アカウントを使ってコメントしています。 ログアウト / 変更 )

%s と連携中

%d人のブロガーが「いいね」をつけました。