Yes, but this had a different purpose... The PORTC outputs connect to =20 another PIC and these outputs are have pull-ups. In trying to =20 diagnose that, I whittled down the circuit to this small piece of code =20 and added the LED's. So though it seems like a strange way, it should =20 work still. BTW, I've only shown this snippet with the difference which stops it =20 working. The port is initialized with LATC=3D0 prior to this. Another oddity that just started at the same time is that the compiler =20 croaks at "while (1)" which worked before. Cheers, -Neil. Quoting Andre Abelian : > Neil, > > the purpose of TRIS is to make pins input or output. use PORT to =20 > drive=A0leds on/off. > call TRIS in main once and in your while loop use PORT. =A0for single =20 > pin lets say to toggle PORTbits.RC0 ^=3D 1; =A0 > > AA > > > > > > > > On Thursday, November 28, 2013 12:17 PM, Neil wrot= e: > > Also just tried this on another computer with MPLAB v8.76 and C18=A0 > v3.42.=A0 Same non-working behaviour. > > Cheers, > -Neil. > > > > Quoting Neil : > >> Happy Thanksgiving US folks, >> >> Trying to figure out why code isn't working, I've whittled it down to >> this oddity: >> >> This works, toggling LED's repeatedly as expected... >> >> while (1) >> { >> =A0=A0=A0 TRISC =3D 0b10101010;=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 // '0's wil= l turn LED's on. >> =A0=A0=A0 for (x=3D0; x<200; x++) >> =A0=A0=A0 { >> =A0=A0=A0 =A0=A0=A0 Delay10TCYx(255); >> =A0=A0=A0 =A0=A0=A0 res++;=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 // Dum= my task >> =A0=A0=A0 } >> =A0=A0=A0 TRISC =3D 0b01010101;=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 // '0's wil= l turn LED's on. >> =A0=A0=A0 res++;=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 // Dum= my task >> =A0=A0=A0 for (x=3D0; x<200; x++) >> =A0=A0=A0 { >> =A0=A0=A0 =A0=A0=A0 Delay10TCYx(255); >> =A0=A0=A0 =A0=A0=A0 res++;=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 // Dum= my task >> =A0=A0=A0 } >> } >> >> >> However, when I switch delay functions and adjust the time units >> accordingly, the code stalls at the delay... >> >> while (1) >> { >> =A0=A0=A0 TRISC =3D 0b10101010;=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 // '0's wil= l turn LED's on. >> =A0=A0=A0 for (x=3D0; x<200; x++) >> =A0=A0=A0 { >> =A0=A0=A0 =A0=A0=A0 Delay100TCYx(26); >> =A0=A0=A0 =A0=A0=A0 res++;=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 // Dum= my task >> =A0=A0=A0 } >> =A0=A0=A0 TRISC =3D 0b01010101;=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 // '0's wil= l turn LED's on. >> =A0=A0=A0 res++;=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 // Dum= my task >> =A0=A0=A0 for (x=3D0; x<200; x++) >> =A0=A0=A0 { >> =A0=A0=A0 =A0=A0=A0 Delay100TCYx(25); >> =A0=A0=A0 =A0=A0=A0 res++;=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 // Dum= my task >> =A0=A0=A0 } >> } >> >> >> This is a fresh install of MPLAB 8.66 with C18 v3.46.=A0 I've disabled >> all optimizations in the project's build options.=A0 What else should I >> be checking, or is this a legitimate bug with the compiler/libraries? >> FWIW, I also noticed that I could previously use "while (1)" for >> infinite loops, but now the compiler hangs for several minutes, memory >> usage climbs significantly, then just fails to compile. >> >> Cheers, >> -Neil. >> >> >> >> -- >> http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive >> View/change your membership options at >> http://mailman.mit.edu/mailman/listinfo/piclist > >> > > > > -- > http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive > View/change your membership options at > http://mailman.mit.edu/mailman/listinfo/piclist > -- > http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive > View/change your membership options at > http://mailman.mit.edu/mailman/listinfo/piclist > --=20 http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .