Hi,
I am using CC2431 Evaluation modules for measuring external frequency
I am using Port 0 for UART and Port 1 pin 0 for channel 2 timer 1/counter capture
I am unable to get any value in T1CC2L and T1CC2H
my code is as follows -->
#include<cc2431.h>
#include<string.h>
#include<math.h>
#include<stdio.h>
char OM[12];
//int h=0;
void delay()
{
int i;
for(i=0;i<30000;i++)
{}
}
void event()
{
int a,b,c,i,j;
float h;
//T1CTL=0x00;
T1CCTL2=0x7B;
delay();
//while(!(T1CC2H=0));
//
if((IRCON=0x02))
{
while(!(T1CTL=0x80));
while(!(P1IF=1));
a=T1CC2L;
b=T1CC2H<<8;
c=a|b;
//c<<=8;
/* U0DBUF=T1CC2H;
U0DBUF=' ';
U0DBUF=T1CC2L;*/
//U0DBUF=c;
h=(1.0*c);
j=sprintf(OM,"%f",h);
for(i=0;i<=j;i++)
{
U0DBUF=OM[i];
delay();
}
U0DBUF=0x0D;
U0DBUF=0x0A;
}
}
void main()
{
delay();
U0GCR=0x08;
U0BAUD=59;
U0CSR=0xC0;
P0SEL |=(1<<3)|(1<<2);
P0DIR =(P0DIR&0x06)|0x04;
PERCFG=0x40;
P1SEL |=0x01;
//P1DIR=0xFE;
P1IEN=0x01;
PICTL=0x00;
UTX0IF=0;
IEN2|=0x0D;
SLEEP &=~0x04; //SLEEP & CLCKCON is oscillator select
CLKCON =0x80;
while(1)
{
event();
}
}
Please reply to my situation