View previous topic :: View next topic |
Author |
Message |
ELCouz
Joined: 18 Jul 2007 Posts: 427 Location: Montreal,Quebec
|
[SOLVED] RS232 Welcome Message |
Posted: Tue Sep 25, 2007 3:24 am |
|
|
Hi,
after searching on the forum (found nothing about rs232 login etc etc)... is there a way to display a message (like login or menu) when i'm connecting to the rs232 interface of a PIC (show instantly without writing a command) ?
Thank you !
Project Specs:
PIC18F2550 @ 12mhz XTAL
24AA1025 eeprom
RS232 to USB using CCS RS232 DEMO driver.
EDIT: i'm not asking how to display a menu ... just if there is a code that can detect when i'm connecting to the PIC via hyperterminal.
Last edited by ELCouz on Tue Sep 25, 2007 8:56 am; edited 1 time in total |
|
|
ELCouz
Joined: 18 Jul 2007 Posts: 427 Location: Montreal,Quebec
|
|
Posted: Tue Sep 25, 2007 5:39 am |
|
|
is there any char that i can intercept that maybe hyperterminal or a terminal might send at connection ? |
|
|
Ken Johnson
Joined: 23 Mar 2006 Posts: 197 Location: Lewisburg, WV
|
|
Posted: Tue Sep 25, 2007 5:46 am |
|
|
Sorry, just making a connection does not cause a character to be sent/received at either end.
Ken |
|
|
ELCouz
Joined: 18 Jul 2007 Posts: 427 Location: Montreal,Quebec
|
|
Posted: Tue Sep 25, 2007 6:06 am |
|
|
so there no way to know if im connected or not ? |
|
|
inservi
Joined: 13 May 2007 Posts: 128
|
|
Posted: Tue Sep 25, 2007 6:06 am |
|
|
Hello,
probably using Data Terminal Ready (DTR) can announce to the pic that a connexion is on ?
When PC is not ready to receive, the DTR is at about -12V and when you start Hyperterminal in the connected status, DTR is at about +12v.
So the pic can know when the PC is ready to receive with one diode and one resistor connected to one input !
dro. _________________ in médio virtus
Last edited by inservi on Tue Sep 25, 2007 6:34 am; edited 1 time in total |
|
|
ELCouz
Joined: 18 Jul 2007 Posts: 427 Location: Montreal,Quebec
|
|
Posted: Tue Sep 25, 2007 6:17 am |
|
|
the problem is that im using the RS232 to USB driver ... not possible to use the DTR pin :(
maybe an emulation throught the CCS driver,,, PCM Programmer an advice on this ?
EDIT: mistakes
Last edited by ELCouz on Tue Sep 25, 2007 8:29 am; edited 1 time in total |
|
|
Guest
|
|
Posted: Tue Sep 25, 2007 8:02 am |
|
|
Yes the DTR pin of a good USB to RS232 converter will toggle when Hyperterminal connects. I use this method all the time. The PIC cab be checking the DTR line and when it goes true it can know that there is a RS232 connection. After all the USB converter is just emulating a serial port.
I usually send a couple of CR's first to clear the Hyperterminal buffers, then you can send your message.
You should try this - it works.
HTH - Steve H. |
|
|
ELCouz
Joined: 18 Jul 2007 Posts: 427 Location: Montreal,Quebec
|
|
Posted: Tue Sep 25, 2007 8:28 am |
|
|
Quote: | Yes the DTR pin of a good USB to RS232 converter will toggle when Hyperterminal connects. I use this method all the time. The PIC cab be checking the DTR line and when it goes true it can know that there is a RS232 connection. After all the USB converter is just emulating a serial port. |
i was meaning i'm using the USB D- D+ of the PIC18F2550 with the ccs example USB TO RS232 (there is no hardware converter ... the converter itself is in the pic ;) )
SEE usb_cdc.h & usb.c files
Thank You! |
|
|
Ttelmah Guest
|
|
Posted: Tue Sep 25, 2007 8:44 am |
|
|
Look at usb_cdc_connected.
This returns 'true', once a set_line_coding message is received. Most terminal programs (including hyperterminal), will send such a message, when they first attach to a device.
Best Wishes |
|
|
ELCouz
Joined: 18 Jul 2007 Posts: 427 Location: Montreal,Quebec
|
|
Posted: Tue Sep 25, 2007 8:50 am |
|
|
LOL seriously i read the usb_cdc.h often for a def of these functions:
Code: |
//// get_float_usb() - Read a float number from the user ////
//// get_long_usb() - Read a long number from the user ////
//// get_int_usb() - Read an integer number from the user ////
//// get_string_usb(char *s, int max) - Read a string from the user. ////
//// gethex_usb() - Read a byte, in HEX, from the user ////
//// gethex1_usb() - Read a HEX character |
wow just before that usb_cdc_connected() was there, never saw it
Code: | //// usb_cdc_connected() - Returns TRUE if we received a ////
//// Set_Line_Coding. On most serial terminal programs (such ////
//// as Hyperterminal), they will send a Set_Line_Coding ////
//// message when the program starts and it opens the virtual ////
//// COM port. This is a simple way to determine if the PC ////
//// is ready to display data on a serial terminal program, ////
//// but is not garaunteed to work all the time or on other ////
//// terminal programs. //// |
thanks Ttelmah ... time to go to sleep i guess |
|
|
|