|
C programing control of the Serial Port.
I would like to be able to montor and control equipment through the serial ports "com 1 or com 2" of 286 up and 386 up or higher processor computers. As many of you may know the 80-286 was a 16 bit computer and the 80-386 was the start of the 32 bit processors. A friend that has some experience with programming languages advised me that it was possible to accomplish this project easier through the C programming language rather than learn to write programs in assembly.
Some 3 decades ago I studied Fortran and Basic so I purchase a tutor book Sams "Teach Yourself C in 21 days". My friend helped me to download/set up the DJGPP "C" compiler and rhide editor software and get started using the tutor and compiler. During this process we learned that because of the 16 and 32 bid difference of processors, the version of the DJGPP C compiler that I had would only produce programs that would work on the 32 bit machine. To verify this I also tried running a simple compiled C program on the 286, which failed. (One thing that bothered me when doing this was the size of the resulting program file for such a simple piece of code ( Just printing out Hello! on the screen). I was thinking at the time that the code generated by the compiler would probably take a hard drive to support running the program.) Can any one explain why there is such a large program for such a small task"
After studying the C language for a week I got far enough along to begin searching for the functions that would allow me to control and output data through the serial ports. This data will consist of a frame of words where each word (consisting of an equipment address and message bits) will address a particular piece of equipment tied to a transmission line which will recognize its own address code, decode the message and either turn the equipment on or off through its own circuitry.
The only function that I have found is "Std Aux" which is mentioned in my tutor book as control of serial port com 1. At this point I was stopped as there is no definition of this function within my tutor book.
I will need a lot of help learning C well enough to write the programs needed to complete this project. For those willing to help, here are four to get me off on the right foot.
Questions:
1. Because I have a lot more 80-286 computers that 386 and above, I would like to be able to write my control programs, so that I can compile them for the 286 also. Does anyone know of a C compiler version that will allow me to write programs for the 286 and with minor modifications to the source code, use it for the 32 bit machines?
2. Can anyone shed light on the C "Std Aux" function as to its complete discription, and how it is use? Since My tutor does not discuss it or state examples of use, are there any other tutors you could refer me to.
3. Can anyone tell me if the compiler that I am using will run the Std Aux function? If you can give me a simple program that I can vary the bits on the serial output ports, I will be able to better understand and test the results at the com port.
4. Can you also address and control the Com 2 port through some function in C.
If you have questions about this projects programing please feel free to ask.
Last edited by Light; Feb 19th, 2005 at 8:00 PM.
Reason: add clarification
|