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 support@ccsinfo.com

Specific Timeout Rutine

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







Specific Timeout Rutine
PostPosted: Sun Feb 02, 2003 1:11 pm     Reply with quote

Hello,
In a part of my program I have to send 1 byte at 1200bps (that's no problem), and wait for 3 bytes at 9600bps. But I that bytes doesn't come in less than 2sec, I have to show a Timeout message and return to my menu. Could somebody help me with this? I'm using RS232 Inverted in a 16F73 (RC0 TX & RC1 RX)
Thanks,
Zeke
___________________________
This message was ported from CCS's old forum
Original Post ID: 11206
Tomi
Guest







Re: Specific Timeout Rutine
PostPosted: Mon Feb 03, 2003 2:42 am     Reply with quote

See CCS FAQ "How do I get getc() to timeout after a specified time?"

:=Hello,
:= In a part of my program I have to send 1 byte at 1200bps (that's no problem), and wait for 3 bytes at 9600bps. But I that bytes doesn't come in less than 2sec, I have to show a Timeout message and return to my menu. Could somebody help me with this? I'm using RS232 Inverted in a 16F73 (RC0 TX & RC1 RX)
:=Thanks,
:=Zeke
___________________________
This message was ported from CCS's old forum
Original Post ID: 11221
Ezequiel
Guest







Re: Specific Timeout Rutine
PostPosted: Mon Feb 03, 2003 7:17 pm     Reply with quote

Helo,

I looked at CCS FAQ, but I implementad that rutine in my program with no success. Is there any other way?

Thankz
Zeke

:=See CCS FAQ "How do I get getc() to timeout after a specified time?"
:=
:=:=Hello,
:=:= In a part of my program I have to send 1 byte at 1200bps (that's no problem), and wait for 3 bytes at 9600bps. But I that bytes doesn't come in less than 2sec, I have to show a Timeout message and return to my menu. Could somebody help me with this? I'm using RS232 Inverted in a 16F73 (RC0 TX & RC1 RX)
:=:=Thanks,
:=:=Zeke
___________________________
This message was ported from CCS's old forum
Original Post ID: 11250
Ezequiel
Guest







Re: Specific Timeout Rutine
PostPosted: Fri Feb 07, 2003 5:55 pm     Reply with quote

Hello,
I have a program where I need to stablish a comm. with a ECU (Electronic Control Unit), this unit can operate at 9600bps or 10400bps. But to start the comm. I have to send a command at 5Bps. Fortunately I can do this using Output_low and Output_High and a Delay of 200mS. Then the ECU reply with 0x55 (a good Sync Byte, but I don't know how to use it) and two Data Bytes at 9600bps or 10400bps 8Bits No Parity Inverted. The problem is that I don't know at which baudrate the ECU is going to use. I try to modify the timed_getc() rutine (which appears on a FAQ in the website) with no success. Another problem is that the rest of the program has to communicate also at this baudrate (to send and receive).
I tried to use the HUSART and Set_Usart_Speed (To change between 9600bps and 10400bps) but then I cannot send the command at 5Bps using Output_low and Output_High, at I cannot set the USART to 5Bps.

I find two possible solutions.
A) Send the command (Using any pin but not the USART) at 5Bps, and look in the SyncByte (0x55) to decide which baudrate to use.
B) Send the command (Using any pin but not the USART) at 5Bps, wait for 1.5Sec the SyncByte (0x55) at 9600bps, If it comes the rest of the program has to use this baudrate. If not, change to 10400bps, re send the command, and wait for 1.5Sec the Sync Byte at 10400bps. If it comes the rest of the program has to use this baurate, if not there is no ECU to communicate with, and goto the beginning of the program.

I would like to know if it's possible to do this, which option is more easy to implement, and if you can help me with this little rutine.

Here I send you the code (which is very short), it's unfinished but you can see which micro I'm using and so on.

Thank you very much,

Ezequiel

:=Helo,
:=
:= I looked at CCS FAQ, but I implementad that rutine in my program with no success. Is there any other way?
:=
:=Thankz
:=Zeke
:=
:=:=See CCS FAQ "How do I get getc() to timeout after a specified time?"
:=:=
:=:=:=Hello,
:=:=:= In a part of my program I have to send 1 byte at 1200bps (that's no problem), and wait for 3 bytes at 9600bps. But I that bytes doesn't come in less than 2sec, I have to show a Timeout message and return to my menu. Could somebody help me with this? I'm using RS232 Inverted in a 16F73 (RC0 TX & RC1 RX)
:=:=:=Thanks,
:=:=:=Zeke
___________________________
This message was ported from CCS's old forum
Original Post ID: 11416
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