On Thu, 16 Jul 1998 18:31:33 -0500 Ivan Dario Cano Montoya writes: >Friends, > >I'm building a led chaser whit a 12C508 Pic microcontroller. >I configure GPO, GP1, GP2, GP4 as outputs to drive the leds. >I'm having the following trouble: > >When I plugin the circuit, it starts at function whit label "cizq", >but it should starts at function labeled "izq". How do you conclude that? > >if you trace the program from mplab simulator it's seem to have no = >problem. > >Sometimes the circuit does not start, the only thing that you can see >in = >the leds >it's a shadow. I only gave the program a quick glance, but it appears that you are using the TRIS register to control the LEDs by switching the pins of LEDs that should be off to input mode. This is an acceptable practice, though it may cause higher current consumption by having the input pins at an intermediate voltage (Circuits that use LEDs generally aren't too optimized for current consumption anyway). But, you never write any data to GPIO. So when the outputs come on, they may not output the right voltage to turn the LED on. A reset doesn't set GPIO to any particular state, so sometimes it works and sometimes it doesn't. You may want to rewrite so the LEDs are controlled by writing to GPIO, and only do TRIS once at the start of each loop. Or at the very least at the start of each loop write all ones or all zeros to GPIO depending on how the LEDs are wired. _____________________________________________________________________ You don't need to buy Internet access to use free Internet e-mail. Get completely free e-mail from Juno at http://www.juno.com Or call Juno at (800) 654-JUNO [654-5866]