In SX Microcontrollers, SX/B Compiler and SX-Key Tool, hainguyen51 wrote: Hi, If anyone knows what's wrong with this code please let me know. I am sending o square signal of 1Hz into rb.0 and try to create a small pulse at rc.0 everytime the + slope comes along. I tried this and the output rc.0 is always = low. I am trying to figure out how the edge detection works first before I have a real application of delaying the signal at rb.0 appears at rc.0. Thanks Hai device SX28L,OSCHS3,TURBO,STACKX_OPTIONX id 'ECU103' reset start ;Jump to reset_entry on reset. FREQ 50000000 ;50MHz target frequency. ; ;Define inputs, outputs, and registers ; ORG $00 ;Program start at address 00h. interrupt RETI ; start MOV M,#$0F ;Set up MODE register. MOV !RB, #$FF ;Set $00 make RB all Inputs. MOV !RC, #$00 ;Set $00 make RC all Outputs. MOV M,#$0E ;Set up MODE for PULL-UP configuration. MOV !RB, #$00 ;Set $00 make RB all inputs' Pullup. MOV !RC, #$00 ;Set $00 make RC all Outputs' Pullup. ; MOV M,#$0A MOV !RB, #$00 ;Set $00 make +slope detect at RB pins. ; MOV M,#$09 ; Prepare to use WKPND_B register MOV W,#$00 ; Assume all bits off initially MOV !RB,W ; Zero all edge detection bits NOP ; Might be needed ??? MOV rc, #$00 ; main MOV !RB,W ; This will put the register bits in W TEST W ; Is W zero ? SZ ; Yes, then no edges detected, so skip SETB JMP output JMP main ; output SETB RC.0 NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP CLRB rc.0 MOV W,#$00 JMP main ---------- End of Message ---------- You can view the post on-line at: http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=302865 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)