hello, with Com1 there isn't any problem. with Com2 there is a problem.
SERIAL_PARAM Com1Cfg; BYTE res ; Com1Cfg.Port = G_COM1; Com1Cfg.Speed = 38400; Com1Cfg.CharSize = 8; Com1Cfg.Parity = FALSE; Com1Cfg.Cwt= 0xFF; Com1Cfg.Bwt = 0xFF ; res = SerialOpen(&Com1Cfg, &ucPortId); read( .... .... write(.... .....
Is this an 8051 question, or a PC question? What is, "the reader?"
"the reader" is Smartcard reader. the application .hex developped by keil C51 was loaded into the Smartcard reader.
If I understand you correctly, you are saying that your device (the smart card reader) works when connected to com1 on your PC, but the same device, using the same firmware, does not work when connected to Com2. If that's the case, then this is a PC configuration issue. You may have your second COM port disabled in CMOS, it may be pre-empted by another application, etc. Dave
there isn't any problem whith COM1 and COM2 of PC. the problem, that the program loaded in the smart card reader can't send or receive any data via COM2.
Com2Cfg.Port = G_COM1; Com2Cfg.Speed = 38400; Com2Cfg.CharSize = 8; Com2Cfg.Parity = FALSE; Com2Cfg.Cwt= 0xFF; //DEFAULT_TIMOUT; Com2Cfg.Bwt = 0xFF ; //DEFAULT_TIMOUT; SerialOpen(&Com2Cfg, &ucPortIdCom2); SerialWrite(... ....
I'm not sure what this line of code does but it looks suspicious to me. Does this line
Com2Cfg.Port = G_COM1;
Com2Cfg.Port = G_COM2;
when i use
Com2Cfg.Port = G_COM2
"can you resolve me this problem" Not without your target, and a full copy of all your soure code! You will need to adopt standard debugging techniques to narrow down the problem! Is data getting into the UART's Tx/Rx buffer? Are the interrupts working? Are all the definitions correct? Have you tried stepping through your functions to look for the difference between COM1 and COM2