Microchip PIC 18f8722 USART2 Interrupt Problem

Hi,

Microchip PIC 18f8722 USART2 Interrupt is not working - I have USART1 working fine with interrupts but cannot get interrupt on usart2 - the RC2IF interrupt flag never gets set although data is coming into the rcreg2 register and i can read from it.

Is there any special considerations I need to take into account? Global INT flag is enabled as well as all INTs on High priority. Code is exactly the same as that of usart1 but usart2 INT flag never gets set?

Any help greatly appreciated!

Thanks,

GI.

Reply to
gary.ireland
Loading thread data ...

Hi,

Microchip PIC 18f8722 USART2 Interrupt is not working - I have USART1 working fine with interrupts but cannot get interrupt on usart2 - the RC2IF interrupt flag never gets set although data is coming into the rcreg2 register and i can read from it.

Is there any special considerations I need to take into account? Global INT flag is enabled as well as all INTs on High priority. Code is exactly the same as that of usart1 but usart2 INT flag never gets set?!

Any help greatly appreciated!

Thanks,

GI.

Reply to
GaryI

RC2IF is the only indication that data has been received in RCREG2, so why do you believe you are receiving data if RC2IF is not going high?

--
John W. Temples, III
Reply to
John Temples

second time as a candidate for the honour of a free passage, but it seems quite as likely that nothing less than kidnaping or forcible detention would induce men to run so great a risk. On arrival at Singapore the broker is again on the _qui vive_ to see that his captives do not jump into the sea, and as each coolie ship arrives at the wharf, a small force of police is in waiting to keep a space clear and prevent any attempt at escape, while the officers of the Protectorate board the ship, accompanied by a further force of marine police, for the purpose of inspecting the coolies. When permission is given to disembark, the unpaid passengers are made up into small parties and marched through the town to the depots under the escort of the brokers and several of their assistants, with much yelling and good deal of rough handling, and an occasional halt while a straggler or a would be runaway is brought back to the party. That the coolies are frequently successful in their attempts to escape is shown in the Report of the Chinese Protectorate, 160 being returned as 'absconded either when landing or at depot' in Singapore, and 101 at Penang, or about 1-3/4 per cent of the "unpaid passengers". On arrival at the depot, the coolies are

Reply to
GaryI

How do you know that the interrupt flag is not being set? Generally speaking, on PICs the interrupt flags are set regardless of whether the interrupt is enabled. IOW, RC2IF should get set when data arrives because there is nothing that you can configure to prevent it from happening. Do you have the RC2IE flag set? You have to have the peripheral interrupts enabled as well, but you must have or the other USART wouldn't be working. How about the priority level assignment in IPR3?

IMO, the PIC is not seeing any data or you don't actually have the interrupt enabled. Generally speaking again, PICs will refuse to receive data on a USART if there is an error flag set such as "receive overrun" or "framing error". Either that or your problem lies in PIR3, PIE3, or IPR3.

Reply to
Anthony Fremont

se

o

pt

a

Another possibility is that there has been either a framing error or an overrun error. Once this has happened the flag no longer gets set until the error is cleared and/or the usart reset. See the datasheet. Rocky

Reply to
Rocky

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.