packetin(inString, // String to be parsed sfr, // SFR to be injected append); // boolean, if false, clear previous packets packetin(inString, RCREG, true);
inString is a String variable with the data to be parsed. The data can be in two different formats, white space delimited hexadecimal values, or strings of characters. The string is often read in from a file.
06F 3FE 45 FFFE
"The quick brown fox."
The sfr is just the Special Function Register that will receive the injection values.
append is a boolean specifying whether previously parsed data is kept or discarded.
To understand what append does it is useful to know that packetin() was implemented to support register injection to the UART receive register RCREG. Moreover, that injection to RCREG is not on-demand. Instead the UART peripheral simulation determines when the next injection should occur, based on baud rate. So it is possible that some data values have not been injected yet when new data values are parsed by packetin. UART developers wanted to be able to simulate missed data packets. This is accomplished by setting append to false, causing the previous data values, not yet injected values to be thrown away before the new values are parsed.
Remember that packetin() is not limited to RCREG injection, and that all other SFRs are injected on-demand.