Hello!
For your info, TI provides some documentation (see link below), on the first
page or which I read: Source code available for MSP430.
Therefore, there are high chances that what you want to do is already developed
somewhere.
https://focus.ti.com/lit/ds/symlink/trf7960.pdf
Beside this, as a long time MSP430 user, I can tell you that basically almost
EVERYTHING you want to program is ALREADY DEVELOPED and provided as a
source code that you have to fine tune for your specific needs.
Now for your specific request:
1. Enabling TRF7960 chip using MCU
I suppose the enable signal is active low.
#define TRF_ENABLE 0x01 // P1.0
First, set P1.0 to output mode:
P1DIR |= TRF_ENABLE;
Then, you may want to define a function for enable / disable:
void TRF_Enable(uint8 e) {
if(e) P1OUT &= ~TRF_ENABLE;
else P1OUT |= TRF_ENABLE;
}
2. Setting IRQ as High edge triggered
What do you mean by high edge? When the signal starts from high
or when the signal goes to high?
I will suppose you mean falling edge (i.e. the signal starts from high).
Setting P2.1 to falling edge:
P2IES |= 0x02;
Activating interrupt of P2.1:
P2IE |= 0x02;
Waiting for interrupt:
_EINT();
Then in the interrupt function:
#pragma vector=PORT1_VECTOR
__interrupt void SwitchesInput(void) {
DoInterruptProcessing();
P2IFG &= ~0x02; // Re-arm the interrupt
}
3. Setting P4 as O/P port
What do you mean by O/P?
Dora.