Old and beyond help ?


Closed Thread
Results 1 to 40 of 47

Hybrid View

  1. #1
    Join Date
    Dec 2007
    Location
    Northants England
    Posts
    38


    Did you find this post helpful? Yes | No

    Default

    Very many thanks. I now have the system fully operational and can start programming the Star of David which should now be appearing in the village tomorrow evening. It might not seem much but by this time tomorrow I confidently expect the village will be swarming with wise men and shepherds. Thanks again folks !

  2. #2
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Lets see some pictures
    Dave
    Always wear safety glasses while programming.

  3. #3
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by DavidFMarks View Post
    . . .It might not seem much but by this time tomorrow I confidently expect the village will be swarming with wise men and shepherds. . . !
    You obviously do not live in Washington DC.
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  4. #4
    Join Date
    Dec 2007
    Location
    Northants England
    Posts
    38


    Did you find this post helpful? Yes | No

    Default

    Spoke too soon !... Not about the shepherds and wise men but about the program working. I have been programming a whole load of different sequences one after another. They have all worked ok until the last few, the program simply ignores them and returns to the beginning. If i bung in a goto directly to the last few sequences the behave erratically (cutting short loops etc. I wonder if I have broken some rule about memory size or borders or some such as I am far from clear on this subject .... To hell with the shepherds I just need the wise men.....

  5. #5
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    We might be able to help if we could see your code.
    Dave
    Always wear safety glasses while programming.

  6. #6
    Join Date
    Dec 2007
    Location
    Northants England
    Posts
    38


    Did you find this post helpful? Yes | No

    Default

    OK Just didn't want to clutter up the forum with my lengthy and probably badly written code, but here goes !
    Code:
    '***********CHRISTMAS STAR PROGRAM FOR OPERATING  *************
    '**********A 16 ARM STAR WITH 8 LEDS ON EACH ARM  *************
    '******ARMS CONNECTED TO PORTS A AND C  AND EACH "RING"  ******
    '***************CONNECTED TO A PIN OF PORT D ******************
    
    '************AUTHOR DAVID MARKS DEC 2008 ***********************8
    
     @ DEVICE pic16f887,intrc_osc_noclkout
    ansel = %00000000
    delay var word
    
    fastflash var word
    
    PORTD = 0
    PORTA = 0
    PORTC = 0
    TRISD = 0
    TRISA = 0
    TRISC = 0
    fastflash = 150
     
    Ring0 var portd.0
    Ring1 var portd.1
    Ring2 var portd.2
    Ring3 var portd.3
    Ring4 var portd.4
    Ring5 var portd.5
    Ring6 var portd.6
    Ring7 var portd.7
    Arm0 var Portc.0
    Arm1 var Portc.1
    Arm2 var Portc.2
    Arm3 var Portc.3
    Arm4 var Portc.4
    Arm5 var Portc.5
    Arm6 var Portc.6
    Arm7  var Portc.7
    Arm8   var Porta.0
    Arm9   var Porta.1
    Arm10  var Porta.2
    Arm11  var Porta.3
    Arm12  var Porta.4
    Arm13  var Porta.5
    Arm14  var Porta.6
    Arm15  var Porta.7 
    
    loop
    
      '********************************************
      'EXPANDING WHITE CIRCLES
      '********************************************
     For delay = 400 to 0 step -25
     high Arm0
     high Arm2
     high Arm4
     high Arm6
     high Arm8
     high Arm10
     high Arm12
     high Arm14
    High Ring0
    pause delay
    Low ring0
    High Ring1
    pause delay
    Low ring1
    High Ring2
    pause delay
    Low Ring2
    High Ring3
    pause delay
    Low ring3
    High Ring4
    pause delay
    low ring4
    High Ring5
    pause delay
    Low Ring5
    High Ring6
    pause delay
    Low Ring6
    High Ring7
    pause delay
    low Ring7
    next delay
    LOW ARM0
    LOW ARM2
    LOW ARM4
    LOW ARM6
    LOW ARM8
    LOW ARM10
    LOW ARM12
    LOW ARM14
     
    '**************************************************
    'EXPANDING RED CIRCLES
    '**************************************************
    For delay = 400 to 0 step -25
     high Arm1
     high Arm3
     high Arm5
     high Arm7
     high Arm9
     high Arm11
     high Arm13
     high Arm15
     High Ring0
    pause delay
    Low ring0
    High Ring1
    pause delay
    Low ring1
    High Ring2
    pause delay
    Low Ring2
    High Ring3
    pause delay
    Low ring3
    High Ring4
    pause delay
    low ring4
    High Ring5
    pause delay
    Low Ring5
    High Ring6
    pause delay
    Low Ring6
    High Ring7
    pause delay
    low Ring7
    next delay 
    '************************************************
    'EXPANDING MULTICOLOUR CIRCLES
    '************************************************
     For delay = 400 to 0 step -25
     high Arm0
     high Arm1
     high Arm2
     high Arm3
     high Arm4
     high Arm5
     high Arm6
     high Arm7
     high Arm8
     high Arm9
     high Arm10
     high Arm11
     high Arm12
     high Arm13
     high Arm14
     high Arm15
    High Ring0
    pause delay
    Low ring0
    High Ring1
    pause delay
    Low ring1
    High Ring2
    pause delay
    Low Ring2
    High Ring3
    pause delay
    Low ring3
    High Ring4
    pause delay
    low ring4
    High Ring5
    pause delay
    Low Ring5
    High Ring6
    pause delay
    Low Ring6
    High Ring7
    pause delay
    low Ring7
    next delay 
    '*****************************************************
    'EXPANDING WHITE DISC
    '*****************************************************
    low arm1
    low arm3
    low arm5
    low arm7
    low arm9
    low arm11
    low arm13
    low arm15
    For delay = 400 to 0 step -25
     high Arm0
     high Arm2
     high Arm4
     high Arm6
     high Arm8
     high Arm10
     high Arm12
     high Arm14
    High Ring0
    pause delay
    High Ring1
    pause delay
    High Ring2
    pause delay
    High Ring3
    pause delay
    High Ring4
    pause delay
    High Ring5
    pause delay
    High Ring6
    pause delay
    High Ring7
    pause delay
    
    LOW RING0
    LOW RING1
    LOW RING2
    LOW RING3
    LOW RING4
    LOW RING5
    LOW RING6
    LOW RING7
    NEXT DELAY
    '******************************************************
    'flash all white
    '******************************************************
    fOR DELAY = 0 TO 100
    high ring0
     high ring1
     high ring2
     high ring3
     high ring4
     high ring5
     high ring6 
     high ring7
     PAUSE fastflash
      LOW RING0
    LOW RING1
    LOW RING2
    LOW RING3
    LOW RING4
    LOW RING5
    LOW RING6
    LOW RING7
    PAUSE fastflash
    NEXT DELAY
    '******************************************************
    'EXPANDING RED DISC
    '******************************************************
     
    lOW ARM0
    low arm2
    low arm4
    low arm6
    low arm8
    low arm10
    low arm12
    low arm14
    
    For delay = 400 to 0 step -25
     high Arm1
     high Arm3
     high Arm5
     high Arm7
     high Arm9
     high Arm11
     high Arm13
     high Arm15
    High Ring0
    pause delay
    High Ring1
    pause delay
    High Ring2
    pause delay
    High Ring3
    pause delay
    High Ring4
    pause delay
    High Ring5
    pause delay
    High Ring6
    pause delay
    High Ring7
    pause delay
    LOW RING0
    LOW RING1
    LOW RING2
    LOW RING3
    LOW RING4
    LOW RING5
    LOW RING6
    LOW RING7
    NEXT DELAY
    '*********************************************
    'FLASH ALL RED
    '*********************************************
    fOR DELAY = 0 TO 100
    high ring0
     high ring1
     high ring2
     high ring3
     high ring4
     high ring5
     high ring6 
     high ring7
     PAUSE fastflash
      LOW RING0
    LOW RING1
    LOW RING2
    LOW RING3
    LOW RING4
    LOW RING5
    LOW RING6
    LOW RING7
    PAUSE fastflash
    NEXT DELAY
    '*********************************************
    'EXPANDING MULTICOLOUR DISC
    '*********************************************
     HIGH ARM0
     high Arm1
     high Arm2
     high Arm3
     high Arm4
     high Arm5
     high Arm6
     high Arm7
     high Arm8
     high Arm9
     high Arm10
     high Arm11
     high Arm12
     high Arm13
     high Arm14
     high Arm15
    For delay = 400 to 0 step -25
    High Ring0
    pause delay
    High Ring1
    pause delay
    High Ring2
    pause delay
    High Ring3
    pause delay
    High Ring4
    pause delay
    High Ring5
    pause delay
    High Ring6
    pause delay
    High Ring7
    pause delay
    LOW RING0
    LOW RING1
    LOW RING2
    LOW RING3
    LOW RING4
    LOW RING5
    LOW RING6
    LOW RING7
    NEXT DELAY
    '*******************************************************************
    'flashall
    '*******************************************************************
     HIGH ARM0
     high Arm1
     high Arm2
     high Arm3
     high Arm4
     high Arm5
     high Arm6
     high Arm7
     high Arm8
     high Arm9
     high Arm10
     high Arm11
     high Arm12
     high Arm13
     high Arm14
     high Arm15
     
     For delay = 400 to 0 step -25
     high ring0
     high ring1
     high ring2
     high ring3
     high ring4
     high ring5
     high ring6 
     high ring7
     pAUSE DELAY
    LOW RING0
    LOW RING1
    LOW RING2
    LOW RING3
    LOW RING4
    LOW RING5
    LOW RING6
    LOW RING7
    Pause delay
    next delay
    For delay = 0 to 100
    high ring0
     high ring1
     high ring2
     high ring3
     high ring4
     high ring5
     high ring6 
     high ring7
     pause fastflash
     LOW RING0
    LOW RING1
    LOW RING2
    LOW RING3
    LOW RING4
    LOW RING5
    LOW RING6
    LOW RING7
    next delay
     '****************************************
     'ROTATE WHITE
     '****************************************
    high ring0
     high ring1
     high ring2
     high ring3
     high ring4
     high ring5
     high ring6
     high ring7
     for delay = 400 to 50 step -30 
      hIGH arm0
     high arm8
     pause delay
     low arm0
     low arm8
     high arm2
     high arm10
     pause delay
     low arm2
     low arm10
     high arm4
     high arm12
     pause delay
     low arm4
     low arm12
     high arm6
     high arm14
     pause delay
     low arm6
     low arm14
     next delay
     '*********************************************
     'ROTATE MULTI
     '*********************************************
    high ring0
     high ring1
     high ring2
     high ring3
     high ring4
     high ring5
     high ring6
     high ring7
     for delay = 300 to 50 step -10 
     hIGH arm0
     HIGH ARM15
     HIGH ARM1
     high arm8
     HIGH ARM7
     HIGH ARM9
     pause delay
     low arm0
     low arm8
     LOW ARM7
     LOW ARM15
     high arm2
     high arm10
     HIGH ARM11
     HIGH ARM3
     pause delay
     low arm2
     LOW ARM1
     low arm10
     LOW ARM9
     high arm4
     high arm12
     HIGH ARM5
     HIGH ARM13
     pause delay
     low arm4
     LOW ARM3
     LOW ARM11
     low arm12
     high arm6
     high arm7
     high arm15
     high arm14
     pause delay
     low arm6
     low arm5
     low arm13
     low arm14
     next delay
     goto loop
    The program runs ok until somewher near the end of the @flashall section then instead of going thru the rotate routines it jumps back to the beginning and starts again.
    I would be very happy to post a picture or video clip if someone could point me towards the instructions for doing so which I cant seem to find !
    Thanks all

  7. #7
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    I do not see the problem in your code. Maybe it is a hardware problem? Power supply dropping out by the time it is finished with "flashall" causing a reset? Add a BIG capacitor across the rails? 4700uf?

    Sorry, I am not much help.

    If you want to see how some one else has created a post, just click the quote button. It shows all.

    Here is a thread about pictures
    http://www.picbasic.co.uk/forum/showthread.php?t=9156

    Videos
    http://www.picbasic.co.uk/forum/showthread.php?t=9531
    Dave
    Always wear safety glasses while programming.

  8. #8
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Different way of doing your code (may have messed some of it up along the way)
    Also, not sure about the '887 and it's watchdog timer, so added a chunk to your DEVICE statement to turn it off.
    Your code wasn't badly written, just a bit lengthy and could have stood to be shortened up a bit, things combined here and there...
    Code:
    '***********CHRISTMAS STAR PROGRAM FOR OPERATING  *************
    '**********A 16 ARM STAR WITH 8 LEDS ON EACH ARM  *************
    '******ARMS CONNECTED TO PORTS A AND C  AND EACH "RING"  ******
    '***************CONNECTED TO A PIN OF PORT D ******************
    '************AUTHOR DAVID MARKS DEC 2008 ***********************8
    @ DEVICE pic16f887,intrc_osc_noclkout,wdt_off
    ansel=0 : delay var word : fastflash var word : temp var byte
    fastflash = 150
    PORTD=0 : PORTA=0 : PORTC=0 : TRISD=0 : TRISA=0 : TRISC=0
    ring var portd : arma var portc : armb var porta
    loop:
      '********************************************
      'EXPANDING WHITE CIRCLES
      '********************************************
    For delay = 400 to 0 step -25
    	arma = $55 : armb = $55 : gosub ringer
    next delay
    arma = 0 : armb = 0
    '**************************************************
    'EXPANDING RED CIRCLES
    '**************************************************
    For delay = 400 to 0 step -25
    	arma = $aa : armb = $aa : gosub ringer
    next delay
    '************************************************
    'EXPANDING MULTICOLOUR CIRCLES
    '************************************************
    For delay = 400 to 0 step -25
    	arma = $ff : armb = $ff : gosub ringer
    next delay
    '*****************************************************
    'EXPANDING WHITE DISC
    '*****************************************************
    arma=0 : armb=0
    For delay = 400 to 0 step -25
    	arma = $55 : armb = $55 : gosub ringer : ring = 0
    next delay
    '******************************************************
    'flash all white
    '******************************************************
    fOR DELAY = 0 TO 100
    	ring = $ff : pause fastflash : ring = 0 : pause fastflash
    next delay
    '******************************************************
    'EXPANDING RED DISC
    '******************************************************
    arma=0 : armb=0
    For delay = 400 to 0 step -25
    	arma = $aa : armb = $aa : gosub ringer : ring = 0
    NEXT DELAY
    '*********************************************
    'FLASH ALL RED
    '*********************************************
    fOR DELAY = 0 TO 100
    	ring = $ff : pause fastflash : ring = 0 : pause fastflash
    next delay
    '*********************************************
    'EXPANDING MULTICOLOUR DISC
    '*********************************************
    arma=$ff : armb=$ff
    For delay = 400 to 0 step -25
    	gosub ringer : ring = 0
    next delay
    '*******************************************************************
    'flashall
    '*******************************************************************
    arma=$ff : armb=$ff
    For delay = 400 to 0 step -25
    	ring = $ff : pause delay : ring = 0 : Pause delay
    next delay
    For delay = 0 to 100
    	ring = $ff : pause fastflash : ring = 0
    next delay
     '****************************************
     'ROTATE WHITE
     '****************************************
    ring = $ff
    for delay = 400 to 50 step -30 
    	for temp = 0 to 7 step 2
    		arma.0[temp] = 1 : armb.0[temp] = 1
    		pause delay
    		arma.0[temp] = 0 : armb.0[temp] = 0
    	next temp
    next delay
     '*********************************************
     'ROTATE MULTI
     '*********************************************
    ring = $ff
    for delay = 300 to 50 step -10 
    	arma = $83 : armb = $83 : pause delay : arma = 0 : armb = 0
    	pause delay : arma = $06 : armb = $06 : pause delay : arma = 0
    	armb = 0 : arma = $30 : armb = $30 : pause delay : arma = 0
    	armb = 0 : arma = $c0 : armb = $c0 : pause delay : arma = 0 : armb = 0
    	armb = 0
    next delay
    goto loop
    ringer:  for temp = 0 to 7 : ring.0[temp] = 1 : pause delay : ring.0[temp] = 0
    pause delay : next temp : return
    How about that?





    And for all those that have missed it...
    Here's some colons I had to get off my chest
    Code:
    @ DEVICE pic16f887,intrc_osc_noclkout,wdt_off
    ansel=0:delay var word:fastflash var word:temp var byte:fastflash=150:PORTD=0
    porta=0:portc=0:trisd=0:trisa=0:trisc=0:ring var portd:arma var portc
    armb var porta:armb var porta
    loop:  for delay=400 to 0 step -25:arma=$55:armb=$55:gosub ringer:next delay
    arma=0:armb=0:for delay=400 to 0 step -25:arma=$aa:armb=$aa:gosub ringer
    next delay:for delay=400 to 0 step -25:arma=$ff:armb=$ff:gosub ringer
    next delay:arma=0:armb=0:For delay=400 to 0 step -25:arma=$55:armb=$55
    gosub ringer:ring=0:next delay:for delay=0 to 100:ring=$ff:pause fastflash
    ring=0:pause fastflash:next delay:arma=0:armb=0:for delay=400 to 0 step -25
    arma=$aa:armb=$aa:gosub ringer:ring=0:next delay:for delay=0 to 100:ring=$ff
    ring=$ff:pause fastflash:ring=0:pause fastflash:next delay:arma=$ff:armb=$ff
    for delay=400 to 0 step -25:gosub ringer:ring=0:next delay:arma=$ff:armb=$ff
    for delay=400 to 0 step -25:ring=$ff:pause delay:ring=0:pause delay
    next delay:for delay=0 to 100:ring=$ff:pause fastflash:ring=0:next delay
    ring=$ff:for delay=400 to 50 step -30:for temp=0 to 7 step 2:arma.0[temp]=1
    armb.0[temp]=1:pause delay:arma.0[temp]=0:armb.0[temp]=0:next temp:next delay
    ring=$ff:for delay=300 to 50 step -10:arma=$83:armb=$83:pause delay:arma=0
    armb=0:pause delay:arma=6:armb=6:pause delay:arma=0:armb=0:arma=$30:armb=$30
    pause delay:arma=0:armb=0:arma=$c0:armb=$c0:pause delay:arma=0:armb=0:armb=0
    next delay:goto loop
    ringer: for temp=0 to 7:ring.0[temp]=1:pause delay:ring.0[temp]=0:pause delay
    next temp:return
    END
    Last edited by skimask; - 10th December 2008 at 14:51.

  9. #9
    Join Date
    Dec 2007
    Location
    Northants England
    Posts
    38


    Did you find this post helpful? Yes | No

    Default

    No go so far I'm afraid tried the new code but there are a number of errors which I haven't checked out yet. Tried switching watchdog timer off and have put lots of capacitance across the 4.8 volt supply to the pickit2. (There are only three octal darlingtonds in circuit and there is no sign that the voltage drops when they are all on. The program runs until the "expanding multicolour disc" section. It then appears to go about seven times round the for next loop (For delay = 400 to 0 step -25) . and then starts again at the beginning of the program i.e. It resets. BTW Like the look of the shortened code although I haven't figured it all out yet !

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