Controlling OG-4 Decathron with PBP in an efficient way.


Closed Thread
Results 1 to 40 of 40

Hybrid View

  1. #1
    Join Date
    May 2013
    Location
    australia
    Posts
    2,393


    Did you find this post helpful? Yes | No

    Default Re: Controlling OG-4 Decathron with PBP in an efficient way.

    sub9 'subroutine for spinning - it is there
    only by mcs's good grace to call anything unknown a label, the colon is missing

    The whole circuit is assembled into box and potted with epoxy,
    that would be me out .
    Warning I'm not a teacher

  2. #2
    Join Date
    Feb 2013
    Posts
    1,079


    Did you find this post helpful? Yes | No

    Default Re: Controlling OG-4 Decathron with PBP in an efficient way.

    I potted it because it worked very fine, until I added that input parsing code
    I can build another one, that is not an issue...

  3. #3
    Join Date
    Apr 2014
    Location
    OK
    Posts
    557


    Did you find this post helpful? Yes | No

    Default Re: Controlling OG-4 Decathron with PBP in an efficient way.


    low
    tre
    next
    return
    subzero:
    What is "next" doing? Is that a forgotten relic from previous versions?

  4. #4
    Join Date
    Feb 2013
    Posts
    1,079


    Did you find this post helpful? Yes | No

    Default Re: Controlling OG-4 Decathron with PBP in an efficient way.

    Look a bit above: for cik=1 to sub 'amount needed for full loop

  5. #5
    Join Date
    Feb 2013
    Posts
    1,079


    Did you find this post helpful? Yes | No

    Default Re: Controlling OG-4 Decathron with PBP in an efficient way.

    Here is the main code, from which all this started. This is simple spinner, pausing at certain position after whole loop.

    Code:
    '****************************************************************
    '*  Name    : UNTITLED.BAS                                      *
    '*  Author  : [select VIEW...EDITOR OPTIONS]                    *
    '*  Notice  : Copyright (c) 2014 [select VIEW...EDITOR OPTIONS] *
    '*          : All Rights Reserved                               *
    '*  Date    : 15.05.2014                                        *
    '*  Version : 1.0                                               *
    '*  Notes   :                                                   *
    '*          :                                                   *
    '****************************************************************
    ANSEL = %00000000    
    CMCON0 = 7 
    TRISIO=%00001000
    OSCCON = %01110111
    'Include "Modedefs.bas"
    Define	OSC	8		' Set Xtal Frequency
    
    
    '	Clk     Var	GPIO.5		' Data is clocked on rising edge of this pin            kviteli
    '	Dta  	Var	GPIO.4		' Bits are shifted out of this pin          stafilosferi
    
    
    ZERO    var     GPIO.0
    ONE     VAR     GPIO.4
    TWO     VAR     GPIO.1
    TRE   VAR      GPIO.2
    cik var word
    x   var word
    cok var word
    lop var word
    
    
    x=50
    
    
    'INIT 
    LOW ONE
    LOW TWO
    LOW TRE
    HIGH ZERO
    PAUSE x
    LOW ZERO
    
    
    'this loop does smooth full turn
    
    
    xoxi:
    for cik=1 to 9
    high one
    pause x
    high two
    low one
    pause x
    high tre
    low two
    pause x
    low tre
    next
    
    
    high one  'proper finish?  one and two
    pause x
    low one
    high two
    pause x
    low two
    high zero
    pause 1000
    low zero
    goto xoxi
    It works fine, provides smooth looped animation.

    Now let's add something. Changed TRISIO=%00101000. Code works fine. Added button check loop, and it becomes messed - triggering of certain pin no longer works.

    Code:
    kuku:
    if gpio.5=0 then goto xoxi
    pause 1
    goto kuku

  6. #6
    Join Date
    Feb 2013
    Posts
    1,079


    Did you find this post helpful? Yes | No

    Default Re: Controlling OG-4 Decathron with PBP in an efficient way.

    Tried to change control pin to GPIO.3 (MCLR). No change, as long as reading of port occurs in software, the glitches come on.

  7. #7
    Join Date
    Feb 2013
    Posts
    1,079


    Did you find this post helpful? Yes | No

    Default Re: Controlling OG-4 Decathron with PBP in an efficient way.

    I think I've nailed it, and it appears to be both software and hardware issue. If input is activated, at startup, there is small pulse on random pin, which is short enough for not to be noticeable by eye, but enough to trigger dekathron (traced using scope). Solved by pulling down outputs via 10K to GND. S

  8. #8
    Join Date
    Feb 2013
    Posts
    1,079


    Did you find this post helpful? Yes | No

    Default Re: Controlling OG-4 Decathron with PBP in an efficient way.

    Name:  don1.jpg
Views: 1658
Size:  488.9 KB

    Almost there

Similar Threads

  1. Subroutine or repeated code, which is more memory efficient?
    By CuriousOne in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 5th June 2014, 22:38
  2. large & efficient electro magnet
    By therian in forum Off Topic
    Replies: 13
    Last Post: - 19th October 2012, 06:53
  3. Making code more efficient, any ideas please?
    By BobEdge in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 26th July 2011, 13:28
  4. Efficient comparison on data (iButton)
    By enigma in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 27th August 2010, 13:37
  5. Is there a more efficient way?
    By markedwards in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 25th July 2005, 23:38

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

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