[SOLVED] A question about the PIC 16F1708

Status
Not open for further replies.

ljcox

Full Member level 5
Joined
Feb 1, 2006
Messages
252
Helped
25
Reputation
50
Reaction score
23
Trophy points
1,298
Location
Melbourne Australia
Activity points
3,110
I used MPLAB 8.92 to write & test a .asm programme for the 16F1708 PIC.

I chose that PIC as it has Interrupt on Change on all inputs.

I have found that IOC only works on PORTA inputs.
When I change one of the PORTC inputs, the IOCCF flag does not change & the PIC won't exit Sleep - as it does for PORTA inputs.

Is this due to a fault in the MPLAB software, or am I missing something?

Any assistance will be appreciated.

Len
 

I've never used that device but it does appear that all pins have IOC ability.
The interrupt on change interrupt should occur and wake the device from sleep whenever any configured input changes state. I assume you have programmed all the individual enable pins and the pins logic level is rising or falling (or both) according to the edge polarity you have programmed. For example, if you have only selected IOC for a rising edge, are you expecting it to interrupt if the pin is grounded? You can enable detection of both edges. Make sure the pins are pulled or driven to the 'idle' state externally and not floating or configured as outputs.

Brian.
 

Hi,

If you really need help, then post your schematic and your code.

Klaus
 


Thanks Brian, I have done all of that and I change the config from rising edge to falling edge & vice versa as necessary. It works well with PORTA inputs but not PORTC.
I've successfully written code for many other applications using a variety of PICs. I also cleared ANSELA, B & C so the inputs are all digital.

So it appears to be a software fault in MPLAB. I understand that MPLAB 8.92 does not fully support the 16F1708, so I assume that is the issue.

I tried to use MPLABX but could not work out how to use it properly. So it looks as if I'll have to persevere with it & learn the ropes.
Len

- - - Updated - - -

Hi,

If you really need help, then post your schematic and your code.

Klaus

Thanks Klaus. I have had plenty of experience with writing code for a variety of PICs but never for this one. The circuit diagram is not relevant as I am an electronics engineer with plenty of design experience. Also, I have not yet programmed the PIC. I'm using MPLAB to check the code before I do the programming. It works well for PORTA inputs but not PORTC.

Here is the code. I deleted the delay sub routines to make it shorter. To cut a long story short, you will note that I did not use the IOC flags to determine which input has changed, I did it by comparing the current input state with the previous one. I use the IOC simply to awake the PIC from Sleep.

 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…