+ Reply to Thread
Results 1 to 3 of 3

Thread: Test

  1. #1

    Default Test

    Code:
    pub config(pin1, mode1, state1)  'pin, 0-single 1-dual, 0-manual 1-auto refresh, returns ID of refresh cog
    
      if (not state) and state1   'clears cog influence when transitioning from manual state to auto state
        dira[pin1]~
        outa[pin1]~
        
      pin  := pin1             'set internal
      mode := mode1            'configuration
      state := state1          'variables
      
      if not state         'get cog ready to pulse and kill any auto cog
        stop
        dira[pin]~~
        outa[pin]~
    
      if state                  'setup and launch refresh cog in auto mode
        if not motor1           'set motor1 pulsewidth if not set
          set_motor1(1500)
        if not motor2           'set motor2 pulsewidth if not set
          set_motor2(1500)
        if not cog              'launch refresh cog if not already running
          cog := cognew(refresh_cog, @hb_stack) + 1
    
      return cog - 1          'returns cog running refresh code, returns -1 if no refresh cog running
    End of test

  2. #2

    Default Re: Test

    test bold test quote
    quote

  3. #3
    mklrobo's Avatar
    Location
    Raleigh, North Carolina
    Posts
    406
    Blog Entries
    2

    Default Re: Test

    Quote Originally Posted by w4fej View Post
    Code:
    pub config(pin1, mode1, state1)  'pin, 0-single 1-dual, 0-manual 1-auto refresh, returns ID of refresh cog
    
      if (not state) and state1   'clears cog influence when transitioning from manual state to auto state
        dira[pin1]~
        outa[pin1]~
        
      pin  := pin1             'set internal
      mode := mode1            'configuration
      state := state1          'variables
      
      if not state         'get cog ready to pulse and kill any auto cog
        stop
        dira[pin]~~
        outa[pin]~
    
      if state                  'setup and launch refresh cog in auto mode
        if not motor1           'set motor1 pulsewidth if not set
          set_motor1(1500)
        if not motor2           'set motor2 pulsewidth if not set
          set_motor2(1500)
        if not cog              'launch refresh cog if not already running
          cog := cognew(refresh_cog, @hb_stack) + 1
    
      return cog - 1          'returns cog running refresh code, returns -1 if no refresh cog running
    End of test
    It looks like the program gets a cog to pulse a motor, automatically. I am curious,what is the total flow chart of the
    whole program? Thanks.

+ Reply to Thread

Similar Threads

  1. Bit test or -flag test in spin
    By gwkaub in forum Propeller 1 Multicore Microcontroller
    Replies: 7
    Last Post: 04-29-2014, 03:28 AM
  2. Replies: 18
    Last Post: 10-30-2012, 07:02 AM
  3. SD Card Test (Please test - may be used for boot code for the Prop2)
    By Cluso99 in forum Propeller 1 Multicore Microcontroller
    Replies: 173
    Last Post: 09-03-2012, 08:37 AM
  4. Replies: 2
    Last Post: 05-13-2011, 07:37 PM
  5. Replies: 5
    Last Post: 11-05-2009, 06:12 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts