AnsweredAssumed Answered

Assembler to C code

Question asked by Pablo Suarez on Sep 13, 2012
Latest reply on Sep 14, 2012 by Pablo Suarez

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;




    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