Shop OBEX P1 Docs P2 Docs Learn Events
Weird Behavior — Parallax Forums

Weird Behavior

edgellmhedgellmh Posts: 85
edited 2008-10-05 01:50 in General Discussion
Things have been going well and I have been writing more and more complex programs until suddenly the behavior of the components on the PDB board no longer seemed to follow my code. I assumed my SX had been burnt out and purchased a new one but I am still getting weird behavior. I removed the SXkey software and loaded a new one along with the new SX/B. I still get weird behavior. If I use the code below the LED on the PDB hooked to RB.0 comes on for a while and then goes off for 2 seconds and then repeats. That is the LED does not do its 4 short blinks. If I replace the HIGH, LOW commands with one TOGGLE command then the LED behavior is as I expect it; two blinks, 2 second pause and then repeats.

Something must be broken but what?

marshall



DEVICE SX28, OSC4MHZ, TURBO, STACKX, OPTIONX
FREQ 4_000_000
ID "LED"
'
' IO Pins
'
LED_PIN PIN RB.0 OUTPUT

'
' Constants
'
'
' Variables
'
j VAR Byte

'
' INTERRUPT
'
ISR_Start:

ISR_Exit:
' RETURNINT ' {cycles}
' =========================================================================
PROGRAM Start
' =========================================================================
'
' Program Code
'
Start:
Main:
FOR j = 1 to 4
'DO
HIGH LED_PIN
PAUSE 500
low LED_PIN
NEXT
'LOOP
PAUSE 2000
GOTO Main

Comments

  • mojorizingmojorizing Posts: 249
    edited 2008-10-04 21:53
    Nothing is broken - you need a "pause 500" after the "Low Led_Pin"

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Bad spellers of the world untie!
  • edgellmhedgellmh Posts: 85
    edited 2008-10-04 23:39
    Well, that was stupid of me.

    How about trouble shooting the code below.

    FOR j = 1 to 4
    'DO
    LED_PIN = 1
    PAUSE 500
    LED_PIN = 0
    PAUSE 500
    NEXT

    If I use HIGH or LOW for either one of the lines the code behaves as I expect it. But when I use the code above the LED never lights up.
    marshall
  • mojorizingmojorizing Posts: 249
    edited 2008-10-05 01:44
    marshall,

    It works for me in either case.

    HIGH LED_PIN·and Low LED_PIN

    or·

    LED_PIN = 1 and LED_PIN = 0



    I'm using SX-Key v3.2.3

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Bad spellers of the world untie!
  • JonnyMacJonnyMac Posts: 9,214
    edited 2008-10-05 01:50
    For me, too (see attached). Beware sloppy coding/formatting -- this is an easy way to hide errors.
Sign In or Register to comment.