Borland C++ 4.52 Building issues. Cannot convert 'void (interrupt *)(***)' to 'void(*)()

198 Views Asked by At

I don't have a lot of experience troubleshooting C code, let alone on an ancient compiler. I didn't write this code and I'm attempting to reverse engineer it so that I can make small tweaks to its functionality. I appreciate the help!

When I build I get the following errors.

Error EDOE05.CPP 55:Cannot convert 'void (interrupt *)(***)' to 'void (*)() in function main()
Error EDOE05.CPP 136:Cannot convert 'void (*)()' to 'void (interrupt *)(***)' in function main()
Error EDOE05.CPP 136:Type mismatch in parameter '__isr' in call to 'setvect(int,void(interrupt*)(***))' in function main()

I've inserted a '55' and '136' in bold in the code below to show where the issue is happening.

int main(void)
{
    // version printout
    printf("\nS11-36E FIRMWARE EDOE05 TEST EDIT#05 2018-12-14\n\n");

    initMasterDMM32(DMM32M);
    printf("Master Analog Initialized\n");
    initSlaveDMM32(DMM32S);
    printf("Slave Analog Initialized\n");

    void (*oldIRQ5handler)();
    /*55*/ oldIRQ5handler = getvect(IRQ5);    // Save old interrupt handler.**
    setvect(IRQ5, adcHandlerTest);         // Install new interrupt handler.
    printf("VECOTOR old:%04X new:%04X\n", oldIRQ5handler, adcHandlerTest);
    outportb(PIC1 + 1, inportb(PIC1 + 1) & ~0x20);   // Read interrupt mask register and unmask IRQ5.

    //initSerial(COM3, baudrate);

    mainLoops = 0;
    printf("Program initiated\n");
    //=========== MAIN LOOP============
    uint key;
    do {
        mainLoops++;
        printf ("mainLoops: %u, interruptCount: %d\n",  mainLoops, interruptCount);

        // Test for ESC keypress.
        key = _bios_keybrd(_KEYBRD_READY)? _bios_keybrd(_KEYBRD_READ): 0;
        key &= 0x00FF;
            
    } while (key != ESC);
    //=========== /MAIN LOOP============
    
    outportb(DMM32M + 9, 0x00);    // disable timer 0 interrupt.
    outportb(DMM32M + 8, 0x09);  // reset interrupt (Master analog board INTRST)
    outportb(PIC1, EOI);

    /*136*/ setvect(IRQ5, oldIRQ5handler);   // Restore default IRQ5 handler.
    
    printf("Program terminated\n");
    return 0;
}

EDOE05.h

#include <dos.h>
#include <stdio.h>
#include <mem.h>
#include <bios.h>
#include <stdlib.h>
extern "C" {
#include "tcp.h"
}

typedef unsigned char uchar;
typedef unsigned int uint;
typedef unsigned long ulong;

const uint scanRate = 1000;  // Number of A/D scans per second.
const int DMM32M = 0x300;
const int DMM32S = 0x280;
const int COM3 = 0x3E8;
const ulong baudrate = 19200;
const int PIC1 = 0x20;
const int WDT = 0x1EE;
const int IRQ5 = 0xD;
const int ESC = 0x001B;
const int EOI = 0x20;


// Global variables
unsigned int mainLoops;
uchar oldGate = 0;
uchar newGate = 0;
int outputVoltage[18] = {0};
int outputCurrent[18] = {0};
int temperature[3];
int channelSel = -32767;
int refVoltage = -32767;
uchar faults = 0;
ulong elapsedTime = 0;
int msgTimer = 0;
int meterTimer = 0;
int xmtComplete = 0;
int powerFail = 0;
const int reset[18] = {-32767, -32767, -32767, -32767, -32767, -32767,
                              -32767, -32767, -32767, -32767, -32767, -32767,
                              -32767, -32767, -32767, -32767, -32767, -32767};


// Function prototypes
void interrupt (*oldIRQ5handler)(...);
void interrupt adcHandler(...);
int initMasterDMM32(const int base);
int initSlaveDMM32(const int base);
int sendVoltageCurrentMsg(char *buf);
int sendTimeTempMsg(char *buf);
int updateMeters(int *voltage, int *current);
int pollSerialRcvr(void);
int adjustTime(char *buffer);
int InitIP(void);
int initCom(const ulong baud);

// Rob troubleshooting etc
void interrupt adcHandlerTest(...);
int interruptCount;
void sendData(void);

// Ethernet link variables
udp_Socket usock;
char bigbuf[4096];
char txBuf[256];
char rxBuf[32];
uint lport = 50000U;
uint rport = 50000U;
ulong remote_addr = 0xFFFFFFFFLU;  // inet_addr("192.168.1.2");

ulong pkt_count = 0;  // DEBUG CODE

Borland C++ Screenshot

0

There are 0 best solutions below