Quantcast
Channel: Wireless Connectivity
Viewing all articles
Browse latest Browse all 116964

Forum Post: RE: CC2531 and CC2530 manufacturing ID

$
0
0

Al McBride :

     yes i am at +6 GMT . i am using CC2530 .My application is Telemetry , iSending Specific Commands From Arm7(LPC2136) via cc2530(As a RF Transceiver ) to another

cc2530 which is attached to meter end . Now my task is to use sleep timer at meter end cc2530 which have to wake after every hour communicate with meter and send data back to Arm7(LPC2136) via another cc2530

Two solutions

1)External interrupt wake up but for that i have to remain on my reciever which consume power

2)sleep timer ,,which wakes up cc2530 after every hour communicate and sleep

Its Working now i wake it up every 5 second and then sleep

#include <ioCC2530.h>

unsigned char volatile __xdata *ptr;
unsigned char firstbyte[8];
void Delay(){

unsigned int k;
for(k=0; k<65535; k++);
}


void SendChar1(unsigned char Get){

U1DBUF=Get;
while(!UTX1IF);
UTX1IF = 0;

}

void Serial_Int()
{



CLKCONCMD=0x00;

U0CSR |= 0x80; //UART mode selected for USART0.

U1CSR |= 0x80; //UART mode selected for USART0.

// U0UCR &= ~0x40; //H/w flow control disabled.

PERCFG &= ~0x01; //Alernative 1 selected for UART0 peripheral.

PERCFG |= 0x02; //Alernative 1 selected for UART0 peripheral.

P0SEL |= 0x0C; //P0.2 and P0.3 peripheral mode enabled.

P1SEL |= 0xF0; //P0.2 and P0.3 peripheral mode enabled.

// P1SEL &= ~0xF0;

U0GCR |= 0x08; U0BAUD = 0x3B; //Baud rate set to 9600 bps.


U1GCR |= 0x08; U1BAUD = 0x3B; //Baud rate set to 9600 bps.


}


static void SleepTimerInit(void);
unsigned char i,j;
int main (void)
{



P0DIR=0x03;
i=0;
j=0;

P0_0=0;
P0_1=0;
Serial_Int();

SleepTimerInit();


SLEEPCMD |= 0x06; // Setting power mode 2
PCON |= 0x01; // Enable power mode

while (1){

Delay();
P0_0=0;

Delay();
Delay();
Delay();

Delay();
Delay();
Delay();
P0_0=1;


PCON |= 0x01; // Enable power mode

}



}


static void SleepTimerInit(void)
{

unsigned long sleeptime = 0;

sleeptime |= ST0;
sleeptime |= (unsigned long)ST1 << 8;
sleeptime |= (unsigned long)ST2 << 16;


sleeptime += ((unsigned long)5 * (unsigned long)32753);

/* set sleep timer */
while((STLOAD & 0x01) == 0); // wait before ST0. STLOAD.LDRDY is 0 during the load
ST2 = (unsigned char)(sleeptime >> 16);
ST1 = (unsigned char)(sleeptime >> 8);
ST0 = (unsigned char) sleeptime;
STIE=1;


// IRCON |= 0x80;
IEN0 |= 0x20;
EA = 1; // Enable global interrupt

PCON=0X01;//go to sleep
}


#pragma vector=ST_VECTOR

__interrupt void sleeptimer_int()

{

unsigned long sleeptime = 0;
STIF = 0; //clear interrupt flag



sleeptime |= ST0;
sleeptime |= (unsigned long)ST1 << 8;
sleeptime |= (unsigned long)ST2 << 16;


sleeptime += ((unsigned long)10 * (unsigned long)32753);

/* set sleep timer */
while((STLOAD & 0x01) == 0); // wait before ST0. STLOAD.LDRDY is 0 during the load
ST2 = (unsigned char)(sleeptime >> 16);
ST1 = (unsigned char)(sleeptime >> 8);
ST0 = (unsigned char) sleeptime;

P0_0=0;

Delay();
P0_0=1;

Delay();
Delay();
Delay();

}


Viewing all articles
Browse latest Browse all 116964

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>