Shop OBEX P1 Docs P2 Docs Learn Events
RC pulsin in SX assembly ? — Parallax Forums

RC pulsin in SX assembly ?

Rob v.d. bergRob v.d. berg Posts: 89
edited 2005-06-01 20:05 in General Discussion
Hello,

I'm thinking to use the SX ships to make some timing critical·think as RC pulsin (1-2msec) with· high resolution < 2usec·variable 0-1000/0-1500. But I have no experience with the SX/B in assembly.

Can someone give me some hints to get a idea how the assembly looks like when I want to make this. Maybe there is already assembly for reading the Radio Control pulses ?

Any help is welcome

Regards
Rob.

Comments

  • BeanBean Posts: 8,129
    edited 2005-06-01 13:13
    Rob,
    PULSIN has a resolution of 10uSeconds.
    If you need more than that, it's fairly easy, but you'll have to deal with numbers that are larger than a byte.

    Can you give more details ? What are you going to do with the values after to measure them ?

    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "SX-Video·Module" Now available from Parallax for only $28.95 http://www.parallax.com/detail.asp?product_id=30012


    Product web site: www.sxvm.com

    "It's not getting what you want, it's wanting what you've got."
    ·
  • Rob v.d. bergRob v.d. berg Posts: 89
    edited 2005-06-01 18:40
    Hi Bean,

    Thanks for your reply. Depending on two R/C pulses (1-2msec) i want to control the 4 (X) ruder of my submarine.
    Both R/C channels are mix inside the sender, and must go to 4 servo's. Depending on the horizontal state and depth of the sub, the 4 ruders must by changed (PD algoritme). The sensors are connected to a LTC1298 AD converter (12bits) 0-5 volt = ~0-4096.
    To control the servo's there are two opties:
    1- by uart >> Parallax Servo Controller (2usec) variable must by 500-1000
    2 -by making PWM's with atleast 2usec resolution.

    I was busy to make it in the Javelin, but the resolution of the Pulsin (8,68usec) is for my to big. And the cyclus time is not fast enough.

    When i look for the PulsIn SX/B and use the 1usec resolution the max puls length is 255usec ?.

    Regards
    Rob.
  • BeanBean Posts: 8,129
    edited 2005-06-01 18:43
    SX/B PULSIN resolution is in 10usec not 1usec.

    With all that you have going on, I would use a 2usec interrupt routine to handle it all.
    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "SX-Video·Module" Now available from Parallax for only $28.95 http://www.parallax.com/detail.asp?product_id=30012


    Product web site: www.sxvm.com

    "It's not getting what you want, it's wanting what you've got."
    ·
  • Rob v.d. bergRob v.d. berg Posts: 89
    edited 2005-06-01 18:54
    Hi Bean,

    Can you give me some code idea, how a interrupt routine for the SX looks like ?

    Regards
    Rob.
  • KenMKenM Posts: 657
    edited 2005-06-01 19:15
    Below is an interupt that will occur every 1 uS.

    Inside the interupt you can make the pin alternate high and low every other entry giving you a 500kHz square wave, 1us high, 1uS low.
    ;Interupt occurs every 1 uS
    org   $000                           ;RTCC roll over every 1 uS
          ;execute some code, make a pin high
          ;next eime make it low
           mov         w,#-50            ;preset rollover
          retiw                          ;return from ISR
     
    
    
  • Rob v.d. bergRob v.d. berg Posts: 89
    edited 2005-06-01 20:05
    thanks,

    for reading·pulses i must·check every usec the status·of the pin!, and set a counter

    Rob.
Sign In or Register to comment.