Simple RF remote control code


Closed Thread
Results 1 to 14 of 14
  1. #1
    Join Date
    Jul 2003
    Posts
    2,405

    Default Simple RF remote control code

    This is a simple example showing how to work with el-cheapo type RF modules using PBP SEROUT2/SERIN2, and showing how to break-out of a SERIN2 line, with interrupts, for a remote control decoder that operates in momentary mode.

    The interrupt resets the decoder output pins if no data is received on time, or the encoder button is released.

    It's really simple stuff, but rock-solid, and shows how easy it is to use simple PBP serial commands with RF applications.

    Note: Please don't ask how to change this for a different PIC type without first reading its data sheet, and learning how to setup different onboard peripherals. It should work pretty much the same with any PIC type if you just do a little research first...;o)
    Attached Files Attached Files
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  2. #2
    erwin.zeez's Avatar
    erwin.zeez Guest


    Did you find this post helpful? Yes | No

    Default

    well nice find
    thanks for sharing this

  3. #3
    Join Date
    Jul 2010
    Posts
    2


    Did you find this post helpful? Yes | No

    Default Question over change PIC

    Hi Bruce , thanks you by sharing I have question , I start in PIC No more than two months into this , is possible change PIC by PIC16F628A is only by availability in local trade I live in CHILE - South America . Thanks you Regards..

  4. #4
    Join Date
    Jul 2010
    Posts
    2


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by kaos40 View Post
    Hi Bruce , thanks you by sharing I have question , I start in PIC No more than two months into this , is possible change PIC by PIC16F628A is only by availability in local trade I live in CHILE - South America . Thanks you Regards..

    Sorry, do not read well in English, I just saw the PIC information exchange, I read the information 16F628A Thanks for sharing.

  5. #5
    Join Date
    Jan 2012
    Posts
    12


    Did you find this post helpful? Yes | No

    Default Re: Simple RF remote control code

    Hi bruce,

    thanks for the code, but as I tried to compile it, I downloaded a trial version PBP I encountered problems "errors!".

    I realised the code is Picbasic not Picbasicpro. I looked for Picbasic compiler here but I get the information:

    Product 'PBC' is not available at this time!

    I found the Proton Amicus18, no chance! The Pic12f635 is not included!

    I looked again for another I found the Lite version but it seems to support Pic16f628 or so!

    Can you help by providing me with the Hex data for the Encoder and the decoder?

    Thanks in advance.

  6. #6
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,597


    Did you find this post helpful? Yes | No

    Default Re: Simple RF remote control code

    PBP v3 is available here:
    http://melabs.com/

    Bruce hasn't been here since 29th November 2012 06:54.

    Robert

  7. #7
    Join Date
    Jan 2012
    Posts
    12


    Did you find this post helpful? Yes | No

    Default Re: Simple RF remote control code

    Quote Originally Posted by Demon View Post
    PBP v3 is available here:
    http://melabs.com/

    Bruce hasn't been here since 29th November 2012 06:54.

    Robert
    Well thanks a lot for the instant reply Robert, but the problem is that Bruce's code is written in PicBasic not PicBasicPro. I downloaded the Pro and as I encountered errors I realised the code is mere basic.
    I don't know how many years or may be weeks it's going to take me to convert it to PBP, and that's why I recourse to Bruce for help.

  8. #8
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,597


    Did you find this post helpful? Yes | No

    Default Re: Simple RF remote control code

    I wouldn't wait for Bruce, you may wait a long time.

    Take some pics and show us what errors you're getting. PIC Basic was a free version of PBP if I remember correctly, with a limit on code size. I don't remember a limit on features, but I've been wrong before.

    What version of PIC Basic do you have? Are you still using PM assembler or now using MPASM?

    Also post your code in case you made modifications.

    Robert
    Last edited by Demon; - 19th January 2014 at 21:21.

  9. #9
    Join Date
    Jan 2012
    Posts
    12


    Did you find this post helpful? Yes | No

    Default Re: Simple RF remote control code

    Quote Originally Posted by Demon View Post
    I wouldn't wait for Bruce, you may wait a long time.

    Take some pics and show us what errors you're getting. PIC Basic was a free version of PBP if I remember correctly, with a limit on code size. I don't remember a limit on features, but I've been wrong before.

    What version of PIC Basic do you have? Are you still using PM assembler or now using MPASM?

    Also post your code in case you made modifications.

    Robert
    Thanks again for the reply Robert.

    I haven't undertaken any change I supposed the code works alright and I wanted to test at the outset, I thought I would take it as is if it is OK

    I have downloaded and ran the PBP3, the latest! I simply wanted to compile Bruce's code into Hex data.

    I supposed opening the code after saving it in a file, select the right device namely pic12f635, and click on compile would work!

    here are the images of some errors
    Attached Images Attached Images   

  10. #10
    Join Date
    Jan 2012
    Posts
    12


    Did you find this post helpful? Yes | No

    Default Re: Simple RF remote control code

    Thanks again for the reply Robert.

    I think that Bruce's code is a prototype not tested!???

    I haven't undertaken any changes I supposed the code works alright and I wanted to test it at the outset, I thought I would take it as is if it is OK.

    I have downloaded and ran the PBP3, the latest! I simply wanted to compile Bruce's code into Hex data.

    I supposed opening the code after saving it in a file, select the right device namely pic12f635, and click on compile would work!

    I also learned from here that an A is missing in IOC

    http://www.picbasic.co.uk/forum/showthread.php?t=16819

    I corrected that but still compilation doesn't work.
    I get Illegal Opcode

    If I write it this way:

    @ __CONFIG _MCLRE_OFF & _INTRC_OSC_NOCLKOUT & _WDT_OFF & _BOD_OFF & _PWRTE_ON & _FCMEN_OFF & _IESO_OFF & _WUREN_OFF

    It didn't work either

    I tried the code from there I mean here:

    http://www.picbasic.co.uk/forum/showthread.php?t=16819

    after adding the A, I still get errors

    Finally

    It only worked once I delete the whole @ _config................... line!

    I have to find out how to edit it properly.

  11. #11
    Join Date
    Sep 2010
    Location
    Las Vegas, NV
    Posts
    305


    Did you find this post helpful? Yes | No

    Default Re: Simple RF remote control code

    If you'll look in the PBP3 manual there's a fine example of how to write a config statement. This if for a different chip but you see the context of how it should be written.

    'Config for 16F877A
    #CONFIG
    __config _XT_OSC & _WDT_ON & _LVP_OFF & _CP_OFF
    #ENDCONFIG

    Enjoy.

  12. #12
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,597


    Did you find this post helpful? Yes | No

    Default Re: Simple RF remote control code

    Are you using PM assembler?

    If yes, make sure to point to MPASM assembler in the Microcode assembler settings.

    It was most likely in the Microcode Studio download or get it here:

    http://www.microchip.com/stellent/id...&part=SW007002

    Robert
    Last edited by Demon; - 20th January 2014 at 21:33.

  13. #13
    Join Date
    Jan 2012
    Posts
    12


    Did you find this post helpful? Yes | No

    Default Re: Simple RF remote control code

    Quote Originally Posted by AvionicsMaster1 View Post
    If you'll look in the PBP3 manual there's a fine example of how to write a config statement. This if for a different chip but you see the context of how it should be written.

    'Config for 16F877A
    #CONFIG
    __config _XT_OSC & _WDT_ON & _LVP_OFF & _CP_OFF
    #ENDCONFIG

    Enjoy.
    Thanks a lot AvionicsMaster1, I downloaded it and I was busy skimming through things from the beginning like how to enable pull ups etc. because some of my own codes I wrote back in 2008 haven't worked. So I spent the night looking for the new changes in the manual and I had a look on some examples. But thanks to you, you cut the way through for me with the config thing. Now I'm on the right track.

  14. #14
    Join Date
    Jan 2012
    Posts
    12


    Did you find this post helpful? Yes | No

    Default Re: Simple RF remote control code

    Thanks Robert! I did download it as I'm looking for solutions in Assembly, C and Basic both Microchip Pic and Atmel AVR.

    I haven't programmed in PICbasic for some years. But now I capture the familiarity.

    Again thank you very much.

    Quote Originally Posted by Demon View Post
    Are you using PM assembler?

    If yes, make sure to point to MPASM assembler in the Microcode assembler settings.

    It was most likely in the Microcode Studio download or get it here:

    http://www.microchip.com/stellent/id...&part=SW007002

    Robert

Similar Threads

  1. DTMF and PIC for Remote Control
    By doggitz in forum mel PIC BASIC Pro
    Replies: 19
    Last Post: - 30th March 2010, 11:42
  2. Making Program Code Space your playground...
    By Melanie in forum Code Examples
    Replies: 15
    Last Post: - 19th July 2008, 08:26
  3. Simple LCD code not working..
    By davewanna in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 28th April 2008, 13:55
  4. Remote Control World !
    By iugmoh in forum General
    Replies: 4
    Last Post: - 22nd April 2008, 23:03
  5. Port control code Yelp!!
    By andyf in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 8th May 2005, 22:36

Members who have read this thread : 2

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts