after i follow all the instruction i got 1 error expected type -specifier before hello_worldApp .. how to solve this ?
and i got 1 question , i need to create a gui for CNC machine x,y,z movement ... is that possible using wxwidget ?
i got the code in c++ , can i convert this to wxwidget ? (eg: click some button can perform the movement task)
Code: Select all
#include <stdio.h>
#include <conio.h>
#include <windows.h>
#include "iocpp.h"
typedef short _stdcall (*inpfuncPtr)(short portaddr);
typedef void _stdcall (*oupfuncPtr)(short portaddr, short datum);
int main(void)
{
HINSTANCE hLib;
inpfuncPtr inp32;
oupfuncPtr oup32;
/* Load the library */
hLib = LoadLibrary("inpout32.dll");
inp32 = (inpfuncPtr) GetProcAddress(hLib, "Inp32");
oup32 = (oupfuncPtr) GetProcAddress(hLib, "Out32");
// BOLEH EDIT
const int LAJU = 50;
short x;
while (!kbhit())
{
x = (inp32)(0x0379);//Declaring inp32 as x
//printf("port read %d\n",x); //x read as integer
if (x == 127)//all low
{
printf("kedepan...\n");
(oup32)(0x0378,1); //to send all low
Delay(LAJU);
(oup32)(0x0378,0);
Delay(LAJU);
}
else if (x == 63)//pin no 10 high
{
printf("Stop\n");
(oup32)(0x0378,0);
Delay(LAJU);
(oup32)(0x0378,0);
Delay(LAJU);
}
else if (x == 255)//pin no 11 high
{
printf("Stop\n");
(oup32)(0x0378,3);
Delay(LAJU);
(oup32)(0x0378,2);
Delay(LAJU);
}
else if (x == 95)//pin no 12 high
{
printf("Stop\n");
(oup32)(0x0378,0);
Delay(LAJU);
(oup32)(0x0378,0);
Delay(LAJU);
}
else if (x == 119)//pin no 13 high
{
printf("Stop\n");
(oup32)(0x0378,0);
Delay(LAJU);
(oup32)(0x0378,0);
Delay(LAJU);
}
else if (x == 111)//pin no 15 high
{
printf("Stop\n");
(oup32)(0x0378,0);
Delay(LAJU);
(oup32)(0x0378,0);
Delay(LAJU);
}
else// other address than pin 10 , 11, 12, 13, and no 15 pin
{
printf("Problem with status pin.\n");// For troubleshoot the status pin
Delay(LAJU);
}
}
//TAMAT EDIT
/* Unload the library */
FreeLibrary(hLib);
return 0;