1 Attachment(s)
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)
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.
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
Re: Simple RF remote control code
Quote:
Originally Posted by
Demon
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.
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
2 Attachment(s)
Re: Simple RF remote control code
Quote:
Originally Posted by
Demon
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
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.
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.
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
Re: Simple RF remote control code
Quote:
Originally Posted by
AvionicsMaster1
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.
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