Search results

  1. foTONICS

    Wireless trigger for LEDs and buzzers

    Thanks a lot for the help, tips, and expertise; I will apply these changes tomorrow when I have some free time. Then it's on to the transmitter! I have a feeling the transmitter will go a lot smoother since I spent all this time with the receiver learning how the NRF works
  2. foTONICS

    Wireless trigger for LEDs and buzzers

    Okay, I think I've finally finished coding everything for the receiver. // THIS CODE IS INTENDED FOR USE WITH A NRF24L01 USED AS A PRIMARY RECEIVER #include <pic16f627a.h> //needed for MACRO descriptions of config and pins #include <stdint.h>//needed for uint8_t #include <xc.h>//this header is...
  3. foTONICS

    Wireless trigger for LEDs and buzzers

    I found in the NRF datasheet(p.53) it says that the microcontroller needs to write a '1' to the IRQ source bit in the status register in order for the IRQ pin the release control. So it looks like I will need to write to the NRF twice whenever it has data that needs to be processed. Good thing I...
  4. foTONICS

    Wireless trigger for LEDs and buzzers

    I was just looking at the function you wrote and in this line: PORTAbits.RA3 = (txdata > 127); // Copy bit 7 of txdata to RA3 (MOSI) I've never seen an argument like this before, wish this was something my professors taught me, very useful. Can you apply this to select out certain bits, like...
  5. foTONICS

    Wireless trigger for LEDs and buzzers

    I mean I guess we could just poll that one pin repeatedly to see if the NRF has pulled it low and not worry about an interrupt at all
  6. foTONICS

    Wireless trigger for LEDs and buzzers

    P.44 of the PIC's datasheet clears things up a little I think. It says that any read of a pin reads the entire port
  7. foTONICS

    Wireless trigger for LEDs and buzzers

    So if I wanted to transmit I would call it like this: spi_txrx_byte(txdata); and if I wanted to receive data I would call it like this? receive_data = spi_txrx_byte(txdata);
  8. foTONICS

    Wireless trigger for LEDs and buzzers

    It's amazing how much the readability is improved with indentation
  9. foTONICS

    Wireless trigger for LEDs and buzzers

    The NRF expects an instruction byte first, as you shift in the instruction byte it simultaneously shifts out it's status register. After that if I'm reading I shift in garbage while it shifts out what I want, if I want to write I send it data and ignore what it sends back. I don't think I will...
  10. foTONICS

    Wireless trigger for LEDs and buzzers

    Alright so here is the new main(void) with an if statement that polls the interrupt flag: while(1) { if (INTCONbits.RBIF==1)// poll the int flag to see if the NRF has data that needs to be processed { PICin=0;//buffer used to load data from the NRF...
  11. foTONICS

    Wireless trigger for LEDs and buzzers

    Do you mean I don't even need an ISR, just poll the bit flag in the appropriate register, or that I don't need to have a bit flag in the ISR? If I leave the ISR without clearing the interrupt flag won't I just start back at the beginning of the ISR? That's a good idea about keeping the ISR...
  12. foTONICS

    Wireless trigger for LEDs and buzzers

    So now that I have, what I assume is working code so far, I need to work on the ISR. The NRF has an IRQ pin that goes low whenever the NRF receives valid data. I have connected this pin to the PIC's RB7 pin which I have configured for an interrupt on change so that when the NRF pulls its IRQ pin...
  13. foTONICS

    Wireless trigger for LEDs and buzzers

    I'm using the internal oscillator inside the PIC, so about a 1us instruction clk
  14. foTONICS

    Wireless trigger for LEDs and buzzers

    I'm writing the updated code as per your coding suggestions now, it's going to make the entire thing so much compact and cleaner looking. One thing I've thought of is will there be any timing issues with putting a value on the MOSI pin then the very next instruction bringing the SPI CLK high. I...
  15. foTONICS

    C vs C++ with uControllers

    First of all I feel I should let everyone know that this is directly related to the thread where I talk about using a PIC to interface an NRF24L01, here is the link: https://www.electronicspoint.com/threads/wireless-trigger-for-leds-and-buzzers.262731/page-5#post-1608543 I'm using a PIC16F627A...
  16. foTONICS

    Wireless trigger for LEDs and buzzers

    Also, when you're making the LSB of bytevalue onto RA3 that won't mess with any other bits on PORTA right?
  17. foTONICS

    Wireless trigger for LEDs and buzzers

    Yes that does look more efficient. When I first started I tried an array of bits but it wouldn't compile. So just to double check. If I wanted to shift in a variable called NRF_config, I would call the above function like this: Void shiftout(NRF_config); The function would then take the...
  18. foTONICS

    Wireless trigger for LEDs and buzzers

    Hey guys, I've done a little clean up of my code and I think I'm really close to getting a link up and running. Since I'm mediocre at coding I may have made a mistake when it came to passing the address of a variable to a function that assigned that address to a pointer. Here is what I have so...
  19. foTONICS

    C vs C++ with uControllers

    Hey all, I love programming uControllers and for the most part I use C. The other day while chatting with a friend he asked me if I program in C or C++. Now I have to admit I didn't know the difference between the two. I did some research and from what I found C in a top-down approach and is...
  20. foTONICS

    sniffing with a sniffer

    it's a spectrum analyzer that we borrowed, last thing I want to do is fry the input stage :eek:
Top