Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

can any programmer solve my problem

Status
Not open for further replies.

M Asghar

Newbie level 5
Joined
Apr 17, 2006
Messages
10
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,382
hi i have wroten a c language code but i found one error that is (Compiling LCDMOD~1.C:
Fatal ..\INCLUDE\EXCPT.H 23: Error directive: ERROR: Only Mac or Win32 targets supported!)

this program is to send a data on the serial port of computer but it's not working properly may it have error in windows.h

here is the code so please any body check it and try to eliminate the error i will be very thankful

code is here..............

#include <windows.h>

HANDLE hComm;

void OpenComm()
{
DCB dcb;

hComm = CreateFile("COM1:", GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL );
if(hComm==INVALID_HANDLE_VALUE) exit(1);
if(!SetupComm(hComm, 4096, 4096)) exit(1);

if(!GetCommState(hComm, &dcb)) exit(1);
dcb.BaudRate = 115200;
dcb.ByteSize = 8;
dcb.Parity = NOPARITY;
dcb.StopBits = 0;
if(!SetCommState(hComm, &dcb)) exit(1);
}

void CloseComm()
{
CloseHandle(hComm);
}

DWORD WriteComm(char* buf, int len)
{
DWORD nSend;
if(!WriteFile(hComm, buf, len, &nSend, NULL)) exit(1);

return nSend;
}

void WriteCommByte(BYTE b)
{
WriteComm(&b, 1);
}

DWORD ReadComm(char *buf, int len)
{
DWORD nRec;
if(!ReadFile(hComm, buf, len, &nRec, NULL)) exit(1);

return nRec;
}

void main()
{
OpenComm();

// initialize the LCD module
WriteCommByte(0x38); // "Function Set" in 8 bits mode
WriteCommByte(0x0F); // "Display ON" with cursors ON
WriteCommByte(0x01); // "Clear Display", can take up to 1.64ms, so the delay
Sleep(2);

// display "hello"
WriteCommByte('h'+0x80);
WriteCommByte('e'+0x80);
WriteCommByte('l'+0x80);
WriteCommByte('l'+0x80);
WriteCommByte('o'+0x80);

CloseComm();
}
 

Make sure you are not building with the "/u" option, which will suppress the built-in MS defines. Also, make sure your include path(s) are correct. If these suggestions don't work, try a simple project with a main() that does nothing to see if you can build that.
 

Hi M Ashgar,
The only problem with your code I see is with the
DWORD WriteComm(char* buf, int len)
and
void WriteCommByte(BYTE b)
declarations - BYTE usually is unsigned char.
BTW, as you say nothing about your development environment - and your proble seems to be there - keep on trying out command line switches.
Regards
 

hi egeorgieve i am building this code in TC(turbo c 6.0) and my system is intel D945 GNT board with HT 64 bit processor .....and the error that TC throughs is of win32 i think that this error is due to 64 bit processor please try to compile it on your side and if this program compiled sucessfully then please notify me....or if it throughs some error so please try to solve the problem

i will be very thankfull to you with regards

M.Asghar

Added after 5 minutes:

the compiler thriughs a fatal error so it's means that no probelem is with code some sort of error with header file of windows.h or it's with my processor b/c it's not 32bit ........please check that
 

this error is due to 64bit pc

u should try the code by new version of compilers
posibally visual c++ will compile it easily
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top