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


Closed Thread
Results 1 to 40 of 40

Hybrid View

  1. #1
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,624


    Did you find this post helpful? Yes | No

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

    And stop using HIGH/LOW, those waste both time and space.

    The animation can most likely be done with two FOR loops. An outer that steps thru the starting position from 1 to 29 and an inner that "sweeps the circle" one revolution starting/stopping at the dot pointed to by the outer loop.

    If I'm not mistaken the effect you're after is similar to the the common "please wait the computer is busy" circle thingy you see on Windows systems?

    /Henrik.

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


    Did you find this post helpful? Yes | No

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

    You can't do it with two FOR loops, because you have to consider the reset pin and fact that number of dots is even, but number of control pins is odd. So it is always required to add an extra step out of loop, depending on even/odd current position.

    The effect I'm making is as follows. Rotation starts from dot 1 and comes again to dot 1, stops there for a second, then quickly rotates one full loop, but stops at dot #1. Waits for a second, full spin and stop at dot #2 and so on, till it makes full turn.

  3. #3
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,624


    Did you find this post helpful? Yes | No

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

    If you say so :-)
    Do you have a datasheet describing the driving signals, I'm having some difficulties understanding how it works based on your description.

    /Henrik.

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


    Did you find this post helpful? Yes | No

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

    I have only Russian book about it. But principle of operation is nicely shown in animation here:

    https://threeneurons.wordpress.com/dekatron-stuff/

  5. #5
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,170


    Did you find this post helpful? Yes | No

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

    Quote Originally Posted by HenrikOlsson View Post
    And stop using HIGH/LOW, those waste both time and space....
    /Henrik.
    Well, I have some doubts about this. If it relates to output port registers I think it is necessary to use High/Low commands. Or at least this used to be the case with older versions of PBB.

    Direct control of port registers like this portb.0=1 may cause problems when the program is long because of memory page issues. I may be wrong here. Anyone?

    Ioannis

  6. #6
    Join Date
    May 2013
    Location
    australia
    Posts
    2,695


    Did you find this post helpful? Yes | No

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

    If it relates to output port registers I think it is necessary to use High/Low commands.
    the only problem with high/low is that they waste time and code space setting/clearing the tris register ,every time they are invoked.


    Direct control of port registers like this portb.0=1 may cause problems when the program is long because of memory page issues.
    the only issue with direct port writes once you have the tris reg set appropriately is the potential for rmw issues , especially at high clock speeds.
    always use lat regs if possible and a shadow reg otherwise if rapid sequential port manipulation of individual pins will be employed
    Warning I'm not a teacher

  7. #7
    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.

    Most everything PIC made in the past decade features LATx Registers;
    LATB.0 = 1
    (Of course you could also insert a bit of ASM if FOSC cycles are important
    @ BANKSEL LATB
    @ BSF LATB,0

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


    Did you find this post helpful? Yes | No

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

    For this particular case, speed is not an issue, since these tubes have couple of KHz max operating frequency, and in my case there are Pause 30 and Pause 1000 statements

  9. #9
    Join Date
    Feb 2013
    Posts
    1,156


    Did you find this post helpful? Yes | No

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

    Run into strange problem - setting GPIO.5 as input messes with GPIO.4 - it becomes high when GPIO.5 is read, so disrupts complete code routine. I'm using TRISIO=%00100000 to make GPIO.5 as input. If I disable it as input, then other code works fine.

  10. #10
    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.

    In your code at the top of the page you list TRISIO=%00001000. Of course GPIO.3 is MCLR and is Input only. In the previous post you state you are having problems with TRISIO=%00100000. It's probably not your issue, but try TRISIO=%00101000.

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, 23:38
  2. large & efficient electro magnet
    By therian in forum Off Topic
    Replies: 13
    Last Post: - 19th October 2012, 07:53
  3. Making code more efficient, any ideas please?
    By BobEdge in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 26th July 2011, 14:28
  4. Efficient comparison on data (iButton)
    By enigma in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 27th August 2010, 14:37
  5. Is there a more efficient way?
    By markedwards in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 26th July 2005, 00: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