After searching your forum I haven't been able to come up with anything that fits my predicament. I'm hoping one of you experts can point me in the right direction.
I'm working on removing jitter from a clock that connects to a PC through an ISA bus. The system in question was designed and built around 18 years ago and all of the designers have since retired. At the moment we have around 6 us of jitter in the clock, but since we're using it to synchronise data collection at a wide variety of points across Canada (synched to a GPS time signal) it needs to be even better.
We've managed to track the jitter to a simple loop that basically waits for an interrupt. Because the interrupt can happen at any time during the loop and on any instruction, there are around 4 cycles of variablility (at approx 1.61 us / cycle). To remove this jitter all I need to do is synch the entry into that loop with a known instruction cycle. I can access a free running counter to determine the current cycle, but that takes time. Ideally I'd determine how many cycles I need to count, subtract the overhead from the calculation, and then count out that number. However, I can't come up with a way to count out a variable number of cycles that is accurate to the cycle. For instance, if I used a simple loop like
LOOP
DEC X
BNE LOOP
to count out X cycles I'd still be working with a 3 cycle delay every time I hit the branch. To my thinking that means my loop can only count in multiples of 4 instruction cycles. Is there a simple way of counting out an exact (but variable) number of instruction cycles?
The system we're using runs a Hitachi HD6303X microprocessor and I've been using a WinTek compiler. The interrupt I'm waiting for is an output compare interrupt triggered when the free running counter equals the output compare register. I tried briefly to use the WAI command to simply wait for the next interrupt but I'm not sure if it only waits for a hardware interrupt or if the OCI will successfully trigger it.
I know this message is really long winded but I wanted to give as much info on my problem as I could. Also no, this isn't a school project, but if anyone here has helpful information I'd be more than willing to assign them a mark based on just how helpful they were.
Thanks to anyone who reads this whole thing, and double thanks to anyone who tries to help.
-Nate
I'm working on removing jitter from a clock that connects to a PC through an ISA bus. The system in question was designed and built around 18 years ago and all of the designers have since retired. At the moment we have around 6 us of jitter in the clock, but since we're using it to synchronise data collection at a wide variety of points across Canada (synched to a GPS time signal) it needs to be even better.
We've managed to track the jitter to a simple loop that basically waits for an interrupt. Because the interrupt can happen at any time during the loop and on any instruction, there are around 4 cycles of variablility (at approx 1.61 us / cycle). To remove this jitter all I need to do is synch the entry into that loop with a known instruction cycle. I can access a free running counter to determine the current cycle, but that takes time. Ideally I'd determine how many cycles I need to count, subtract the overhead from the calculation, and then count out that number. However, I can't come up with a way to count out a variable number of cycles that is accurate to the cycle. For instance, if I used a simple loop like
LOOP
DEC X
BNE LOOP
to count out X cycles I'd still be working with a 3 cycle delay every time I hit the branch. To my thinking that means my loop can only count in multiples of 4 instruction cycles. Is there a simple way of counting out an exact (but variable) number of instruction cycles?
The system we're using runs a Hitachi HD6303X microprocessor and I've been using a WinTek compiler. The interrupt I'm waiting for is an output compare interrupt triggered when the free running counter equals the output compare register. I tried briefly to use the WAI command to simply wait for the next interrupt but I'm not sure if it only waits for a hardware interrupt or if the OCI will successfully trigger it.
I know this message is really long winded but I wanted to give as much info on my problem as I could. Also no, this isn't a school project, but if anyone here has helpful information I'd be more than willing to assign them a mark based on just how helpful they were.
Thanks to anyone who reads this whole thing, and double thanks to anyone who tries to help.
-Nate