PDA

View Full Version : SEROUT2 takes 1400ms to execute?



droptail
- 15th March 2006, 04:09
SerOut2 PORTB.6,N2400,["A",w2]

I've timed this on a tight loop and it takes almost 1500ms to execute! Whats taking so long? How can I speed this up to us? Is the "A" just for a handshake? I just copied it from the manual. No define or anything needed to use it?
The compiler is set to XT and both PIC's have 3.58 oscillators and program defines osc 3.

Dave
- 15th March 2006, 11:41
droptail, The statement will "WAIT" for an ascii "A" to be received before looking for the variable. I don't see any timeout so what it taking so long is the receiving of the ascii "A" which is coming from some external device.

Dave Purola,
N8NTA

droptail
- 15th March 2006, 17:15
master PIC: SerOut2 PORTB.6,N2400,["A",w2]
slave PIC: SerIn2 PORTB.0,N2400,[wait ("A"),w2]

Not sure if I understand completely. The delay has been determined @ SEROUT2 statement, no external devise is part of this, not waiting at the SERIN2 statement. I have included the modifier "wait" and qualifier "A" for timing purposes to transmit byte w2, a marker if you will. This qualifier "A" isn't anywhere else in the program, I assumed it is generated at the time of the Serout2 statement execution (instantly). Actually, I need to know if using the qualifier "A" in SEROUT is OK, I can't find any reference to it in the manual in SEROUT or SEROUT2, but I believe it is necessary to send if SERIN is expecting to see it? Why the long delay in transmittal? Need I establish the use of the qualifier elsewhere first?

Dave
- 16th March 2006, 11:42
droptail, I spoke incorrectly. At first glance I thought you were receiving the string but after comming back to the message I noticed that you were sending the command. There is no reason for the pic to wait before sending the string "A",w2. I only ask is the variable w2 a word or a byte? Next time I will read the post twice before replying. Sorry.

Dave Purola,
N8NTA

droptail
- 16th March 2006, 17:08
W2 can be a word. After some comparison I found that SEROUT2 takes 735ms to execute while SEROUT takes some us long. Aren't using the flowpin option so don't need SEROUT2. Am satisfied with the results. Still wanted to understand the source and role of the qualifier "A".