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

PSP Interrupt

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



Joined: 07 Jun 2006
Posts: 2
Location: England

View user's profile Send private message

PSP Interrupt
PostPosted: Wed Jun 07, 2006 6:46 am     Reply with quote

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







PostPosted: Wed Jun 07, 2006 9:14 am     Reply with quote

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

View user's profile Send private message

PostPosted: Wed Jun 07, 2006 9:41 am     Reply with quote

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







PostPosted: Wed Jun 07, 2006 3:01 pm     Reply with quote

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
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