CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

[SOLVED] RS232 Welcome Message

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
ELCouz



Joined: 18 Jul 2007
Posts: 427
Location: Montreal,Quebec

View user's profile Send private message

[SOLVED] RS232 Welcome Message
PostPosted: Tue Sep 25, 2007 3:24 am     Reply with quote

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

View user's profile Send private message

PostPosted: Tue Sep 25, 2007 5:39 am     Reply with quote

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

View user's profile Send private message

PostPosted: Tue Sep 25, 2007 5:46 am     Reply with quote

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

View user's profile Send private message

PostPosted: Tue Sep 25, 2007 6:06 am     Reply with quote

so there no way to know if im connected or not ?
inservi



Joined: 13 May 2007
Posts: 128

View user's profile Send private message

PostPosted: Tue Sep 25, 2007 6:06 am     Reply with quote

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

View user's profile Send private message

PostPosted: Tue Sep 25, 2007 6:17 am     Reply with quote

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








PostPosted: Tue Sep 25, 2007 8:02 am     Reply with 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 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

View user's profile Send private message

PostPosted: Tue Sep 25, 2007 8:28 am     Reply with quote

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







PostPosted: Tue Sep 25, 2007 8:44 am     Reply with quote

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

View user's profile Send private message

PostPosted: Tue Sep 25, 2007 8:50 am     Reply with quote

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.                                         ////


Embarassed Embarassed Embarassed

thanks Ttelmah ... time to go to sleep i guess Laughing
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group