Search code examples
serial-portsimulator8051baud-rate

How to `cat' file in a specific baud?


I'm using uCsim to do unit test on SDCC projects.

In uCsim/S51, you can simulate serial line traffic by

s51 -s /dev/tty PROGRAM.ihx

or

s51 -S in=testdata.in,out=testdata.out PROGRAM.ihx

In the latter form, the data is immediately sent to the simulator which causes a lot of frames are lost. So instead of given the test data in plain file, using pipe instead:

s51 -S in=<(cat testdata.in),out=testdata.out PROGRAM.ihx

Now, how can I control the output baud from the `cat' utility? Or is there another utility I can use to output bits in a specific rate?


Solution

  • Answer 1 is incorrect. Nobody "feeds" file's content to serial line. uCsim reads fromthe file when it is necessary. Baud rate is controlled by SFRs of timer and uart. When necessary count of ticks are simulated, one byte will be read from the file.