Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

EEPROM PROBLEM in PIC 18f4550

Status
Not open for further replies.
Several points that may or may not be relevant to the problem:
- when you set up the interrupts, you set both GIEL and PEIE - these are different names for the same bit
- are you using the ADC correctly? You set the "go" bit and then immediately read the result register. You should wait for the conversion to complete (either by polling "go/done" bit or with an interrupt) and then read the value.
- don't use delays to control when to send values through the UART - there are status bits to tell you when the buffer is free and therefore you can write the next value to send
- I don't know how the compiler handles ISRs but the conventional way is to put a "goto" at the vector address and tell the compiler that the function being jumped to is a high or low priority ISR. However I think you are using the HTC compiler and this may be different for that compiler.
- any variable altered within the ISR shodul be declared as volatile
- in the ISR, you have several code paths and the 'flag' variable selects which one to follow. The code that follows then does a series of string comparisons using the 'arrayptr' pointer but this is only set when 'flag' is equal to 1 and not otherwise
- your use of the sprintf routine always has a fixed format string (and they are always "%d"). The printf family of functions take up a lot of ROM and are rather slow at runtime when the format string needs to be repeatedly parsed. This can be replaced by common C functions to perform the conversion and string handling that are a lot faster.
As to your problem: how do you know the ISR is NOT being called?
(By the way, I suggest that you strip out a lot of the code until you have a minimal system that has the UART receive interrupt working. Then add in the rest of the code bit by bit until the interupt stops working and look at the last seciotn of code that was added. I must admit that your coding style makes what you are trying to achieve very hard to work out and I can't really follow the logical flow of your program.)
Susan
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top