CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

read eeprom and global interrupt PIC18F46K22

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Fabri



Joined: 22 Aug 2005
Posts: 275

View user's profile Send private message

read eeprom and global interrupt PIC18F46K22
PostPosted: Tue May 04, 2021 1:55 am     Reply with quote

Hello,
Checking assembler generated from CCS V5.077 I realized CCS routine called "read_eeprom" set and reset global interrupt during eeprom read operation. Generally microchip datasheet don't request this for read operation. This happens also in read routine not under interrupt.

Somebody can explain me why ?

Thanks,
Ttelmah



Joined: 11 Mar 2010
Posts: 19195

View user's profile Send private message

PostPosted: Tue May 04, 2021 2:01 am     Reply with quote

Presumably just to avoid the possibility of anything in the interrupt code
changing a register setting that affects this. If you have any form of table
read operation in the interrupt (array access), this could cause problems.
Remember though that the 'read; is very fast, so unlike the write where
interrupts are disabled for a significant time, the effect of this should be
tiny.
Fabri



Joined: 22 Aug 2005
Posts: 275

View user's profile Send private message

PostPosted: Tue May 04, 2021 2:34 am     Reply with quote

I supposed so but I was considering whether this operation is not negligible.
I'm going to do some about it. My question comes because I have a random delay in phase controls under timer interrupt never saw before.
temtronic



Joined: 01 Jul 2010
Posts: 9081
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Tue May 04, 2021 4:37 am     Reply with quote

It's a 'better safe than sorry' chunk of code. As Mr. T. points out, the compiler can't 'know' all interactions of what your code could do, so prevents a possible event (interrupt) from altering a known event (R/W EEPROM).

As for the 'random delay' problem, post the ISR, maybe we can see something. Perhaps go back a few versions to a previously known 'good' version. Hopefully you have incremental versions of the program and not just one that you keep editing, and reediting, and reediting.....
Ttelmah



Joined: 11 Mar 2010
Posts: 19195

View user's profile Send private message

PostPosted: Thu May 06, 2021 1:03 am     Reply with quote

The time involved in a read should literally only be a handful of machine
instructions.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group