hi
yes
Code:
'****************************************************************'* Name : UNTITLED.BAS *
'* Author : [select VIEW...EDITOR OPTIONS] *
'* Notice : Copyright (c) 2000 [select VIEW...EDITOR OPTIONS] *
'* : All Rights Reserved *
'* Date : 01/01/2000 *
'* Version : 1.0 *
'* Notes : *
'* : *
'***************************************************************
;The 12F675 has both analog converters and analog comparators.
;You must disable both to use the I/O pins for digital functions.
;In addition, the register that controls the analog converters
;has been named ANSEL, and it has a different format that the ADCON1
;register found on most PICmicro MCUs
DEFINE OSCCAL_1K 1
#CONFIG
__config _INTRC_OSC_NOCLKOUT & _WDT_ON & _PWRTE_ON & _MCLRE_OFF & _CP_OFF & _BODEN_ON
#ENDCONFIG
PCON.3 = 1
ANSEL = 0 ;needed as as above
CMCON = 7
ASM
errorlevel -302 ; Suppress message 302
bcf STATUS,RP0 ; Bank 0
clrf GPIO ; Init GPIO
movlw 07h ; Set GP<2:0> to
movwf CMCON ; digital IO
bsf STATUS,RP0 ; Bank 1
clrf ANSEL ; Digital IO
movlw 0Ch ; Set GP<3:2> as inputs
movwf TRISIO ; and set up GP<5:4,1:0> as outputs
endasm
DEFINE OSC4 ;sets up 4 meg internal oscillator
GLOW VAR GPIO.2 ;Output to MOSFET driving glow driver - Pin 5
RADIO VAR GPIO.3 ;Input from receiver - Pin 4
lED var GPIO.1 ;running led - PIN 7
P VAR WORD ; This stores the PULSIN value
;*********************************************************************
clear ; Set all variables to zero
;*********************************************************************
RX: ; This is where we wait for a signal from the Tx
PULSIN RADIO,1,P ; With 4 meg oscillator, PULSIN measures at 10 millisecs
HIGH LED ; SHOW PIC IS RUNING
IF P < 50 then goto RX ; You forgot to turn on the transmitter.
IF (P > 100) and (P < 125) THEN GOSUB SW_ON ; Turn on glow
IF (P > 125) THEN GOSUB SW_OFF ; Turn off glow
GOTO RX
;********************************************************************
SW_ON:
HIGH GLOW ; This outputs the glow signal on Pin 5
RETURN
SW_OFF:
LOW GLOW ; This outputs the glow signal on Pin 5
RETURN
;********************************************************************
END ;Terminate the program
Bookmarks