Shop OBEX P1 Docs P2 Docs Learn Events
bitpattern to setup CTRA for negedge-mode on pin 3 — Parallax Forums

bitpattern to setup CTRA for negedge-mode on pin 3

StefanL38StefanL38 Posts: 2,292
edited 2011-10-10 14:31 in Propeller 1
Hi,

I would like to setup CTRA for neg-edge-mode on PIN 3 (based on pin-counting starting at 0)

How I understand the docs about counters I would use the following binary value
 ' 3         2         1
 '10987654321098765432109876543210
'%-CMODEPLL--------B__PIN---A__PIN
'%00111000000000000000000000000011

where 01110 is the countermode located in bits 30..26
PLL-mode not needed for this countermode
A-PIN 3 located in bits 5..0 as %000011

FRQA is set to 1

and then every time a high-to-low-transition on pin 3 happens PHSA should increment by 1
But it does not work. What am I doing wrong?

best regards

Stefan

Comments

  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2011-10-10 08:15
    Can you show us your actual code that sets up ctra and frqa and checks phsa for increments?

    -Phil
  • Cluso99Cluso99 Posts: 18,069
    edited 2011-10-10 13:34
    IIRC you also have to make pin 3 an output as in "mov outa,#3". We need to see the code.

    BTW I am far from an expert with counters - so much functionality but no time to explore. Koroneko and Phil are the kings :)
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2011-10-10 14:31
    Actually, no, you want pin 3 to be an input, since that's the pin whose negative edges are being counted. (BTW, mov outa,#3 doesn't make pin 3 an output; mov dira, #1<<3 would do that.)

    -Phil
Sign In or Register to comment.