Any one know how my program should be like when i need to pass in information for example "a" and display it in a display box... through serial communication.
"is there some one that can help me write a program for read and write?? using Visual C++" You need to do some serious study! This is not something that can be taught in just a few brief posts on a forum like this! (and, anyhow, this forum is for Keil - not Microsoft tools!) There are hundreds of books available on "Teach Yourself MSVC Programming", or you could look for taught courses in your locality.
Teach Yourself C++ in 24 Hours: Complete Starter Kit Jessie Liberty, David Horvath http://www.amazon.co.uk/exec/obidos/ASIN/0672326817/qid=1132708016/sr=2-1/ref=sr_2_11_1/203-5826643-3305507
know how to send 80h to the microcontroller and returning 55H??
MSDN has examples of serial communication programming on a Win32 platform. There are hundreds upon hundreds of Win32 programming websites on the internet, however Keil's Discussion Forum is not among them. My Usenet news server lists 2111 Microsoft-related newsgroups. Given all of that, I think your time would be much better spent inquiring about PC-related topics on PC-related venues, and not here, but that's just my opinion.
know how to send 80h to the microcontroller and returning 55H?? This does, for a change, sound like an uC problem HOWEVER, we here are willing to HELP you, but not to do it for you. post YOUR code and help will be forthcoming. Erik
"how to send 80h to the microcontroller" That is a PC programming excercise - eg, MSVC - for which you need to find a PC programming forum "and returning 55H??" Now you need a microprocessor system (both hardware and software) to receive the 80H and send a 55H. Look at the CSAMPLE example in your Keil\C51\examples\ folder - it illustrates receiving data and sending responses on the 8051 serial port.
erm... i did the codings... its like this...
void CSerialComm::Send(HANDLE *pComm, CString str) { unsigned char StopByte=0x1; unsigned long int n_out; str = "0x80"; WriteFile(*pComm, str, str.GetLength(),&n_out , NULL); WriteFile(*pComm, &StopByte, 1, &n_out, NULL); } void CSerialComm::Receive(HANDLE *pComm, CString str1) { char cRxByte; DWORD dwRead; while(cRxByte!=0x1) { ReadFile(*pComm, &cRxByte, 1, &dwRead, NULL); str1+=cRxByte; } MessageBox("Acknowledge Received"); // MessageBox(str1); } void CSerialComm::initComm(HANDLE *pComm) { // HANDLE hComm; // hComm = CreateFile( "COM1:", // GENERIC_READ | GENERIC_WRITE, // 0, // 0, // OPEN_EXISTING, // FILE_FLAG_OVERLAPPED, // 0); // if (hComm == INVALID_HANDLE_VALUE) // { // } // error opening port; abort *pComm = CreateFile("COM1:", GENERIC_WRITE|GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL); if (*pComm ==INVALID_HANDLE_VALUE) { //MessageBox("Please input value !"); } //FillMemory(&dcb, sizeof(dcb), 0); dcb.DCBlength = sizeof(dcb); dcb.BaudRate = CBR_9600; dcb.fBinary = TRUE; dcb.fDtrControl = DTR_CONTROL_DISABLE; dcb.fRtsControl = RTS_CONTROL_DISABLE; dcb.ByteSize = 8; dcb.Parity = NOPARITY; dcb.StopBits = ONESTOPBIT; if (!SetCommState(*pComm, &dcb)) { //MessageBox("Wrong Port"); } }
"tell me wats wrong..." You're asking in the wrong forum, that's what's wrong! That's PC code - so you need to ask about it in a PC forum! What have you done to debug it? MSVC includes a debugger!
Yes indeed it's the wrong forum. However I could send you a functionnal sample so at least you could try to solve your micro-controller communications problems with people sharing there knowledge on this forum (however HyperTerminal is enough for this purpose...). For this I need an e-mail. Jean-Pierre
candy_5689@yahoo.com