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