You need to log in to create posts and topics.

Cannot visualize value written on EEPROM (PIC16F)

Hello!

I wrote a simple code to test EEPROM module on PIC16F627A, but is no possible to visualize the value written on referred address.

Both memory writting and interruption worked on phisical chip. The configuration step and value writting is shown below:

bank_0
	movlw B'00000111'
	movwf CMCON
bank_1
	movlw B'00000000'
	movwf TRISB
	
	movlw B'11111111' 
	movwf TRISA       	

	movlw B'10000000' 
	movwf INTCON	  
	
	movlw B'11011111'
	movwf OPTION_REG
	
	bsf INTCON,PEIE
	bsf PIE1,EEIE

	movlw  mem_addr
	movwf EEADR
	movlw D'009';Value to be written on EEPROM
	movwf EEDATA
	bsf EECON1,WREN
;=========REQUIRED SEQUENCE====================
	BCF INTCON, GIE ;Disable INTs.
	MOVLW 0X55 ;
	MOVWF EECON2 ;Write 55h
	MOVLW 0XAA ;
	MOVWF EECON2 ;Write AAh
	BSF EECON1,WR ;Set WR bit
	BSF INTCON, GIE ;Enable INTs.
;============================================	
bank_0

 

 

 

Hi, thanks for reporting.

The problem is in a configuration file, you can fix it doing this:
Edit file: SimulIDE/data/PIC/p16F627/p16F627_perif.xml
Add this at line 58:

  <rom name="ROM" configregsA="EECON1" configregsB="EECON2"
                  dataregs="EEDATA" 
                  addressreg="EEADR" 
                  interrupt="EEPR" />

It should look like this:

  <wdt name="WDT" configregsA="OPTION"
                  prescalers="1,2,4,8,16,32,64,128"/>

  <rom name="ROM" configregsA="EECON1" configregsB="EECON2"
                  dataregs="EEDATA" 
                  addressreg="EEADR" 
                  interrupt="EEPR" />

  <configwords name="cfgWord" type="01">
    <word name="COINFIG1" address="0x2007" value="0xFF" />
  </configwords>
</parts>

If it doesn't work for you or there is any other problem please let me know.

 

Ragmar has reacted to this post.
Ragmar
Quote from arcachofo on November 4, 2024, 1:52 pm

If it doesn't work for you or there is any other problem please let me know.

 

Hello, arcachofo!

The xml changes worked fine for EEPROM writting, but it still heaving issues with EEPROM writting interruption. I took a look on p16F627_int.xml, but is seems to be normal for me.

 

Hi and sorry for the delay.

EEPROM interrupt was already fixed:
https://simulide.com/p/forum/topic/pic-eeprom-interrupt/

You can try using the last tester build for 1.1.0:
https://simulide.com/p/testers/

 

KerimF and Ragmar have reacted to this post.
KerimFRagmar
Quote from arcachofo on November 8, 2024, 1:31 pm

Hi and sorry for the delay.

EEPROM interrupt was already fixed:
https://simulide.com/p/forum/topic/pic-eeprom-interrupt/

You can try using the last tester build for 1.1.0:
https://simulide.com/p/testers/

 

Thanks for help, arcachofo!

arcachofo has reacted to this post.
arcachofo