EmbeddedRelated.com
Forums

Timer Output Unit Access

Started by curlinou January 8, 2009
Hello All.

Sorry for my poor english.

I use TimerA for Hardware Clock Generation.
- P1.3 is set in output mode
-(TimerA CCR2 Block) OUT2 Signal drives the Pin

For communication purpose I need to know the state of this Pin (Low/
High). I have P1.2 available. I could link P1.3 to P1.2.

Is there another way to know P1.3 state ?

Beginning Microcontrollers with the MSP430

Is this just for debugging your code?
You can use an oscilloscope to look at the waveform of P1.3.
If you can single step the code, you can even use a voltmeter.

Like you said, you can link P1.3 to P1.2 and program P1.2 as an input
to watch the output of P1.3. But you will need to write more code to
do that. Writing new code to debug existing code may not be very
productive.

--- In m..., "curlinou" wrote:
>
> Hello All.
>
> Sorry for my poor english.
>
> I use TimerA for Hardware Clock Generation.
> - P1.3 is set in output mode
> -(TimerA CCR2 Block) OUT2 Signal drives the Pin
>
> For communication purpose I need to know the state of this Pin (Low/
> High). I have P1.2 available. I could link P1.3 to P1.2.
>
> Is there another way to know P1.3 state ?
>

Remember to also set bit 3 of P1SEL.
I'm not 100% sure, but I think you can use PxIN to know the value
present at an output pin when it is not controlled by PxOUT.
Try it and let us know if it works.

Regards,
Michael

--- In m..., "curlinou" wrote:
>
> Hello All.
>
> Sorry for my poor english.
>
> I use TimerA for Hardware Clock Generation.
> - P1.3 is set in output mode
> -(TimerA CCR2 Block) OUT2 Signal drives the Pin
>
> For communication purpose I need to know the state of this Pin (Low/
> High). I have P1.2 available. I could link P1.3 to P1.2.
>
> Is there another way to know P1.3 state ?
>

Have you looked at the CCI bit in the TACCTL2 register? I believe that
will work, but I could be wrong in compare mode. I know it works in
capture mode and the bit description says capture/compare.

BTW, your English is fine...

Dave

--- In m..., "curlinou" wrote:
>
> Hello All.
>
> Sorry for my poor english.
>
> I use TimerA for Hardware Clock Generation.
> - P1.3 is set in output mode
> -(TimerA CCR2 Block) OUT2 Signal drives the Pin
>
> For communication purpose I need to know the state of this Pin (Low/
> High). I have P1.2 available. I could link P1.3 to P1.2.
>
> Is there another way to know P1.3 state ?
>

CCI means Capture/Compare INPUT.
A quick look at Timer_A Block Diagram can tell you it's of no use to
know the state of the comparator output unit.

Michael K.

--- In m..., "desertrc_tucson" wrote:
>
> Have you looked at the CCI bit in the TACCTL2 register? I believe that
> will work, but I could be wrong in compare mode. I know it works in
> capture mode and the bit description says capture/compare.
>
> BTW, your English is fine...
>
> Dave
>
> --- In m..., "curlinou" wrote:
> >
> > Hello All.
> >
> > Sorry for my poor english.
> >
> > I use TimerA for Hardware Clock Generation.
> > - P1.3 is set in output mode
> > -(TimerA CCR2 Block) OUT2 Signal drives the Pin
> >
> > For communication purpose I need to know the state of this Pin (Low/
> > High). I have P1.2 available. I could link P1.3 to P1.2.
> >
> > Is there another way to know P1.3 state ?
>
Sorry for this late answer
No this is not for debug purpose.

I need to communicate with (some kind of I2C) peripherals.
(www.screenkeys.com)

I first generate the clock by software (Timer A Interruption , drives
output Pin), and send datas in this interrupt. (when clock signal is
high)
But with 8 Mhz c Clock, I reached limit. (near 80 instuctions in
interrupt)

Now Clock is generated with hardware, and I reduce the interrupts
instruction to the minimum. I had to link clock signal to input Pin ,
to generate interrupt.
(Well I guess i could have used Timer Interrupt too)

Thanks for you answers

You said:
"I had to link clock signal to input Pin, to generate interrupt."

And next, you said:
"(Well I guess i could have used Timer Interrupt too)"

There you go. You answered your own question. You do not need to link
clock signal to input pin. Timer Interrupt is actually better any you
do not need to waste another pin.

--OCY

--- In m..., "curlinou" wrote:
>
> Sorry for this late answer
> No this is not for debug purpose.
>
> I need to communicate with (some kind of I2C) peripherals.
> (www.screenkeys.com)
>
> I first generate the clock by software (Timer A Interruption , drives
> output Pin), and send datas in this interrupt. (when clock signal is
> high)
> But with 8 Mhz c Clock, I reached limit. (near 80 instuctions in
> interrupt)
>
> Now Clock is generated with hardware, and I reduce the interrupts
> instruction to the minimum. I had to link clock signal to input Pin ,
> to generate interrupt.
> (Well I guess i could have used Timer Interrupt too)
>
> Thanks for you answers
>