0

私は、あらゆる形式の C でプログラミングするのが初めてです。

LCDスクリーン(マトリックス軌道LK204-7T-1U-USB-WB)を備えたPLC(Teso PC1620)(ウサギプロセッサを使用)を持っています。LCD の組み込みの水平バー/グラフ機能を使用しようとしています。

以下のコードは機能しますが、バーの長さ (「バー」配列の 6 番目の値) を変更できるようにしたいと考えています。「バー」の静的定数の代わりにコメントアウトされたコードでこれを試しましたが、これは機能していないようで、LCDにランダムなバーが表示されます。

これを引き起こす可能性のあるものと、「バー」配列を割り当てるためのより簡単でより良い方法があるかもしれません。

#use "oempc16xxdrivers.elib"                            //Include the OEM pro-teso PC16XO driver library
#define DINBUFSIZE 31                                   //Defining the serial IN buffer size
#define DOUTBUFSIZE 31                                  //Defining the serial OUT buffer size

void main()
{

static const char clear[] = {254,88};         //Clear LCD command
static const char load[] = {254,104};             //Initialize horizontal bar
static const char bar[] = {254,124,1,1,0,54};  //Place horizontal bar(245,124) column,Row,Direction,Length

auto int percentage;
auto int rxKey;
//auto char bar[6];

IOInit();                                         //Initialises the PC1600 (PLC).
serDopen(19200L);                                 //Setting the baudrate of the serial port
serDrdFlush();                                    //Flushes the serial port D input buffer
serDwrFlush();                                        //Flushes the serial port D transmit buffer

serDwrite(clear,sizeof(clear));                //Clear LCD
serDwrite(load,sizeof(load));                  //Initialize horizontal bar

 //  bar[0] = 254;
 //  bar[1] = 124;
 //  bar[2] = 1;
 //  bar[3] = 1;
 //  bar[4] = 0;
 //  bar[5] = 54;

    for(;;)
    {
   rxKey = serDgetc();

   percentage = 10;
   //bar[5] = percentage;

    if (0x42 == rxKey)
    {
    serDwrite(bar,sizeof(bar));
    }
   }

serDclose ();
}

動的 c バージョン 9.62

リンク:

LCD: https://www.matrixorbital.com/advanced_search_result.php?keywords=LK204-7T-1U+usb&search.x=0&search.y=0

PLC: http://www.teso.com.au/pro-teso/PC1-Controllers/PC1600-Controller.aspx

4

1 に答える 1