Yes. it's actually an internal osc but I understand the pulsin command doesn't care anyway.
Yes. it's actually an internal osc but I understand the pulsin command doesn't care anyway.
Correct, PULSIN works with the actual speed the MCU is running at. Are you sure the internal is setup properly... confirmed the MCU is running at the desired speed?
Dave
Always wear safety glasses while programming.
I am pretty sure it is. (I tested it with a blink led set to pause 2000 and it was a 2 second gap...well two Mississippis by my count. I spent a while trying to figure out the OSCCON) My understanding of it is that because the pulsein is "narrower" than when the osc is running at 4mhz the timings for reading IR signals is different.so "if stx<760" actually should be a different value. I am trying to understand the maths of what that value should be.
p.s. I know there is a typo in the code portb.4 is incorrect and I have corrected it in my actual code.
ok i'm sure youve checked this but have you checked the ports Analog input is turned off.
ANSELA = 0
ANSELB = 0
ANSELC = 0 ' Config A2d All OFF
I hadn't but I was using porta.4 which isn't an analogue in. I am fairly sure that my pulse length if statements are wrong because I am defo getting good stuff at 4 mhz. It's just when wang it up to 16 mhz I get nout. I think it is all about pulsin pulse widths changing with different oscillator speeds. So looking for a pulsewidth at 4 mhz is different from a pulsewidth at 16. (I have to admit that I am a bit of a newbie at both pics and Ir protocols.)
Did you mention the part number of you MCU?
Dave
Always wear safety glasses while programming.
I'm guessing your still using the 18F24K22 ?
Check your OSCCON settings are
OSCCON = %01110010 ' Set internal 16Mhz OSC
OSCCON2 = %00001100
while OSCCON.2 = 0 : WEND ' Wait for stable flag
Bookmarks