In SX Microcontrollers, SX/B Compiler and SX-Key Tool, DigitalDj wrote: Ok not stay on this to long but I thought I had it figured out but for some reason I may be missing something typo whatever. What is happening is when the code starts out now it turns bothe leds on then in the begining then after 3 pulses of the first led the 2nd one comes on. It stays on for 2 - 2 1/2 pulses then goes off for 2 pulses of the first led. I know this shouldn't be possible and it should be once for every 7. Can someone look over the code and see what I am doing wrong? Thanks, Kevin [code] ' ========================================================================= ' ' File...... Simple Template ' Purpose... ' Author.... ' E-mail.... ' Started... ' Updated... ' ' ========================================================================= ' ------------------------------------------------------------------------- ' Program Description ' ------------------------------------------------------------------------- ' ------------------------------------------------------------------------- ' Device Settings ' ------------------------------------------------------------------------- DEVICE SX28, OSC4MHZ, TURBO, STACKX, OPTIONX FREQ 4_000_000 ' ------------------------------------------------------------------------- ' IO Pins ' ------------------------------------------------------------------------- Led0 Pin RB.0 Output Led1 Pin RB.1 Output ' ------------------------------------------------------------------------- ' Constants ' ------------------------------------------------------------------------- TLed0 Con 1 'multiplier for Led 0 TLed1 Con 7 'multiplier for Led 1 ' ------------------------------------------------------------------------- ' Variables ' ------------------------------------------------------------------------- ctrl0 Var Byte 'Timing Control for Led 0 ctrl1 Var Byte 'Timing Control for Led 1 ' ========================================================================= PROGRAM Start ' ========================================================================= Start: If ctrl0 = 0 Then 'Timer expired? Led0 = ~Led0 'Invert led state ctrl0 = TLed0 'Reload timer Else Dec ctrl0 'Count down EndIf If ctrl1 = 0 Then Led1 = ~Led1 ctrl1 = TLed1 Else Dec ctrl1 EndIf Pause 500 Goto Start [/code] ---------- End of Message ---------- You can view the post on-line at: http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=251567#m251828 Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2008 (http://www.dotNetBB.com)