02-20-2007 12:30 PM
02-20-2007 01:30 PM
Actually in your case the first data bit is only high for 10 us before it starts into the second data bit, but you can't tell the difference from the scope.
The reason is that the Loop Timer function does not create any delay on its first call. It simply sets an internal timestamp and then returns immediately. On all following calls it delays the program until the right amount of time has elapsed. However since you have the update of the data line in the same sequence frame as the Loop Timer, the data line is updated immedaitely, before the Loop Timer is done.
To fix this problem you can combine the update of the data line with the first update of the clock line. In your current code, move the update of the data line into the second frame of the sequence and it will work correctly. Make sure the Loop Timer function is by itself in the first frame of the sequence.