If this is all of the code, then You have to turn off all the analog stuff to get it to work, ADCON, ANSEL, and Comparators
http://www.picbasic.co.uk/forum/showthread.php?t=561
If this is all of the code, then You have to turn off all the analog stuff to get it to work, ADCON, ANSEL, and Comparators
http://www.picbasic.co.uk/forum/showthread.php?t=561
Last edited by Archangel; - 9th December 2008 at 01:09.
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.
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 !
Lets see some pictures![]()
Dave
Always wear safety glasses while programming.
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.
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.....
We might be able to help if we could see your code.
Dave
Always wear safety glasses while programming.
OK Just didn't want to clutter up the forum with my lengthy and probably badly written code, but here goes !
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.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
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
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.
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...
How about that?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
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.
Bookmarks