PDA

View Full Version : RF Code example + BOD + POR



financecatalyst
- 12th January 2009, 11:11
Hi
I am very new at this so would like to ask you guys a very basic basic basic question.
Could you please give me a an example code in PICbasic pro to glow and led and turn it off after 3 seconds and incorporate the code with Brown out detection + power on reset. I am using PIC12f635.
Also I am trying to use an rf module (which I extracted from an RF doorbell) to glow this led via an rf link using the above 12f635. Could you please guide me with an code example and a possible circuit to do this.
Thanks

Agent36
- 14th January 2009, 13:45
Hi,
Have you tried searching the forum for possible code examples for the chip you are using?
Also look at the manual thats comes with your software, this will have some examples of how to turn an LED on and off.
kind regards Nick

Archangel
- 14th January 2009, 18:24
Hello financecatalyst,
here is an example code setup for MPASM, you will have to comment out the config in your PBP 12F635.inc file to avoid overwriting . . . error.


'************************************************* ***************
'* Name : financecatalyst .BAS *
'* Author : [select VIEW...EDITOR OPTIONS] *
'* Notice : Copyright (c) 2009 [select VIEW...EDITOR OPTIONS] *
'* : All Rights Reserved *
'* Date : 1/14/2009 *
'* Version : 1.0 *
'* Notes : *
'* : *
'************************************************* ***************
@ __config _INTRC_OSC_NOCLKOUT & _WDT_ON & _MCLRE_OFF & _CP_OFF & _BOD_ON & _PWRTE_ON
PortA = %00000000
TrisA = %00000001
CMCON0.0 = 1 'These 3 statements disable analog comparators
CMCON0.1 = 1
CMCON0.2 = 1
VRCON.7 = 0 'This disables voltage reference for comparators

LOOP:
IF PortA.0 = 1 THEN ' True or false check of port status
HIGH PortA.1 ' If true makes port status high
pause 3000 ' Here is your 3 seconds
ELSE ' Goes here if False
LOW PortA.1 ' And makes port status low
ENDIF ' Ends the T/F test
GOTO Loop ' Starts the process over, forever


END

The config statement is where you enable / disable the Power up timer and Brown out detect etc. . .