Page 1 of 1

Help / examples needed.

Posted: Thu Oct 22, 2009 11:21 pm
by canielsen
Hi
IΒ΄m newbie, and iΒ΄m trying to make a program with 4 switches and a LCD, but im need some help.
The program should works like this:
When one of the 4 switches a are pressed, there should be a message on the display, that mentioned which of the switches were pressed, and and output pin on a port should go high, until another switch are pressed.
When another switch are pressed, another output pin on the port should be activated, and the display should now indicate which switch were pressed.

I am trying to make a circuit, where i can switch between 4 outputs, by pressing the accoiated switch, and the display should indicate - which output are activated.

IΒ΄ll hope you understand what i mean.

I can not find any example that can help me to make this program.
IΒ΄m using Flowcode 3 pro (purchased from ELEKTOR) and a 16F877A.

Can anyone help me with a example ?.

Re: Help / examples needed.

Posted: Fri Oct 23, 2009 7:59 am
by Benj
Hello

Ok it sounds like you need to do something like this inside a while 1 loop.

Use an input icon to read a single input pin.

Using a decision icon see if the input pin is a logic 1.

If it is then send the appropriate text to the LCD and set the appropriate output also clear all other outputs.

Repeat for other switches.

Re: Help / examples needed.

Posted: Fri Oct 23, 2009 8:31 am
by Sean
Here is a program that hopefully demonstrates the features you need. It is set up for inputs on Port D 0 - 3 and outputs on Port C 0 - 3. These are easy to change if they do not match your application. The LCD is on Port B - default connections.
Switch2LCD.fcf
(8 KiB) Downloaded 338 times
The program also works well in simulation.

Re: Help / examples needed.

Posted: Fri Oct 23, 2009 10:17 am
by canielsen
Thank you very much for your help. This was just what i needed. Now i can see what i have done wrong. I had forgotten to make the loop :oops: