Quantcast
Channel: MSP low-power microcontroller forum - Recent Threads
Viewing all articles
Browse latest Browse all 21927

MSP430F1611: Comparing value with timer value and synchronise.

$
0
0

Part Number:MSP430F1611

Dear all,

Due to your contribution, I have made some huge progress and I am reaching to my milestone that I have set.

I have a timer to increment every 237 ticks, which is stored as app_vars.num_asn, and every approximately 6seconds the app_vars.num_asn will print its corresponding count number.

Now, I have another value app_vars.ASN;representing a type of sequence number retrieved from network, and stored as uint64_t.

app_vars.num_asn should always be referred back to app_vars.ASN and synchronise to this number, if app_vars.num_asn - app_vars.ASN > 15  || app_vars.ASN - app_vars.num_asn > 15.

I got upto app_vars.num_asn  printing its corresponding count number and compare with app_vars.ASN, and if they are not equal to each other all of my led will turn on and be equalise to app_vars.ASN.

Looking at the function below, it should also then turn all LEDs off because initially the counter will always be smaller than the value of app_vars.ASN, however, it doesn't.

void cb_asnread(void){

app_vars.num_asn++;
if ((app_vars.num_asn % 885 ) == 0 ){
uart_writeByte(app_vars.num_asn);
while (app_vars.num_asn != app_vars.ASN){
leds_all_on();
if(app_vars.num_asn < app_vars.ASN){
leds_all_off();
app_vars.num_asn = app_vars.ASN;
}

//app_vars.num_asn = app_vars.ASN;
//leds_all_off();
}
}
}

Codes are attached in this post. 01bsp_radio_rx  is the main code.

Any help will be greatly appreciated!

Happy New year to all!

Thank you.

(Please visit the site to view this file)

(Please visit the site to view this file)

(Please visit the site to view this file)


Viewing all articles
Browse latest Browse all 21927

Trending Articles



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