Hi!
=============================================
The PicBasic Pro SERIN2 command has an optional
flow control pin. The SERIN2 command does this
handshaking flow control on a byte by byte basis.
Some computers may send several bytes before
they even check the status of their handshaking lines.
==============================================
The idea below does not use the flow control pin.
Define first the data frames.
START character
The start character is present only one time in
the data frame. (The first byte). If you use
Notepad, the START character has to be printable.
END character
The end character is present only one time in
the data frame. (The last byte). If you use
Notepad, the END character has to be printable.
DUMMY character(s)
The DUMMY character is present one or more times
in the data frame. The frame can have
from 0 to 42 DUMMY characters.(See example below).
If you use Notepad, the DUMMY characters need to
be printable.
DATA character(s)
Any value except the values used for the
START, END and DUMMY characters.
The frame can have from 1 to 40 DATA
characters. If you use Notepad, the DATA characters
need to be printable.
When you choose the character for START, END
and DUMMY, choose characters that you will never
use in the DATA characters. Maybe one day you
will send DATA to an LCD display, so don't
waste useful ASCII characters.
* * *
Example data frames in a Notepad file:
S = Start character
X = DATA character(s)
E = END character
D = DUMMY character(s)
<START><DATA><DUMMY><END>
The DUMMY character(s) is (are) used only if
DATA is less than 40 bytes or if you need
to send DUMMY data frames to the PIC.
While the PC sends out the dummy data frames
the PIC has time to do something else.
(Remember we don't use any flow control).
The following 5 lines are the Notepad file:
SXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXE
SXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXDE
DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD
SXXXXXXXXXXDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDE
SXDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDE
Where:
The first line is a data frame with 40 bytes of data.
The second line is a data frame with 39 bytes of data.
The third line is a dummy frame.
The fourth line is a data frame with 10 bytes of data.
The fifth line is a data frame with 1 byte of data.
* * * *
At 9600 baud the PC sends 960 bytes per second.
(Terminal 8N1, raw ASCII file send).
The data frames are always 42 bytes long plus the
two bytes that Notepad will put at the end of
each line. (CR and LF).
To send out 44 bytes the PC will need 46 ms
at 9600 baud.
* * *
If the above idea is compatible with your design, I will
help you with the PicBasic Pro code.
Best regards,
Luciano
Bookmarks