Random Output on power-up

For Formula Flowcode Micromouse users to discuss projects, flowcharts, and any other issues related to the Formula Flowcode Micromouse.

Moderator: Benj

Post Reply
steamydave
Posts: 26
Joined: Thu Jul 12, 2007 4:59 pm
Location: Nr Ipswich, Suffolk, England
Contact:

Random Output on power-up

Post 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

User avatar
Steve
Matrix Staff
Posts: 3424
Joined: Tue Jan 03, 2006 3:59 pm
Has thanked: 114 times
Been thanked: 422 times
Contact:

Post by Steve »

Hello Dave,

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

steamydave
Posts: 26
Joined: Thu Jul 12, 2007 4:59 pm
Location: Nr Ipswich, Suffolk, England
Contact:

Post 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

steamydave
Posts: 26
Joined: Thu Jul 12, 2007 4:59 pm
Location: Nr Ipswich, Suffolk, England
Contact:

Post by steamydave »

Just seen that you can save the flowcaode as a JPG, so that's a start I guess.

Dave

User avatar
Steve
Matrix Staff
Posts: 3424
Joined: Tue Jan 03, 2006 3:59 pm
Has thanked: 114 times
Been thanked: 422 times
Contact:

Post 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).

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

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

steamydave
Posts: 26
Joined: Thu Jul 12, 2007 4:59 pm
Location: Nr Ipswich, Suffolk, England
Contact:

Post by steamydave »

Thnaks Ben,

Will do.

Dave

Post Reply