Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
11/09/05 12:47
Read: times


 
#103467 - output != input
Responding to: ???'s previous message
XBR0 = 0x15;
XBR2 = 0x44;
correctly puts UART0 at P0.0 and P0.1, SMBus at P0.2 and P0.3, UART1 at P0.4 and P0.5 and CEX0, CEX1 at P0.6 and P0.7.

P0MDOUT = 0x11;
makes TX0 and TX1 push-pull, the rest is open-drain a.k.a. input.

PCA0CPL0 = (0xff & PWM); // initialize PCA compare value
PCA0CPH0 = (0xff & (PWM >> 8));
This is useless. You would want to read PCA0CPL0/PCA0CPH0 instead of writing them here. They are where your measurement ends up.

PCA0CPM0 = 0x4D; // CCM0 in High Speed output mode
High speed output is as it says an output mode. It toggles the CEX0 pin when a match occurs i.e. PCA0 == PCA0CP0. It also generates an interrupt at that moment so you can update PCA0CP0.

You need PCA0CPM0 = 0x31;
This captures the PCA0 counter in PCA0CP0 at the moment of an edge transition on input CEX0.

In the ISR:
pulseWidthx = xVal1 - xVal2;
will give a negative pulsewidth.

List of 9 messages in thread
TopicAuthorDate
PWM            01/01/70 00:00      
   for the PCA            01/01/70 00:00      
      pulse width            01/01/70 00:00      
         input or output ?            01/01/70 00:00      
            input            01/01/70 00:00      
               output != input            01/01/70 00:00      
                  ISR            01/01/70 00:00      
                     CEX1            01/01/70 00:00      
   Tilt sensor            01/01/70 00:00      

Back to Subject List