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
Random Output on power-up
Moderator: Benj
-
- Posts: 26
- Joined: Thu Jul 12, 2007 4:59 pm
- Location: Nr Ipswich, Suffolk, England
- Contact:
-
- Posts: 26
- Joined: Thu Jul 12, 2007 4:59 pm
- Location: Nr Ipswich, Suffolk, England
- Contact:
-
- Posts: 26
- Joined: Thu Jul 12, 2007 4:59 pm
- Location: Nr Ipswich, Suffolk, England
- Contact:
- Steve
- Matrix Staff
- Posts: 3424
- Joined: Tue Jan 03, 2006 3:59 pm
- Has thanked: 114 times
- Been thanked: 422 times
- Contact:
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).
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).
- 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:
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.
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.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Posts: 26
- Joined: Thu Jul 12, 2007 4:59 pm
- Location: Nr Ipswich, Suffolk, England
- Contact: