Shop OBEX P1 Docs P2 Docs Learn Events
P0 output — Parallax Forums

P0 output

caskazcaskaz Posts: 957
edited 2012-01-19 18:32 in Propeller 1
Hi.
I have question.
I did below code.
CON
_clkmode = xtal1 + pll16x
_xinfreq = 5_000_000
PUB
cognew(@entry,0)

DAT
      org 0
entry mov outa #0
      mov dira,#1
      mov outa,#1

I checked P0 by oscilloscope.
There are low pulse(100nsec width) evry by 26usec.

Why low pulse?
And why every 26usec?

Comments

  • kwinnkwinn Posts: 8,697
    edited 2012-01-19 18:10
    That's how long it takes to execute the instructions in the rest of cog memory. You need to add a jump to "entry" at the bottom. Then the pin should toggle every 150nS ( 3.33MHz )
  • caskazcaskaz Posts: 957
    edited 2012-01-19 18:21
    Thanks kwinn.

    I changed
            org 0
    entry   mov outa #0
            mov dira,#1
            mov outa,#1
    b       nop
            jmp b
    
    It output pulse(high=150nsec Low=100nsec).
    And why it become to low?
  • JasonDorieJasonDorie Posts: 1,930
    edited 2012-01-19 18:26
    You need this:
            org 0
    entry   mov outa #0
            mov dira,#1
            mov outa,#1
    b       nop
            jmp [COLOR="#B22222"]#b[/COLOR]
    

    What your code is doing is jumping to the address in the memory location labelled 'b', not jumping to that literal address value. Since b is a nop, that memory location probably contains zero, which means your code is jumping back to 'entry'.
  • caskazcaskaz Posts: 957
    edited 2012-01-19 18:32
    Thank you, JasonDorie and kwinn
    I understand it.
Sign In or Register to comment.