Page 1 of 1

Random Output on power-up

Posted: Sun Jul 29, 2007 4:33 pm
by steamydave
Hi,

I have been tinkering with the new components. A simple routine I wrote was like this...

Delay 1s
LEDOn 0
WaitForSwitch 1
WriteLEDs = 0

When this is downloaded, I expect that after 1 second, the first LED should light until I press the button.

After programing, after the 1 second, I get a random set of LEDs light up. They all go out when the button is pressed.
If I reset with the reset button, after pressing the button, the routine then behaves correctly, with just 1 LED lit.
If I reset without pressing the button, the randon lights come on after the 1 second.
Switching off, and on again, the random LED pattern re-appears.

examples for each power-up as follows...
00000001 ok
10011111 x
00000011 x
00000001 ok
00000001 ok
10011011 x
10011011 x
00000011 x
10000011 x
10000011 x
00000001 ok

Posted: Sun Jul 29, 2007 7:44 pm
by Steve
Hello Dave,

Please send the program to Ben: support@matrixmultimedia.co.uk and he'll have a look.

Posted: Sun Jul 29, 2007 7:58 pm
by steamydave
Thanks Steve,

I will send the file as requested.

Just as a thought, is there a way to see the flowcode "code" in text form, for posting examples here for example.

Dave

Posted: Sun Jul 29, 2007 7:59 pm
by steamydave
Just seen that you can save the flowcaode as a JPG, so that's a start I guess.

Dave

Posted: Mon Jul 30, 2007 9:11 am
by Steve
The software we use for this forum will soon be updated to allow attachments. Once this new verison has been released, you will be able to post FCF, C, HEX files (etc) as well as images.

If your Flowcode program is not too big, you can always copy the relevant parts of the C file and display them in a post to the forum (each icon's display name and details are written to the C file as comments).

Posted: Mon Jul 30, 2007 9:26 am
by Benj
Hello

When the PICmicro starts up a lot of the registers are in an undefined state. This includes the port registers and therefore means that the output state cannot be determined. If you need to have a fixed output on startup then the easiest way is to initialise the port register with a value at the start of your program. Eg write a 0 to the LEDs before anything else is done.

Posted: Mon Jul 30, 2007 10:49 am
by steamydave
Thnaks Ben,

Will do.

Dave