Hi all,
I got this probelm and was wondering if anyone can help me.
I got 2 PIR detectors that sends a pulse out to the PIC16F628 pin 17 n 18.
What i want the microcontroller to do is to figure out which of the 2 PIR's have been triggered and send out a string eg "CAMA" or "CAMB" through pin 8 through the serial port to the PC which ineracts with visual basic 6 (I can do the VB side just not the microcontroller)
Thank you for helping me, much appreciated
I have started the code, but i was wondering if ne1 can fill the gaps if i missed any. THANKS :lol:
I got this probelm and was wondering if anyone can help me.
I got 2 PIR detectors that sends a pulse out to the PIC16F628 pin 17 n 18.
What i want the microcontroller to do is to figure out which of the 2 PIR's have been triggered and send out a string eg "CAMA" or "CAMB" through pin 8 through the serial port to the PC which ineracts with visual basic 6 (I can do the VB side just not the microcontroller)
Thank you for helping me, much appreciated
I have started the code, but i was wondering if ne1 can fill the gaps if i missed any. THANKS :lol:
Code:
LIST P = 16F628 ; MICROCONTROLLER USED
#include "P16F628.INC" ; HEADER FILE (CONTAINS APPROPRIATE EQUATES SECTION
;===========================================================================
; CONFIGURATION WORD
;===========================================================================
ERRORLEVEL 0, -302 ; STOPS BANK SELECTION MESSAGES
__CONFIG 0x3D18 ;CONFIGURATION WORD (SETS OSCILATOR ETC)
MOVLW 0X07
MOVWF CMCON
BANKSEL TRISA
MOVLW B'00100011'
MOVWF TRISA
MOVLW B'00000010'
MOVWF TRISB
BANKSEL SPBRG
MOVLW D'12'
MOVWF SPBRG
MOVLW B'00100100'
MOVWF TXSTA
MOVLW B'00000000'
MOVWF PIE1
;----------------------------------------------------------------------------
; Main program
;----------------------------------------------------------------------------
START
BANKSEL PORTA
BTFSC PORTA, 0 ;Check to see if the carry is set
CALL CAMERA_A
BTFSC PORTA, 1
CALL CAMERA_B
GOTO START ;Loop forever
CAMERA_A
C_A
BANKSEL TXSTA
BTFSS TXSTA, TRMT
GOTO C_A
BANKSEL TXREG
MOVLW H'41'
MOVWF TXREG
RETURN
CAMERA_B
C_B
BANKSEL TXSTA
BTFSS TXSTA, TRMT
GOTO C_B
BANKSEL TXREG
MOVLW H'42'
MOVWF TXREG
RETURN
END