如何用C编程控制Parelel端口继电器 [英] How Do I M Controlling Parelel Port For Relay With C Programming

查看:134
本文介绍了如何用C编程控制Parelel端口继电器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

朋友们想帮忙请问他们能否提供有关此主题的信息?

我想通过c编程语言通过并行端口控制继电器我的时间非常有限。

我写了我的程序,它给了我以下错误:源文件未编译。在他们说完之后,上述时期确认说。如果此问题可以在相关C代码字段中共享

提前感谢

a matter of friends would like to help please Can they help with information on this subject ?
I want to control a relay through the parallel port from the c programming language I'm very limited time .
I wrote my program , it gives me the following error: source file not compiled . After the said period confirms saying while they say. If this issue can share in the hands ofthe relevant C code field
Thank you in advance

推荐答案

如果您的错误消息是:

If your error message is:
source file not compiled

与编程并行端口没有任何关系的Tehn - 这是一个根本问题,因为你还没有正确遵循编程周期:



1)设计应用程序

2)代码 - 编辑源文件并编写或修改代码。

3)编译。如果失败,请在(2)处编辑代码并再试一次。

4)运行。

5)测试。如果它无法完全按照您的要求进行操作,请返回(2)或(1)并进行更改。

6)发布。



在这种情况下,很可能你没有编译它,或者它有编译错误,这意味着它无法成功编译。

所以检查你的编译:如果有的话消息,阅读它们。然后采取行动来修复你的代码。如果你干净利落地编译,那么就可以运行它,看它是否有效。

这有点像开车到商店:如果你把钥匙留在家里,或者没有任何燃料在你解决这个问题之前,你无法开始驾驶。 没有钥匙和没有燃料是驱动编译错误的例子,它们阻止你运行开车到商店应用程序!



我们不能为你做到这一点,甚至告诉你该做什么 - 我们看不到你的屏幕,访问你的硬盘或读你的想法。

Tehn that doesn't have anythign to do with programming the parallel port - it's a fundamental problem in that you haven't followed the "programming cycle" properly:

1) Design the application
2) Code - edit the source files and write or modify code.
3) Compile. If it fails, edit your code at (2) and try again.
4) Run.
5) Test. If it fails to do what you want exactly, go back to (2) or (1) and change it.
6) Publish.

In this case, it's very likely that either you didn't compile it, or it had compilation errors which meant that it couldn't compile successfully.
So check your compilation: if there are any messages, read them. Then act on them to fix your code. When you have it compiling cleanly, then you can run it and see if it works.
It's a bit like driving to the shops: if you leave the key at home, or don't have any fuel you can't start driving until you fix that. "No key" and "No fuel" are examples of "driving compilation errors" which prevent you running the "drive to the shops" application!

We can't do that for you, or even tell you what to do - we can't see your screen, access your HDD, or read your mind.


我建​​议你控制继电器(s )用微控制器然后让PC通过串口(或USB上的虚拟串口)与微控制器通信。
I suggest you to control the relay(s) with a microcontroller and then make the PC communicate with the microcontroller via serial port (or virtual serial port on the USB).


#include <stdio.h>
#include <dos.h>
#include <conio.h>


void main (void)
{
clrscr();             /* clear screen */
outportb(0x378,1); /* output the data to parallel port */
getch();              /* wait for keypress before exiting */
}
i vritten this sourch code 
C program give me error (sourch file is not compiled)


这篇关于如何用C编程控制Parelel端口继电器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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