Archives
D Programming
DD.gnu digitalmars.D digitalmars.D.bugs digitalmars.D.dtl digitalmars.D.dwt digitalmars.D.announce digitalmars.D.learn digitalmars.D.debugger C/C++ Programming
c++c++.announce c++.atl c++.beta c++.chat c++.command-line c++.dos c++.dos.16-bits c++.dos.32-bits c++.idde c++.mfc c++.rtl c++.stl c++.stl.hp c++.stl.port c++.stl.sgi c++.stlsoft c++.windows c++.windows.16-bits c++.windows.32-bits c++.wxwindows digitalmars.empire digitalmars.DMDScript |
c++ - program crashing...want to read and write to serial port in pure C functions
Guys!!! urgent help is needed...... Help in any pointers to deal with serial port through pure C, code snippets or even direct program will be appreciated!!! I tried the program given by http://www.beyondlogic.org/serial/serial.htm I compiled this program with DIGITAL MARS compiler. Program compiled and linked fine but when I run the program it crashes...I do not understand why... My board is P6VAP+ by company ECS. I checked with the manual.It assigns IRQ 3 to COM1 and at address 3F8. I do understand that COM1 will go from 0x3F8 - 0x3FF and COM2 from 0x2F8-0x2FF. But I dont understand why my program is crashing and how to read and write to the port. thanks and I appreciate your help... kuldip(kal) #include <stdio.h> #include <dos.h> int main() { unsigned int far *ptraddr; /* Pointer to location of Port Addresses */ unsigned int address; /* Address of Port */ int a; ptraddr=(unsigned int far *)0x00000400; getch(); return 0; } kuldip Dec 14 2005
kuldip(kal) wrote:Guys!!! urgent help is needed...... Help in any pointers to deal with serial port through pure C, code snippets or even direct program will be appreciated!!! I tried the program given by http://www.beyondlogic.org/serial/serial.htm I compiled this program with DIGITAL MARS compiler. Program compiled and linked fine but when I run the program it crashes...I do not understand why... My board is P6VAP+ by company ECS. I checked with the manual.It assigns IRQ 3 to COM1 and at address 3F8. I do understand that COM1 will go from 0x3F8 - 0x3FF and COM2 from 0x2F8-0x2FF. Dec 15 2005
Hi thanks for the reply.. But I can not user the Windows kernel API for sure. Now I rebuild the program. I am trying to use the program temproll.c. http://www.beyondlogic.org/serial/termpoll.c When i run that program it is saying undefined function outportb and inportb... I think that program is compiled with TC++. As I looked in the archives i came to know that I can not use inportb and outportb with digital mars. I will have to use _inp and _outp. But I dont know how to use that. can u help me. thanks in advance.... kuldip In article <dnrte5$2ev$1 digitaldaemon.com>, Arjan says...kuldip(kal) wrote:Guys!!! urgent help is needed...... Help in any pointers to deal with serial port through pure C, code snippets or even direct program will be appreciated!!! I tried the program given by http://www.beyondlogic.org/serial/serial.htm I compiled this program with DIGITAL MARS compiler. Program compiled and linked fine but when I run the program it crashes...I do not understand why... My board is P6VAP+ by company ECS. I checked with the manual.It assigns IRQ 3 to COM1 and at address 3F8. I do understand that COM1 will go from 0x3F8 - 0x3FF and COM2 from 0x2F8-0x2FF. Dec 15 2005
Hello,thanks for the reply.. But I can not user the Windows kernel API for sure. Now I rebuild the program. I am trying to use the program temproll.c. http://www.beyondlogic.org/serial/termpoll.c When i run that program it is saying undefined function outportb and inportb... Dec 16 2005
Hello,Help in any pointers to deal with serial port through pure C, code snippets or even direct program will be appreciated!!! I tried the program given by http://www.beyondlogic.org/serial/serial.htm I compiled this program with DIGITAL MARS compiler. Program compiled and linked fine but when I run the program it crashes...I do not understand why... My board is P6VAP+ by company ECS. I checked with the manual.It assigns IRQ 3 to COM1 and at address 3F8. I do understand that COM1 will go from 0x3F8 - 0x3FF and COM2 from 0x2F8-0x2FF. But I dont understand why my program is crashing and how to read and write to the port. Dec 16 2005
|