Shop OBEX P1 Docs P2 Docs Learn Events
MUXC for debugging purposes, trying but not working — Parallax Forums

MUXC for debugging purposes, trying but not working

peterzpeterz Posts: 59
edited 2007-01-30 20:57 in Propeller 1
I have tried to generate a continuous·pulse of 1us on PIN0.
For this I have tried to use MUXC, as follows:

Test0
······················· ror···· mask_bits,#1 wc
······················· muxc··· outa,debug_mask
······················· mov t1, bitticks
······················· add t1, cnt
:WaitTick
······················· cmps t1,cnt wc
······················· if_nc jmp #:WaitTick
······················· jmp #Test0

debug_mask····· LONG %0000_0000_0000_0000_0000_0000_0000_0001
mask_bits········ LONG %1010_1010_1010_1010_1010_1010_1010_1010
bitticks············ LONG 80

Note: in my Spin code section I set PIN0 as OUTPUT.

However I dont get any pulse at all! I suppose my code is wrong, is it?

·

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2007-01-30 20:57
    The only obvious error is the use of a signed compare (cmps). CNT is an unsigned 32 bit count. If you happen to run this when the value has its sign bit set, the :WaitTick loop will hang for maybe 2^31 clock ticks which can be a substantial part of a minute. Better to use cmp or waitcnt which will work on unsigned values. Your use of MUXC looks fine.
Sign In or Register to comment.