;***** CONFIGURATION ; int reset, no code protect, no watchdog, int RC clock __CONFIG _MCLRE_OFF & _CP_OFF & _WDT_OFF & _IntRC_OSC #define Z_pin GPIO,5 ; Zero Cross imput pin 2 #define Alarm GPIO,4 ; Imput segnale dal buzzer sveglia #define TRIAC GPIO,1 ; Output pilotaggio triac pin 6 #define Ready GPIO,2 ; Led detect busser processo in corso pin 5 ;***** RC CALIBRATION RCCAL CODE 0x3FF ; processor reset vector res 1 ; holds internal RC cal value, as a movlw k ;***** RESET VECTOR ***************************************************** RESET CODE 0x000 ; effective reset vector movwf OSCCAL ; apply internal RC factory calibration ;***** MAIN PROGRAM ***************************************************** ;***** Initialisation start movlw b'111000' ; Setta Pin 0-1-2 come out e 3-4-5 come imput tris GPIO ; GP3 è solo imput clrf GPIO ; start with GPIO clear (GP1 low) ;***** Main loop main_loop ; turn on LED only if button pressed btfss Alarm ; led opto acceso quindi impulso 3V bsf TRIAC ; LED acceso btfsc Alarm ; led opto spento quindi impulso 0V bcf GPIO,1 ; LED spento ; repeat forever goto main_loop END