Jump to content


  • Content Count

  • Joined

  • Last visited

About meet

  • Rank

Profile Information

  • Location
  1. That's so clever. Now I understood how to use IRQ properly and how is the logical coding structure to transceive and receive data efficiently with less power. I'm really appreciated of your help. Hope someone else besides me will benefit from all these explanations. Best regards spirillis. And about the side note, there is a topic about it. Here is a quotation; If you will be using low power modes, I recommend going into the Energia "cores" folder, finding the file WInterrupts.c, and adding the command "LPM4_EXIT;" to the end of each of the interrupt handlers in that file. This will g
  2. That's so cool, what I really needed to lower power consumption. And the thing you mentioned about IRQ on the receiver part, can you make it clear if you have time. Thanks a lot spirillis.
  3. Yes, before it was like you described (stop if you only remove power from the TX side). But with the new code I tried it and it's fixed. Thanks again. I found deepsleep on your library, and used it before LPM4 line inside void loop(), and it works fine. I wonder what deepsleep realy do? I'm just trying to lower power consumption. And still wondering about IRQ you mentioned above. if (pir_flag == FALSE) { void deepsleep();// here it is LPM4; } }
  4. By the way, LPM4_exit gives the error "was not declared on this scope". And I think it's a must to use it to start void loop() and check if flag is TRUE. edit: I used __bic_SR_register_on_exit(LPM4_bits) and it's solved. PIR node works perfectly! My question about the IRQ is still valid
  5. I was thinking that you didn't write a response of my last post, I just find it out now. That codes make it all clear now, it's so explicit and very simple but incisive. Thanks for your guide, I'm going to apply this method to my nrf sensor nodes and hope it will work About the IRQ, is that something I need to use when I received data and want to close the connection with the transceiver pair? Because I observe that when TX sends data to RX, it latched connected each other(I prove that with powering rf on/off) and I don't know how to disconnect them. My code for RX is below; #i
  6. Reminder! Check your J3 jumpers placement if you can't read temp. and hum. values with serial monitor. Here is a guide from Energia on Github; https://github.com/energia/Energia/wiki/Hardware
  7. I would do if I know how to do, but clearly I don't know how. Maybe it's a simple thing for you but I don't have enough information about it and that's why I'm asking here, to improve my knowledge. Maybe you can help more clear to me. Thanks a lot.
  8. Actually this loop things in energia confuse me, I can't use it efficiently. Another thing, it seems like TX radio sends continuosly data when triggered inside the interrupt vector, how can I make it stop ? #pragma vector = PORT1_VECTOR __interrupt void A(void){ P1IFG &= ~BIT4; radio.print(str_on); radio.flush(); // Force transmit (don't wait for any more data) delay(1000); // sends data continuously, I want to stop it.
  9. I fixed it, now it works but I can't run radio.begin inside the interrupt vector. It's working when it's defined on setup(), but as you said it means that radio is not sleeping. I can get the radio connection with code below, my PIR sensor trigger P1_4 and this cause interrupt fires, inside the interrupt vector I use the radio.print to send data to always wakened receiver. receiver read this data and blink a led. It works. // TX part #include <Enrf24.h> #include <nRF24L01.h> #include <string.h> #include <SPI.h> Enrf24 radio(P2_0, P2_1, P2_2); // P2.0=CE, P2.1=CS
  10. Thanks a lot! Input pullup doesn't mean anything but boolean state made it works.
  11. Ohh sorry for that, sure. I'm going to solve this problem and come back if I can't settle the radio things
  12. I'm new on energia, and just trying to use interrupt with an external stimulus. I'm using PIR sensor on P1_4 to fire the interrupt flag and light the red led on launchpad but my code doesn't work; //PIR input on port P1_4 volatile int state = LOW; void setup() { pinMode(P1_4, INPUT); pinMode(RED_LED, OUTPUT); attachInterrupt(P1_4, A, RISING); } void loop() { digitalWrite(RED_LED, state); } void A(){ state = !state; } Also, I want to add LPM on this code but I'm not sure where to add it. Thanks in advance.
  13. That's strange, I tried the code below and it doesn't work //PIR input on port P1_1 volatile int state = LOW; void setup() { pinMode(P1_1, INPUT); pinMode(RED_LED, OUTPUT); attachInterrupt(P1_1, A, RISING); } void loop() { digitalWrite(RED_LED, state); } void A(){ state = !state; } I checked the output pin of PIR and see that it give 3.4V when motion detected, so PIR is working. But I can't get P1_1 read this voltage and fire its flag to blink the red led on launchpad.
  14. Thanks for all your explanations. No, my code doesn't work, that's why I'm asking here any help
  15. The code above was for the transmitter one, and the receiver is ready all the time for any data, there is no need to sleep the receiver node actually. But my code above, doesn't work. While waiting, the mcu is in LPM4, and I defined an interrupt when the PIR sensor stimullate P1_1 pin. So, it should wake up and process the codes inside void pir() I gues but it doesn't. Another question, in the void setup() we have radio.begin(). What exactly do this code? I mean, before radio.begin, is nrf sleeping or something like that? If it's, maybe I should use it inside the void pir() and awake nrf
  • Create New...