Auto Light-Continiousely On?

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 5.
To post in this forum you must have a registered copy of Flowcode 5 or higher.

Moderator: Benj

Post Reply
JDR04
Posts: 271
Joined: Tue Mar 05, 2013 10:49 pm
Has thanked: 111 times
Been thanked: 13 times
Contact:

Auto Light-Continiousely On?

Post by JDR04 »

Hope somebody can help me with this.

With kind help from medelec35 I have constructed a program that will detect when light levels fall below a set threshold and a LED will turn on.

I have made a few small changes and added some stuff myself. The simulation works 100% and am happy with it.

However...... when I come to construct the circuit there seems to be a problem with the very beginning of the program. The intention is when power is applied, an LED and a BUZZER will come on twice and then the program moves on. I have connected the LED and the buzzer but the buzzer just turns on continuisely. The LED seems to be off.

Once I can get the first stage to work then I'll move onto connecting up the threshold pot and the phototransistor.


I've attached the flowchart and would appreciate somebodies help and advice on this. Thanks a lot John
Attachments
Auto Lightby Martin 1.1.fcf
(12 KiB) Downloaded 271 times

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: Auto Light-Continiousely On?

Post by Benj »

Hello,

Sounds like a great project and a good way to improve your skills.

In the initial loop there needs to be a delay after the PortA = 0 output icon to allow the off period to be "seen/heard" by the user. Otherwise your almost instantly back to switching the output on again.

The reason that your LED is not lighting could be the fact that you have no configuration settings for your device and the A5 pin will automatically be tied to the oscillator circuit. If you go into the Build -> Project options -> General Options Tab then tick the Configure the chip tick box and click the configure chip button.

The Settings you probably need are going to be like this.
config.jpg
config.jpg (93.74 KiB) Viewed 3267 times
Internal RC no clock specifies the internal oscillator and that the osc pins A4 & 5 can be used as I/O.
The other key setting I changed is the Watchdog setting which is an advanced feature and periodically resets the device to ensure it is running the code correctly. Unless you specifically want this I would advise to always disable.

Click OK and next you need to assign the correct clock speed for your project so the delay icons work as expected.

By default the internal oscillator will fire up at 4MHz on your 12F683 so set the clock speed setting to 4000000.

Click OK again and now hopefully your program should run as intended on the hardware.

JDR04
Posts: 271
Joined: Tue Mar 05, 2013 10:49 pm
Has thanked: 111 times
Been thanked: 13 times
Contact:

Re: Auto Light-Continiousely On?

Post by JDR04 »

Thanks Benj, will give it a bash tomorrow.

Appreciate the help.......John

Post Reply