home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: sparky!uunet!cs.utexas.edu!sdd.hp.com!mips!darwin.sura.net!jvnc.net!news.edu.tw!news!debbie!cp79111
- From: cp79111@csie.nctu.edu.tw (Kuo-Ping Hsu)
- Subject: help!!!
- Message-ID: <1992Aug18.063338.21333@debbie.cc.nctu.edu.tw>
- Sender: usenet@debbie.cc.nctu.edu.tw (News Sender)
- Organization: Computer Science & Information Engin., Chiao-Tung U, Taiwan, ROC
- X-Newsreader: Tin 1.1 PL3
- Date: Tue, 18 Aug 1992 06:33:38 GMT
- Lines: 92
-
- hello,everybody :
- I want to write a program about RS232 communication routine,
- but some trouble happened. Could you help me?
- I use Borland C++ 3.0 compiler and write a following program. There is
- a class called 'comm' with a syntax error in the constructor.
- I want to write a new IRQ interrupt service routine to replace old one.
- So, I must set new vector to point new ISR. I use Borland's
- run-time function 'void setvect(int int_no,void interrupt (*isr)())'.
- The second parameter must be a address that point to new IRQ. In my
- program, there is a statement like this :
-
- setvect(com_irq,&comm::NewIRQ);
- ^^^^^^^^^^^^^
- But the compiler reports a following error :
-
- Error : Connot convert 'void (far interrupt comm::*)()'
- to 'void (interrupt far *)(...)'
- If I write :
-
- setvect(com_irq,NewIRQ);
- ^^^^^^
- then, there is a new fault
-
- Error : Member function must be called or its address taken.
-
- How can I solve this problem? If you know. Please reply me via E-mail.
- Thank you very much in advance.
- -----------------------------------------------------------------
- /VVVVVV\
- | ^ | E-Mail : cp79111@csie.nctu.edu.tw
- | O | National Chiou Tung University
- |@ ) Taiwan R.O.C.
- \ `--/
- | |
- ======== Kuo-Ping Hsu
- ----------------------------------------------------------------------------
-
- ===== File : RS232.HPP ======================
-
- :
- :
- class comm {
- private:
- :
- :
- void interrupt NewIRQ(); // new IRQ interrupt service routine
- void interrupt (*OldIRQ)(...); // save old IRQ
- public:
- comm(int port_no,int baud,char parity,char length,char stop_bit);
- :
- :
- char recv(); // receive data from comm port
- ~comm(); // destructor
- };
-
- ===== File : RS232.CPP =======================
-
- #include "rs232.hpp"
-
- // Initial RS232 & set IRQ ISR
- comm :: comm(int port_no,int baud,char parity=0,char length=8,char stop_bit=0)
- {
- :
- :
- :
-
- // Set 8259 peripheral interrupt controller
- OldIRQ = getvect(com_irq[port]); // get old IRQ ISR
- setvect(com_irq[port],&comm::NewIRQ); // set new IRQ ISR
- : ^^^|^^^^^^^^^
- : V
- Error : Connot convert 'void (far interrupt comm::*)()'
- to 'void (interrupt far *)(...)'
- }
-
- // New IQR interrupt service routine
- void interrupt comm :: NewIRQ()
- {
- :
- :
- }
- :
- :
- :
- main()
- {
- comm rs232(1,BAUD_115200); // Initial RS232
- rs232.send('A');
- return 0;
- }
-
-
-