EngineersGarage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Advertise
You are here: Home / Topics / Anyway to convert assembly code in to C code?

Anyway to convert assembly code in to C code?

|

Microcontroller › 8051 › Anyway to convert assembly code in to C code?

  • This topic has 6 replies, 2 voices, and was last updated 14 years, 3 months ago by dagakshay.
Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • March 9, 2011 at 9:45 am #782
    G Thomas
    Participant

    I need to insert an assembly code into a C code I already have, any ideas?

    thanks

    March 10, 2011 at 6:16 am #5692
    dagakshay
    Participant

    which compiler you using??? 

    March 10, 2011 at 7:12 am #5695
    G Thomas
    Participant

    this is the code i have for serial connection. How do i insert this into my main code for controller:

    ORG 30H
     
    INI:
    MOV TMOD,#21H
    MOV TH1,#0A0H ;9600 BAUD
    MOV SCON,#50H ;8 BIT UART MODE
    MOV TH0,#HIGH(-50000)
    MOV TL0,#LOW(-50000)
     
    SETB TR1
     
    MAIN:
    JB RI,SERIAL
    JMP MAIN
     
    ;==================
    SERIAL:
    CLR RI
     
    MOV A,SBUF
     
    JMP MAIN

    the code for microcontroller is:

     

    March 10, 2011 at 7:27 am #5696
    G Thomas
    Participant

    i was using Keil to convert the original C code into hex

    March 10, 2011 at 11:07 am #5698
    dagakshay
    Participant

    try this it might work

    #include<reg52.h>
     
    void main (void)
    {
    while(1)
    {
    P1=0xff;
    asm:(” MOV R5,#0x13″);
     
    P1=0x00;
    }

    } 

    March 10, 2011 at 11:08 am #5699
    G Thomas
    Participant

    Thank you soo much! Really!

    March 10, 2011 at 11:09 am #5700
    dagakshay
    Participant

    for multi ple statements

    #include<reg52.h>
     
    void main (void)
    {
    while(1)
    {
    P1=0xff;
    asm:
    {
    “MOV R5,#0x13” ;
    “MOV R5,#0x13” ;
    };
       P1=0x00;
    }

    }

    i think it might work 

  • Author
    Posts
Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.
Log In

RSS Recent Posts

  • Fun with AI and swordfish basic June 22, 2025
  • Microinverters and storeage batteries? June 22, 2025
  • FFC connector white June 22, 2025
  • Is AI making embedded software developers more productive? June 22, 2025
  • Can I make two inputs from one?? June 22, 2025

Stay Up To Date

Newsletter Signup
EngineersGarage

Copyright © 2025 WTWH Media LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media
Privacy Policy | Advertising | About Us

Search Engineers Garage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Advertise