Skip to content
Dustin edited this page Mar 12, 2019 · 2 revisions

serial-cache-setup setups a cache, which scan through serial data and look for given characters at beginning and end and saves the middle parts. The reason is that rs232 communication protocol often define a start and end character so this generic cache system can capture such delimited messages.

Parameter Description
dev Serial device obtained from rs232-try
char1 Starting character to look for in the serial data
char2 Ending character to look for in the serial data

Example

Example 1: Setup serial cache which captures strings starting with # and ending with newline

(serial-cache-setup dev #x23 #x0A)

Example 2: Setup serial cache which starts with a number (ASCII 48-57) and ends with newline

(serial-cache-setup dev (lambda (l) (if (fx>= l 48) (fx<= 57))) #x0A) 
Clone this wiki locally