While Loop Ends Unexpectedly.

basically miscellaneous, if it doesn't fit another sub-forum enter it here, we might even promote it to its own sub-forum
danlee58
Posts: 210
Joined: Thu Jan 17, 2013 2:29 am

Re: While Loop Ends Unexpectedly.

Post by danlee58 »

Do I need to make T1_CCR = 0x30 to interrupt on the falling edge, then in the interrupt routine reset T1_CCR = 0x28, if P1.18 = 0, and T1_CCR = 0x30 if P1.18 = 1?



basicchip
Posts: 1090
Joined: Fri Oct 19, 2012 2:39 am
Location: Weeki Watchee, FL
Contact:

Re: While Loop Ends Unexpectedly.

Post by basicchip »

No you can interrupt on both.

What kind of signal are you measuring? Is it clean, or could it have multiple transitions like a switch bounce?

danlee58
Posts: 210
Joined: Thu Jan 17, 2013 2:29 am

Re: While Loop Ends Unexpectedly.

Post by danlee58 »

My test setup produces an output from a Coridium SuperPro board. It's pulling down a 1K load connected to 5 volts supplied by the ProPlus board under test. The 5.0 Volts is from the USB dongle.

I have P1.18 connected to a channel on my 100Mhz logic analyzer. I can see some steps in the falling edge, but mostly it's clean.

danlee58
Posts: 210
Joined: Thu Jan 17, 2013 2:29 am

Re: While Loop Ends Unexpectedly.

Post by danlee58 »

I commented out VICIntEnable0 = 0x4 in the interrupt routine. The main program runs, but the interrupt is sporadic.

danlee58
Posts: 210
Joined: Thu Jan 17, 2013 2:29 am

Re: While Loop Ends Unexpectedly.

Post by danlee58 »

I changed T1_IR = 0x10 to T1_IR = 0x20, and reinserted VICIntEnable0 = 0x4. Now it all seems to be working. I am using Capture Channel 1, not Capture Channel 0.

I'll try to remove some of the redundant instructions.

danlee58
Posts: 210
Joined: Thu Jan 17, 2013 2:29 am

Re: While Loop Ends Unexpectedly.

Post by danlee58 »

I removed the redundant instruction. It still looks good. Now I have to integrate it into the target program, as this was a test program just to debug this problem. The interrupt routine shouldn't be changed by that.

Post Reply