Giter VIP home page Giter VIP logo

80c51's Introduction

80c51

单片机汇编语言基于编译器SDCC(sdas8051)

windows编译环境搭建

1.程序编辑器atom 网站https://atom.io/

2.编译器:sdcc(windows版)网站http://sdcc.sourceforge.net/

sdcc是一款专门为微型控制器编译的跨平台编译器,自带有详细的使用说明。

3.搭建c语言环境, 首先安装atom与sdcc,然后启动windows自带的powershell(快捷键win+r,输入powershell)。 在powershell命令行中输入atom可启动软件atom。创建文件*.c,注意sdcc与keil的差异:

     sdcc头文件#include <8051.h>

keil中sbit led1 = P1 ^ 0; 而在SDCC是这样子写:

          sbit at 0x90 P1_0; 
        或 
          __sbit __at 0x90 P1_0;

在atom中使用快捷键Ctrl + Shift + C复制*.c文件地址(假如为c:\test\my.c), 在powershell中输入

  sdcc  c:\test\my.c(文件目录)  

系统将会在该目录下生成*.ihx文件, 使用命令:

     packihx c:\test\my.ihx > c:\test\my.hex

生成hex文件,直接使用windows软件烧写程序。如果生成的hex文件无效,请用cmd输入上述命令重新生成hex文件。

4.搭建asm(汇编)环境:汇编程序格式如仓库的源代码所示,详细帮助请浏览网页http://svn.code.sf.net/p/sdcc/code/trunk/sdcc/sdas/doc/asmlnk.txt; 在powershell中输入命令,生成*.rel文件:

sdas8051 -plogsff c:\test\my.asm

再输入命令生成*.ihx文件

  sdcc c:\test\my.rel

再输入命令生成*.hex文件

   packihx c:\test\my.ihx > c:\test\my.hex

如果生成hex文件有问题,请使用cmd输入上述命令重新生成hex文件。

80c51's People

Contributors

keryle avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.