It runs off a 27mhz clock, it assumes until a byte is coming in the signal is high, then goes low when the startbit comes in.
uartf is the uart flag, which goes high when byte start to come in, it counts 3800 clock ticks to skip the start bit and pick up the first data bit, then every 2812 ticks it grabs another bit until its gets all 8.
bitstreamin[9]<=bitstreamin[8];
bitstreamin[8]<=bitstreamin[7];
bitstreamin[7]<=bitstreamin[6];
bitstreamin[6]<=bitstreamin[5];
.........................................
When the 8 bits are in, the second part puts the byte on the bitqueu, shifting the bitquee by 8 bits to make room for the new byte
bitqueu<=bitqueu << 8;
// shifting queu left 8 bits to make space for new byte
I started this project with a copernicus breakout board I got from Sparkfun that one night just quit on me, to use this code you would have to recalcuate the bitcounts, the Copernicus use 4800 bits per second (baud), the Venus one I am using now uses 9600 baud.
I have this kind of working, but it needs more work after I finish my PCB design. Please let me know if you try my code, Im curious if you get fewer glitches then me.