Pic 18F24k22 wireless data transfer.

Discussion in 'The Projects Forum' started by Dodgydave, Apr 27, 2014.

  1. Dodgydave

    Thread Starter Distinguished Member

    Jun 22, 2012
    4,977
    744
    I have built a weather station in the attic, works great displays seven segment four digits,in temp, windspeed, airpressure.
    So i want to make another to display the same, do i



    1, just make another pcb, chip etc.?

    2, can i add a wireless transmit/reciever and send the data to the additional displays that will also use the same pic.?

    3, run a cable from attic to second displays and use I2c, serial, usb, or other data transfer method.?

    4, use a diferent pic?


    datasheet
     
    Last edited: Apr 28, 2014
  2. DickCappels

    Moderator

    Aug 21, 2008
    2,650
    632
    Yes to all of the above.

    Can you post the manual for the weather station or post a link to documentation so we can see what provisions if any they made for sending the data to remove displays?
     
  3. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,386
    1,605
    LOL... yep, yes to all.

    A wire between displays is inconvenient, my preference would be for wireless. There are some inexpensive modules out there, but I am unsure about shipping to the UK. Sparkfun has several, and I've seen similar (identical?) units on EBay/China for less.
     
  4. Dodgydave

    Thread Starter Distinguished Member

    Jun 22, 2012
    4,977
    744
    The pic uses the A/D for temp and airpressure, so uses ADRESL/ADRESH files saved(4 files intotal)

    The wind speed uses TMR1L/TMR1H

    a total of 6 (8bit) files to be transmitted, the reciever can do the calculations and displays, i would prefer to send it wireless, maybe itsnot possible so may needto hardwire and use Usart, or I2C need help ??
     
    Last edited: Apr 28, 2014
  5. xtoffer

    New Member

    Sep 30, 2013
    15
    1
    Dodgydave likes this.
  6. THE_RB

    AAC Fanatic!

    Feb 11, 2008
    5,435
    1,305
    You can just connect the PIC UART directly to those cheap 433MHz RF modules and use 1200 baud serial. You need one TX module and one RX module.

    There is some info on doing that here;
    http://www.romanblack.com/RF/cheapRFmodules.htm
     
    Dodgydave likes this.
  7. Dodgydave

    Thread Starter Distinguished Member

    Jun 22, 2012
    4,977
    744
    Ok so i can use Rx/Tx modules to the Usart pic, now i need to know how to use the usart first, thats going to be an headache!, as the datasheet is absoloutely useless, need some source code examples in ASM.
     
    Last edited: Apr 28, 2014
  8. THE_RB

    AAC Fanatic!

    Feb 11, 2008
    5,435
    1,305
    PIC USARTS are pretty easy, once you do the setting of the baudrate register(s). That depends on xtal speed and oscillator options.

    I really recommend getting it working with a wired connection between the two PIC USARTs first!

    Once that is good and you have some preamble etc like the one on my web page it should be easy enough to connect the RF modules.

    Having a 'scope to see the RX module output matches the TX module input will help a lot too!
     
  9. Dodgydave

    Thread Starter Distinguished Member

    Jun 22, 2012
    4,977
    744
    Thats what i was going to do, wire a 3 core between each pic Tx to Rx, then transfer the ADRESL file across and put it on port b say,but i can find any working examples of pic 18f working to get me started.
     
  10. THE_RB

    AAC Fanatic!

    Feb 11, 2008
    5,435
    1,305
    The datasheet for 18F series usuall has a good blow by blow description of what to do.

    Generally for transmit you just load a byte into the TXREG;
    MOVLW byte
    MOVWF TXREG

    And the receive side has a bit flag, that flag gets set when a byte has been received. So on detecting the flag you take the byte out of RXREG;
    MOVF RXREG,w
    MOVWF final_dest

    if receiving multiple bytes you need a way to handle that, generally a pointer so you put each new byte in a successive RAM location, then inc the pointer.
     
    Dodgydave likes this.
  11. Dodgydave

    Thread Starter Distinguished Member

    Jun 22, 2012
    4,977
    744
    Ok, will give it a go, i need to transmit 6 files,so i thought if i sent a dummy file with 9 bits as a synch pulse, then 6 files in order,and wait for the 9 bit sync file then start to receive the files and store them in order.
     
Loading...