View previous topic :: View next topic |
Author |
Message |
IanHollamby
Joined: 07 Jun 2006 Posts: 2 Location: England
|
PSP Interrupt |
Posted: Wed Jun 07, 2006 6:46 am |
|
|
I am using the PIC16C65A and have a strange issue with the PSP interrupt. The datasheet says the PSPIF flag needs to be cleared by the user firmware.
Does anyone know if using the int_psp or the psp_input_full functions actually clear this bit.
If the bit is not cleared does anyone know what the result of this will be? will it cease to give interrupts.
I am using a fairly old version of CCS compiler, purchased back in 1998.
Many thanks _________________ Ian |
|
|
Ttelmah Guest
|
|
Posted: Wed Jun 07, 2006 9:14 am |
|
|
Do you have a version number for the compiler?.
The interrupt handler, should clear the flag for you, but on a version this old, anything could be wrong. On latter systems, there is an option 'noclear', for the interrupt handler, which turns off the automatic clearing, but otherwise this is present.
You are presumably 'aware', that you cannot clear the interrupt for a data read, until the data itself is read from the PortD latch?.
Best Wishes |
|
|
IanHollamby
Joined: 07 Jun 2006 Posts: 2 Location: England
|
|
Posted: Wed Jun 07, 2006 9:41 am |
|
|
Reports compiler version as Version 2.484, 4049 in LST file
Having looked at the LST file I can see it clearing the PSPIF flag now.
The simplified irq handler consists of :
struct port_d_map {
int data : 4; // D0-3
int unibble : 1; // D4
int address : 3; // D5-7
} pc150_port;
#byte pc150_port = 8
#int_psp
psp_isr()
{
if( psp_input_full() ) {
psp_busy = 0x10;
pc150_port = psp_busy; // Signal back that we are busy
address = pc150_port.address; // Get the address and
data = pc150_port.data; // the data
....
}
else {
psp_busy = 0;
pc150_port = psp_busy; // Signal back that we are ready
}
}
the else assumes interrupt was caused by a read from the ext. processor but does not bother to check using psp function, should it?
The problem I have is that my external processor seems to have to read 20-30 times before it sees the PIC signal as not busy.
Thanks for the help _________________ Ian |
|
|
Ttelmah Guest
|
|
Posted: Wed Jun 07, 2006 3:01 pm |
|
|
I'd check in the routine, if the overflow bit is set, and if so clear it. This will happen if the master sends bytes faster than the slave can get into this routine, and read them. Remember there is going to be a lot of latency, getting into this routine...
Best Wishes |
|
|
|