0

MicroChip PIC32 組み込みチップの LCD ディスプレイに適応させた DMA 割り込みハンドラに問題があります。

内部メモリが限られているため、カラー LCD 用のフレーム バッファが必要です。16 色を使用し、ピクセルごとにニブルを使用することにしました。次のような配列を作成しました。

unsigned char GraphicsFrame[FRAME_HEIGHT][LINE_LENGTH/2]; 

割り込みハンドラで、4 ビットのニブルを 16 ビットの値に変換して、パラレル ポートと DMA 転送を介して LCD に送信します。これを実現するために割り込みハンドラーでルックアップ テーブルを使用しますが、これをデバッグするときに General_Exception_Handler に入り、4 ビット ニブルを抽出して 16 ビット値に変換する方法に問題があることを示しています。

for( i=0,j=0; i<30; i++, lineX++ )
{
    // not particularly elegant, perhaps look at a better way
    if     ((((GraphicsFrame[line][i]) >> 4) & 0x0F) == 0x0) lineBuffer[j++] = (unsigned short int)RGBBlack;
    else if((((GraphicsFrame[line][i]) >> 4) & 0x0F) == 0x1) lineBuffer[j++] = (unsigned short int)RGBBlue;
    else if((((GraphicsFrame[line][i]) >> 4) & 0x0F) == 0x2) lineBuffer[j++] = (unsigned short int)RGBRed;
    else if((((GraphicsFrame[line][i]) >> 4) & 0x0F) == 0x3) lineBuffer[j++] = (unsigned short int)RGBGreen;
    else if((((GraphicsFrame[line][i]) >> 4) & 0x0F) == 0x4) lineBuffer[j++] = (unsigned short int)RGBCyan;
    else if((((GraphicsFrame[line][i]) >> 4) & 0x0F) == 0x6) lineBuffer[j++] = (unsigned short int)RGBYellow;
    else if((((GraphicsFrame[line][i]) >> 4) & 0x0F) == 0x7) lineBuffer[j++] = (unsigned short int)RGBKaneGreen;
    else if((((GraphicsFrame[line][i]) >> 4) & 0x0F) == 0xF) lineBuffer[j++] = (unsigned short int)RGBWhite;

    if     ((GraphicsFrame[line][i] & 0x0F) == 0x0) lineBuffer[j++] = (unsigned short int)RGBBlack;
    else if((GraphicsFrame[line][i] & 0x0F) == 0x1) lineBuffer[j++] = (unsigned short int)RGBBlue;
    else if((GraphicsFrame[line][i] & 0x0F) == 0x2) lineBuffer[j++] = (unsigned short int)RGBRed;
    else if((GraphicsFrame[line][i] & 0x0F) == 0x3) lineBuffer[j++] = (unsigned short int)RGBGreen;
    else if((GraphicsFrame[line][i] & 0x0F) == 0x4) lineBuffer[j++] = (unsigned short int)RGBCyan;
    else if((GraphicsFrame[line][i] & 0x0F) == 0x5) lineBuffer[j++] = (unsigned short int)RGBMagenta;
    else if((GraphicsFrame[line][i] & 0x0F) == 0x6) lineBuffer[j++] = (unsigned short int)RGBYellow;
    else if((GraphicsFrame[line][i] & 0x0F) == 0x7) lineBuffer[j++] = (unsigned short int)RGBKaneGreen;
    else if((GraphicsFrame[line][i] & 0x0F) == 0xF) lineBuffer[j++] = (unsigned short int)RGBWhite;
}

60 ピクセルを含む別の配列を使用して、一度に 60 ピクセル (60 x 16 ビット) を転送するように DMA をセットアップしようとしています。

unsigned short int lineBuffer[60];

ニブルを抽出して変換する方法に問題を見つけられる人はいますか? 警告やエラーがないので、何も飛び出していません!

どんな助けでも感謝します、ありがとう

4

1 に答える 1