0% found this document useful (0 votes)
6 views3 pages

PIC Microcontroller EEPROM Management

The document is an assembly language program for microcontrollers, specifically for the PIC12F629 and PIC12F675 models. It includes configurations, constant and variable definitions, and routines for EEPROM validation, GPIO updates, watchdog timer fixes, and IR decoding. The main program continuously checks for conditions and updates the GPIO state accordingly.

Uploaded by

sophiesato2003
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views3 pages

PIC Microcontroller EEPROM Management

The document is an assembly language program for microcontrollers, specifically for the PIC12F629 and PIC12F675 models. It includes configurations, constant and variable definitions, and routines for EEPROM validation, GPIO updates, watchdog timer fixes, and IR decoding. The main program continuously checks for conditions and updates the GPIO state accordingly.

Uploaded by

sophiesato2003
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

;list p=12f629

;#include <[Link]>

list p=12f675
#include <[Link]>

errorlevel -302

__CONFIG _CP_OFF & _CPD_OFF & _BODEN_OFF & _MCLRE_OFF & _WDT_ON & _PWRTE_ON &
_INTRC_OSC_NOCLKOUT

;***** CONSTANT DEFINITIONS


[Link] equ b'01000000'
C.SIRC12 equ 1

if C.SIRC12
[Link] equ b'00010000'
else
[Link] equ b'10000000'
endif

;***** VARIABLE DEFINITIONS


cblock 0x20
[Link]
[Link]
[Link]
[Link]
[Link]
[Link]
[Link]
[Link]
[Link]
[Link]
[Link]
[Link]
[Link]
[Link]
[Link]
[Link]
[Link]
[Link]
[Link]
[Link]
V.retry_count ; New variable for IR retry mechanism
V.w_temp
V.status_temp
[Link]
endc

;***** EEPROM VALIDATION FIX *****


[Link]
movlw [Link]
movwf FSR
clrf [Link]
banksel EEADR
clrf EEADR

[Link]
bsf EECON1, RD
movfw EEDAT
movwf INDF
addwf [Link], F
incf EEADR, F
incf FSR, F
movfw FSR
xorlw ([Link] + 1)
skpz
goto [Link]
banksel GPIO

movfw [Link]
xorwf [Link], W
skpnz
return

movlw .120
movwf [Link]
btfsc GPIO, sw1
goto $-1
call setup
return

;***** ATOMIC GPIO UPDATES *****


[Link]
bcf INTCON, GIE ; Disable interrupts
movfw [Link]
movwf GPIO
bsf INTCON, GIE ; Re-enable interrupts
return

;***** WATCHDOG TIMER FIXES *****


[Link]
movlw .40
btfsc [Link], [Link]
movwf [Link]
clrwdt ; Prevent WDT reset
bcf [Link], [Link]
btfss [Link], [Link]
goto [Link]
return

;***** IR DECODING ROBUSTNESS *****


[Link]
movlw .3
movwf V.retry_count

[Link]
btfsc [Link], [Link]
goto [Link]
decfsz V.retry_count, F
goto [Link]
return

;***** EEPROM WRITE VOLTAGE CHECK *****


[Link]
btfsc EECON1, WR
goto $-1
btfsc GPIO, sw1 ; Ensure stable voltage
return
; Normal EEPROM write process follows...

;***** MAIN PROGRAM START *****


main
call [Link]
call [Link]
call [Link]
goto main

END

You might also like