hi,
please help using keil compiler for 80c51..
how to writ assembly program and compile iot in keil...

please help.... :sad:

Dani AI

Generated

As covered the basic Keil project flow, the most common gaps for 80C51 users are the required assembler layout (reset vector), basic runtime setup, and a few target options that affect simulation and hex output. The snippet below is a minimal Keil/ASM51 program showing a reset vector, a simple main, and a tiny delay routine — useful as a starting template for AT89C52/8051-style devices.

; blink.asm  -- minimal 8051 assembly for Keil uVision
    ORG 0000h
    LJMP main

    ORG 0030h
main:
    MOV SP,#07h
    MOV P1,#0FFh
loop:
    CPL P1
    ACALL delay
    SJMP loop

delay:
    MOV R2,#0FFh
d1:
    DJNZ R2,d1
    RET

END

Practical notes and troubleshooting (fills gaps in the earlier post):

  • Reset vector: the processor starts at 0x0000, so an ORG 0000h with LJMP to the main code is essential; missing this makes the code appear not to run.
  • Stack: the default SP after reset is 07h on classic 8051; explicitly setting SP avoids accidental workspace corruption when interrupts or register banks are used.
  • Device include and SFR names: use the device-specific include/header that comes with Keil (found in the uVision INC folder) to reference SFRs by name when needed.
  • Simulator timing and delays: the simulator uses the selected crystal/machine-cycle model; set the oscillator frequency in Target Options so timing loops behave as expected. Classic 8051 uses 12 oscillator cycles per machine cycle.
  • Output and debug aids: enable "Create HEX File" in Target Options -> Output to produce a programmer-ready hex. Turning on listing/map files and the assembler listing helps track undefined-symbol and address problems.
  • Common errors: "Undefined symbol" usually means a misspelled label or missing ORG/END; linker errors often come from missing target output settings or no code at address 0x0000.

This complements ’s project steps by focusing on code structure and the runtime/configuration details that most beginners miss when moving from an editor to running code in the simulator or on hardware.

Hi Arrogant,
sorry for delay.Some days before i joined the site and i searched the unanswered threads.If u got the answer of your question then this help is for them who don't know about KEIL Compiler and want to know.
It's very easy to work with Keil if you know how to write the programs in c or assembly language.I am writing the basic steps to compile and run a program in assembly language:
1.open the keil
2.open project window and then select a new project and save it by any name like exam1.
3.Now a "select device for target 'target1' " window will appear.
Select the name of the chip vendor (Intel, Philips, Siemens, etc.) in the Vendor box.Select the device family from the drop down menu in the Family box.Enter the part number for the device in the Device box.I select ATMEL,after clicking on Atmel it will give device no.i select AT89C52.
4.Now in "project workspace"(window on the left side),target1 will appear.Click on target1,source group1 will appear
5.open new file and write a program in assembly.save it with .asm (like 'exam.asm')
6.Now right click on the "source group1' .select "add files to group 'source group1'"
give the file name like 'exam.asm, and add it and close that window.again left click on the source group1, you can see the added file.
7.Right click on this added file and select " build target".By this you can compile your program. check the output window. if your pro is compiled proprly then go to 'Debug'
8.select 'start/stop debug session'
9.in project workspace you can see how your program is running.
10.again go to 'Debug' and see F11 is there for running your program step-by-step.
11.press F11 or F5.
12.again go to Debug and select 'start/stop debug session' to stop the program.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.