Assembler to C code

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 
896件の閲覧回数
PabloA
Contributor II

Hi there, please could somebody help me with this code in Assembler? I have to translate it to C code. It works fine in CodeWarrior for 8 bits microcontrollers, but with ColdFire it don't acept this asm instructions.

The idea is to control an LCD display with just 4 bits of data. To do this I have to Swap Display 8 bits data and write the higher nible first.

 

char Display_Data;

char PTAD_Data;

 

  asm

  {

    LDA   PTAD

    AND   #0b11110000     // Mask Non Display Data

    STA   PTAD_Data

    LDA   Display_Data    // Load Display Data

    NSA                        // Set Most Significant Nible First

    AND   #0b00001111     // Clear "Shift_Comp_Data" Bits

    ORA   PTAD_Data

    STA   PTAD            // Set Display Data

  }

 

 

 

Thanks!

 

Pablo

 

ラベル(1)
0 件の賞賛
1 解決策
546件の閲覧回数
kef
Specialist I

HI

   PTAD_Data = PTAD & 0xF0;

   PTAD = ((Display_Data >> 4) & 0x0F) | PTAD_Data;

元の投稿で解決策を見る

0 件の賞賛
2 返答(返信)
547件の閲覧回数
kef
Specialist I

HI

   PTAD_Data = PTAD & 0xF0;

   PTAD = ((Display_Data >> 4) & 0x0F) | PTAD_Data;

0 件の賞賛
546件の閲覧回数
PabloA
Contributor II

Edward, Thank you for your time. I will use it!

Best regards!

Pablo

0 件の賞賛