PDA

View Full Version : Simple RF remote control code



Bruce
- 25th January 2010, 21:32
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)

erwin.zeez
- 5th May 2010, 11:50
well nice find
thanks for sharing this ;)

kaos40
- 23rd July 2010, 03:15
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.. :)

kaos40
- 24th July 2010, 04:01
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. :o

Protech
- 18th January 2014, 20:31
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.

Demon
- 18th January 2014, 20:56
PBP v3 is available here:
http://melabs.com/

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

Robert

Protech
- 19th January 2014, 19:51
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.

Demon
- 19th January 2014, 22:18
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

Protech
- 20th January 2014, 20:11
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

Protech
- 20th January 2014, 20:39
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.

AvionicsMaster1
- 20th January 2014, 22:07
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.

Demon
- 20th January 2014, 22:24
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/idcplg?IdcService=SS_GET_PAGE&nodeId=1406&dDocName=en019469&part=SW007002

Robert

Protech
- 22nd January 2014, 11:38
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.

Protech
- 22nd January 2014, 11:45
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.


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/idcplg?IdcService=SS_GET_PAGE&nodeId=1406&dDocName=en019469&part=SW007002

Robert