techtravels.org

new read routine implementation started

Last night, until 3am, I spent redoing my read routine to incorporate the method discussed in the comment of the last post.

Basically, I use the time between the pulses as an indication of the data.  I store 2-bit tokens in memory to indicate the data.  I store (2) 3-bit tokens if the time between pulses was too short, or too long.

Using tokens saves me memory, memory write time, and transfer time.  In the best case, I save 50%.  In the worst case, I’m even-steven.  I don’t lose anything.

With idea help from some people at work, I’ve come up with a routine that de-tokenizes the data on the PC.  The PC now is going to be handling the byte-sync again.  I want the SX to do it, but I’ll have to compute the tokens, and then sync to the tokens.  This is down the road.  For the time being, the PC can handle it.

The routine more or less works right now — but there are some bugs in my code.  It is properly counting the time between pulses, and storing the right tokens, and increasing the bit-counter.  But it’s in a neverending loop, so something is not right.

I originally started using the edge detection register, but it was occassionally double-detecting the pulses.  So I changed it to wait for a high, then wait for a low.  This ensures that there is a complete return to high before another negative pulse detected.  I looked at this on a scope, and it’s much better than the previous method.  The one benefit that I lose, however, is that the edge detection register will detect pulses even when I’m off busy doing other things.  I’m not worried about this right now — but I may revisit in the future and add some type of low-pass filter and start using the edge detection register again.

This is first time in awhile that I hooked everything back up again, and played with the actual hardware.  Man, it was a lot of fun!  I miss this stuff.  I actually have spent a lot of time thinking about the problem, and I have recently spent some time writing some Java code —- so I haven’t been completely removed or completely stagnant on everything.  But getting the hardware out is really cool.

keith

Amateur Electronics Design Engineer and Hacker

Add comment