input and out put problem

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 2 and 3.

Moderators: Benj, Mods

Post Reply
medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: input and out put problem

Post by medelec35 »

Hello scorpy77.
In what way was your hardware not working as expect?
Did LED's light up at all?
Are you using EB006 programmer?
If you want to compile to Hex, and paste that, I can check your configuration settings are being transfered OK.
I did notice a couple of things with your software.
1) With a target speed of 19660800 Hz, you should use HS and not XT. This can by changed by 'Chip', 'Configure' then 'Switch to expert screen'

2) You will only get a random number when you release switch. The variable is counting in 1's, but it is counting very quickly with switch pressed in, so by the time switch is released it would of added 100's to variable. You will need to change your flowcode so it is not counting all the time the switch is held down (unless you require random numbers of course).

If you get stuck and that is the issue, then I can help you further.
Martin

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: input and out put problem

Post by medelec35 »

Try this for counting.

Note: When you are setting options in the expert config screen' set is in the picture.
Config.jpg
Config.jpg (77.35 KiB) Viewed 4342 times
Attachments
input1.fcf
(6 KiB) Downloaded 260 times
Martin

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:

Re: input and out put problem

Post by Benj »

Hello,

If you are having wierd switch input problems then are you leaving the input pins floating at any time.

One common mistake is to have the I/O pin connected to VCC for a logic 1 and to disconnect the pin for a logic 0. This will not work in practise and you should have a weak pull down resistor to avoid noise entering the pin when the switch is not pressed.

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:

Re: input and out put problem

Post by Benj »

Hello Scorpy,

I think the problem may relate to the operation of your loop. It may be worth adding a small delay say 10 - 20 ms into the loop. If you do not have this delay in your program then you could potentially detect thousands of button presses rather then a single button press. This way you may also be able to get rid of the blocking functions eg the wait until low macros.

Post Reply