OpenCores
Issue List
External Interrupt doesn't work properly #5
Open ocghost opened this issue over 17 years ago
ocghost commented over 17 years ago

After a succesful interrupt, the INTE flag is set back. So no more external Interrupt ist possible anymore. So the INTE status has to be saved and set back to the old status before returning from the inerrupt routine.

benradu commented over 17 years ago

I think the reason is that any access on the INTCON register (in an interrupt you access it to check the flags) actually writes that reg. It is because of a missing condition on File_Wr in P16F84.vhd file. Solution: Replace the line if to_integer(unsigned(File_Addr_r(6 downto 0))) = 11 then with if to_integer(unsigned(File_Addr_r(6 downto 0))) = 11 and File_Wr='1' then Be aware that the OPTION register implementation suffer from the same problem. To fix it replace to_integer(unsigned(File_Addr_r(7 downto 0))) = 129 then with (to_integer(unsigned(File_Addr_r(7 downto 0))) = 129 and File_Wr='1') then Good luck.

benradu commented over 17 years ago

I think the reason is that any access on the INTCON register (in an interrupt you access it to check the flags) actually writes that reg. It is because of a missing condition on File_Wr in P16F84.vhd file. Solution: Replace the line if to_integer(unsigned(File_Addr_r(6 downto 0))) = 11 then with if to_integer(unsigned(File_Addr_r(6 downto 0))) = 11 and File_Wr='1' then Be aware that the OPTION register implementation suffer from the same problem. To fix it replace to_integer(unsigned(File_Addr_r(7 downto 0))) = 129 then with (to_integer(unsigned(File_Addr_r(7 downto 0))) = 129 and File_Wr='1') then Good luck.

benradu commented over 17 years ago

I think the reason is that any access on the INTCON register (in an interrupt you access it to check the flags) actually writes that reg. It is because of a missing condition on File_Wr in P16F84.vhd file. Solution: Replace the line "if to_integer(unsigned(File_Addr_r(6 downto 0))) = 11 then" with "if to_integer(unsigned(File_Addr_r(6 downto 0))) = 11 and File_Wr='1' then" Be aware that the OPTION register implementation suffer from the same problem. To fix it replace "to_integer(unsigned(File_Addr_r(7 downto 0))) = 129 then" with "(to_integer(unsigned(File_Addr_r(7 downto 0))) = 129 and File_Wr='1') then"

Good luck.

ocghost commented over 16 years ago

I had the same problem when i added some of my own registers in the same manner. Everytime the File_Addr_r signal becomes the register adress, the register was written. Adding the additional "if File_Wr = '1'" query solved the problem.


Assignee
No one
Labels
Bug