如何使用并行端口制作LED灯 [英] How to make LED light using parallel port

查看:76
本文介绍了如何使用并行端口制作LED灯的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这里有人可以将这个C语言代码转换为ASsembly语言代码吗?



Can Someone here Than can Covert this C language code to ASsembly language code ??

#include<stdio.h>
#include<ioports.h>

/* NOTE:
Don't forget to add the -l ioports option under Tools->Compiler options
This will add the ioport interface library

OR 

from the command line:
        
        gcc binary.c -l ioports -o binary.exe
*/


/* Define which port to write to */
#define IO_PORT 0x378

main(void)
{
   int num;
   char instr[25];
   
   printf("press ctrl-C to stop\n\n");
   
   /* Place port into standard output mode */
   outb(IO_PORT+2, inb(IO_PORT+2) & ~32);
   
   while (1) {

      printf("Enter a number (prefix with 0x for hex) :");
      fgets(instr, sizeof(instr), stdin);
      
      /* Jump out of loop if q entered */
      if (toupper(instr[0]) == 'Q')
         break;
         
      sscanf(instr, "%i", &num);
      
      /* now output it to the port */
      outb(IO_PORT, num);  /* write value to port */
      
   }      
    
   return(0);     
}





请帮帮我..

i真的需要让这个工作..



我真的很感谢你的帮助..



谢谢..



已添加代码块[/编辑]

删除了SHOUTING - OriginalGriff [/ edit]



please help me out ..
i really need to make this work..

I Really appreciate your help ..

Thank you..

Code block added[/Edit]
[edit]SHOUTING removed - OriginalGriff[/edit]

推荐答案

如果你想要一个备忘单,在GCC上使用 -S 选项,例如 gcc -S binary.c 。这会产生 binary.s 文件。学习阅读 binary.s 文件的内容,然后进入汇编语言。



一旦你了解阅读并理解你需要自己编写的功能,你已经准备好学习写作了。

没有人可以从你那里承担负担



干杯

Andi
If you want a "cheat sheet", use the -S option on GCC, e.g. gcc -S binary.c. This results in a binary.s file. Learn to read the content of that binary.s file and you will get into assembly language.

Once you understand reading this and isolate the function you need to write yourself, you are ready to learn writing it.
No one can take that burden from you.

Cheers
Andi


这篇关于如何使用并行端口制作LED灯的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆