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 you replace = COM ???

Status
Not open for further replies.

thuanbk

Junior Member level 3
Joined
Aug 30, 2006
Messages
27
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,514
rs232 hp6365

HI everybody!!!!!!
I'm Thuan vu ,name in Viêt Nam is Vũ Hồng Thuấn.
*) idea:
PDA <<------>Irda(TFDS4500)<---->> MCP2155 <<--->>PIC
Problem:
i am a sudent at Ha Noi city,i have problem with a project . i read a book "PDA-Robotics" of Doug Wiliam and doing according to book this,but at VIET NAM ,I am not look for IC TFDS4500,i find nokia 8250 and 8150 to replace TFDS4500,i find code at web: PDA-robotics.com,and copy&paste on PDA (HP6365 and MDAI),it contact
very good on CPU ARM.
*)CAN replace COM of PDA?
in COM pda have pin 7 (RXD) and 8 (TXD),i can to replace to Tfds4500???

Help:
BUT all i do not conect PDA and ROBOT ? Why ? if you have IC TFDS4500,you can send to me? i think it fault from it? At Viet Nam can not find.
i also have diagram to replace Tfds4500 but it do not conect??


*)address at Viet Nam :
Name: Vũ Hồng Thuấn ,09/37, Mac Thi Buoi strees,Vinh TUY precinct ,Hai Ba Trung Districts, Ha NOI city, Viet Nam country
phone : +84983122739

Please help me........
 

Replacing the RS232 port with a simple TFDS4500 is not so easy.
Read first carefully the datasheet:
http://www.infrarotport.de/tfd_4.pdf

For IR propagation the TFDS needs between the TX of RS232 port and TFDS RX input a modulator on 38.5KHz and between the TFDS TX output and RS232 RX input a demodulator. The name of this driver is TOIM3000 or TOIM3232.
 

    thuanbk

    Points: 2
    Helpful Answer Positive Rating
i using EVC++ with function API or VS5.0 but still not connect :( why????

Added after 3 minutes:

i test in HP6365 with pin TX (7) and RX(8) bit data not recevice and transmit,i can open port (com3),i had opened port but data error
 

Before making any connection between the HP6365 and any other RS232 device you need to find if the HP6365 has a true RS232 level interface or is a 5V (or lower 3.3V) digital RS232 interface (some palmtops does not have level converters included). You need to know what is RS232 and which are the voltage levels for operating correct over the RS232, you need to know which are the protocols allowed on the RS232 and what additional connections you have to do ( say for a Tx-Rx protocol, two wire + gound you may set the comunication with hardware flow or none, hardware flow needs additional wire connections on the other RS232 signals...and so on)

FIRST you need to be able to communicate between your palmtop and your PC without any other software than Hyperterminal. When it works, you may go further.
 

    thuanbk

    Points: 2
    Helpful Answer Positive Rating
thanks. i know HP6365 can interface with RS232 pass 2 pin TX and RX similar PC. and it using 5V. i write with EVC++ :
//////////////////////////////////////////////////////////////////////////

BOOL CSerialCom::OpenPort()
{
// thuc hien mo cong port voi com3:
//portname= "//./" +portname;
HANDLE hComm = CreateFile(TEXT("COM3:"),
GENERIC_READ|GENERIC_WRITE, 0, NULL, OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL, NULL);
if(hComm == INVALID_HANDLE_VALUE)
{
MessageBox(TEXT("CHUA KET NOI THANH CONG???"), TEXT("Error!"), MB_OK);
return false;
}
else
{
MessageBox(TEXT("Ket noi thanh cong"), TEXT("Bat dau thuc hien dieu khien"), MB_OK);
return true;
}

}
///////////////////////////////////////////////////////////////////////////
//ConfigurePort
//////////////////////////////////////////////////////////////////////////


BOOL CSerialCom::ConfigurePort(DWORD BaudRate, BYTE ByteSize,
DWORD Parity, BYTE fParity, BYTE StopBits)
{
////////////////////////////////////////
//structure containing the device configuration settings when the function returns.
//If the call is successful, the function returns a TRUE value
////////////////////////////////////////
COMMPROP commProp;
memset(&commProp, 0, sizeof(COMMPROP));
GetCommProperties(hComm, &commProp);
//////////////////////////////////////////
//DCB m_dcb;

memset(&m_dcb, 0, sizeof(DCB));
/////////////////////////////////////////

BOOL fSuccess = FALSE;
memset(&m_dcb, 0, sizeof(DCB));

// The the current communication port settings
if(GetCommState(hComm, &m_dcb)!=0)
{
MessageBox(TEXT("Could not GetCommState settings"),TEXT("Error!"), MB_OK);
}

// Can we change the settings? Let's check the commProp
else
{
if(commProp.dwSettableParams && SP_BAUD)
{
m_dcb.BaudRate = BAUD_9600;
m_dcb.Parity = 0;
m_dcb.fParity = PARITY_NONE;
m_dcb.StopBits = ONESTOPBIT;
m_dcb.ByteSize = 6;
fSuccess = SetCommState(hComm, &m_dcb);
MessageBox(TEXT("Success GetCommState settings"),TEXT("Error!"), MB_OK);

}
return true;
}
if(fSuccess!=0)
{
MessageBox(TEXT("Could not modify the port's settings"),TEXT("Error!"), MB_OK);
return false;
}
else
{
MessageBox(TEXT("thanh cong"),TEXT("thanh cong"), MB_OK);


return true;
}


/*
if((m_bPortReady = GetCommState(hComm, &m_dcb))==0)
{
MessageBox(TEXT("GetCommState Error"),TEXT("Error"),MB_OK+MB_ICONERROR);
CloseHandle(hComm);
return false;
}
else
{
m_bPortReady = SetCommState(hComm, &m_dcb);
if(m_bPortReady ==0)
{

MessageBox(TEXT("Could not modify the port's settings"),TEXT("Error!"), MB_OK);
return false;
}
else
{
m_dcb.BaudRate = BAUD_9600;
m_dcb.fParity = PARITY_NONE;
m_dcb.StopBits = ONESTOPBIT;
m_dcb.ByteSize = 8;
return true;
}

} */
/*
m_dcb.BaudRate = BAUD_110;
m_dcb.fParity = PARITY_NONE;
m_dcb.StopBits = ONESTOPBIT;
m_dcb.ByteSize = 8;
m_dcb.Parity = 0;*/
/*
m_dcb.fBinary=TRUE;
m_dcb.fDsrSensitivity=false;
m_dcb.fOutX=false;
m_dcb.fInX=false;
m_dcb.fNull=false;
m_dcb.fAbortOnError=TRUE;
m_dcb.fOutxCtsFlow=FALSE;
m_dcb.fOutxDsrFlow=false;
//m_dcb.fDtrControl=DTR_CONTROL_DISABLE;
m_dcb.fDsrSensitivity=false;
//m_dcb.fRtsControl=RTS_CONTROL_DISABLE;
m_dcb.fOutxCtsFlow=false;
m_dcb.fOutxCtsFlow=false;*/

/*if((m_bPortReady = GetCommState(hComm, &m_dcb))==0){
MessageBox(TEXT("GetCommState Error"),TEXT("Error"),MB_OK+MB_ICONERROR);
CloseHandle(hComm);
return false;}


if((SetCommState(hComm, &m_dcb)) ==0){
MessageBox(TEXT("SetCommState Error"),TEXT("Error"),MB_OK+MB_ICONERROR);
CloseHandle(hComm);
return false;}
MessageBox(TEXT("DAT THANH CONG SetCommState GetCommState"),TEXT("thanh cong"),MB_OK+MB_ICONERROR);
return true;*/

}
//////////////////////////////////////////////////////////////////////////
// Serial Timeouts
// Before we look at how to read and write data from and to a serial device,
// it is important that your application set the communication timeout values after it opens the port
//////////////////////////////////////////////////////////////////////////
BOOL CSerialCom::SetCommunicationTimeouts(DWORD ReadIntervalTimeout, DWORD ReadTotalTimeoutMultiplier,
DWORD ReadTotalTimeoutConstant, DWORD WriteTotalTimeoutMultiplier,
DWORD WriteTotalTimeoutConstant)
{
COMMTIMEOUTS m_CommTimeouts;
memset(&m_CommTimeouts, 0, sizeof(COMMTIMEOUTS));
m_CommTimeouts.ReadIntervalTimeout =MAXDWORD;
m_CommTimeouts.ReadTotalTimeoutConstant =10;
m_CommTimeouts.ReadTotalTimeoutMultiplier =10;
m_CommTimeouts.WriteTotalTimeoutConstant = 20;
m_CommTimeouts.WriteTotalTimeoutMultiplier =30;

//The result of a relational expression is 1 if the tested relationship is true and 0 if it is false. The type of the result is int.

if((m_bPortReady = GetCommTimeouts (hComm, &m_CommTimeouts))!=0)
return false;

//////////////////////////////////////////////////////
m_bPortReady = SetCommTimeouts (hComm, &m_CommTimeouts);
if(m_bPortReady !=0)
{
MessageBox(TEXT("StCommTimeouts function failed"),TEXT("Com Port Error"),MB_OK+MB_ICONERROR);
CloseHandle(hComm);
return false;
}
return true;
MessageBox(TEXT("StCommTimeouts function success"),TEXT("Com Port success"),MB_OK+MB_ICONERROR);
}
//////////////////////////////////////////////////////////////////////////
// Thuc hien truyen bang ham writefile();
//////////////////////////////////////////////////////////////////////////
BOOL CSerialCom::Write(CString write)
{
DWORD BytesWritten=0;
// = 0 fale = 1 true
if(WriteFile(hComm,&write,100,&BytesWritten,NULL)!=0)
{
if(GetLastError()!=ERROR_IO_PENDING)
{
MessageBox(TEXT("WriteFile failed, but it isn't delayed. Report error and abort."),TEXT("Loi"),MB_OK);
return false;
}
}
else
{ // tiep tuc//////////////////////////////////////////////////////////////////////////

//// Write operation completed successfully.
for (int i=0;1<100;i++)
{

WriteFile(hComm,&write,100,&BytesWritten,NULL);
}
MessageBox(TEXT("Da gui duoc duoc du lieu"),TEXT("Thanh cong"),MB_OK);
return true;

}
return true;

}

//////////////////////////////////////////////////////////////////////////
// Thuc hien nhan bang ham Readfile();
//////////////////////////////////////////////////////////////////////////

BOOL CSerialCom::Read(CString &resp)
{
// kiem tra
//You can make a thread wait on serial driver events by means of the following three functions
//

DWORD dwMask;
// Set mask and wait.
GetCommMask (hComm,&dwMask);
if(GetCommMask (hComm, &dwMask))
{ //////////////////////////////////////////////////////////////////////////

if(m_bPortReady=SetCommMask (hComm, EV_RXCHAR | EV_ERR)!=0)
{
MessageBox(TEXT("loi SetCommMask"),TEXT("Loi"),MB_OK);
return false;
}
else
{
if (WaitCommEvent (hComm, &dwMask, 0))
{

// Use the flags returned in dwMask to determine the reason
// for returning
switch (dwMask)
{
case EV_RXCHAR:
{

//Read character.
////////////////////////////////////////////
CString read;
resp="";
DWORD BytesTransferred=0;

if(!ReadFile(hComm, &read, 100, &BytesTransferred, NULL))
{
return false;
}
else
{ // thah cong

if (BytesTransferred != 1)
{
ReadFile(hComm, &read, 100, &BytesTransferred, NULL);
resp=read;
MessageBox(TEXT("Da nhan thanh cong"),TEXT("Truyen thanh cong"),MB_OK);
return false;
}
else
{


MessageBox(TEXT("error !!!!"),TEXT("Error"),MB_OK);
return true;
}
}
break;
}
case EV_ERR:
{
// Process error.
MessageBox(TEXT("Khong viet duoc du lieu"),TEXT("Loi viet"),MB_OK);
break;
}
}
return true;
}
return true;
}
}
return true;
}
//////////////////////////////////////////////////////////////////////////
// Close Port//
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
// Close Port//
//////////////////////////////////////////////////////////////////////////
void CSerialCom::ClosePort()
{
if(hComm)
CloseHandle(hComm);
return;
}
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top