Assembler to C code

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

Assembler to C code

跳至解决方案
1,096 次查看
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 解答
746 次查看
kef
Specialist I

HI

   PTAD_Data = PTAD & 0xF0;

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

在原帖中查看解决方案

0 项奖励
回复
2 回复数
747 次查看
kef
Specialist I

HI

   PTAD_Data = PTAD & 0xF0;

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

0 项奖励
回复
746 次查看
PabloA
Contributor II

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

Best regards!

Pablo

0 项奖励
回复