Page 1 of 1
16F877A project
Posted: Wed Nov 30, 2011 9:52 am
by CRAIG CHAMBERLAIN
I have a 16F877A project that uses a 3 way rotary switch.
Does something like this exist? Can I make one without knowing C?
Or just stick with 3 standard switches and live with it? Not a big problem now that I think about it.
Question 2: It would be very handy for me to be able to Sim a signal multiplexor that will
be used as an input to 1 a/d input (RA0), for 10 different signals.
I realize I should be able to do this via a macro. Before I start, any ideas on the simplest way to do this?
Thanks in advance.
-Craig
Re: 16F877A project
Posted: Wed Nov 30, 2011 1:37 pm
by Benj
Hello Craig,
1) You can use 3 standard switches in Flowcode to simulate and then use the actual 3-way rotary switch on the hardware. Shouldn't be any problems with doing this.
2) The simplest way to do this would be to read the ADC as a byte, then divide the byte by 26 and finally use the byte as a index for a switch icon with labels 0-9.
Re: 16F877A project
Posted: Sat Dec 03, 2011 4:15 am
by CRAIG CHAMBERLAIN
Ben,
Thanks for the reply.
Not quite sure what you mean by reading the ADC as a byte. Are you saying use the address of the data to select a switch perhaps?
I'm no neophyte, But you left me in the dust on this one!
-Craig
Re: 16F877A project
Posted: Mon Dec 05, 2011 11:25 am
by Benj
Hello Craig,
Please look for the switch case icon in the flowchart icon toolbar. Add one to your program and go into the properties and you will see if needs an input parameter. Use the variable from your ADC read which you have also done the divide by 26 as the parameter for the switch case icon. Valid switch cases will then be 0 - 9 with regards to the ADC voltage.
Re: 16F877A project
Posted: Thu Dec 08, 2011 9:30 am
by CRAIG CHAMBERLAIN
Ben,
I believe you may not understand my goal.
I want to be able to use 4 control lines to control a 1 of 16 analog switch,
which will control which signal is read by the micro. I'll only be using 1 analog input.
It sounds like you are proposing a form of window comparator.
Which does give me an idea for later programming!
-Craig