How can a PIC16F505 use just RB1 input to read 3 states, (i.e 0Volts, 6V or 12V)? Based on the input, the output would be 0V=Do nothing, 6V=Output to RC3, 12V=Output to RC2. 0V=all LED's off. Any help is very much appreciated!
Last edit: Phil D 2020-04-07
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
If I understood the idea correctly , then measure the voltage level, it is necessary to use a voltage divider so that the input of the microcontroller does not exceed 5V and the input of the microcontroller must support the A / D function.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
If I understood the idea correctly , then measure the voltage level, it is necessary to use a voltage divider so that the input of the microcontroller does not exceed 5V and the input of the microcontroller must support the A / D function.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thank you very much for your advice, it really is very helpful - I will look into these 'exchanges' :) I really appreciate you (and Janis) helping me with this!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks for the feedback Janis and Anobium. You are correct regarding the ADC comment and the required voltage scaling. What confuses me is how the heck it works as my professor demonstrated a working example before we went into COVID-19 lockdown - so it does work based on all the hardware shown in the schematic. My task is to figure out the PIC instructions just for RB1 input and split the two incoming +V signals into two outputs (RC2 & RC3). I have been banging my head on the wall for nearly a week to get my head around this and I can't for the life of me see how. We are not allowed to change, add or remove any components - Arrrg :(
Last edit: Phil D 2020-04-07
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
But, this chip does not have ADC. I would simply pull of the old PIC16F505 chip and replace with PIC16F15324 then using the voltage divider use the ADC to read the value.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anobium, yes. I therefore mentioned in my comment that the PIC must support an A / D converter. I saw that the PIC16F505 has no analog input, I guess maybe I was wrong ... But it really isn't. Like the traditional 16F628 :). Look for another microcontroller
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Explain to the professor 1) PIC16F505 does not support A / D converter. 2) the voltage level must be changed. Without it, nothing can be done. A voltage divider with resistors is the simplest option. You may not need transistor Q1, and replace the resistors R6 and R7 with the required ratings that Anobium drew. Instead of capacitor C8, zener diode 5.1V are inserted. This way, nothing will be added or subtracted, but exchanged.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thank you very much for the recomendations, it really is very helpful - I will look into these 'exchanges' :) I really appreciate you helping me with this!
But how in the heck did my professor make this ciruit work during his live demostration??!! I ask when i speak to him next...
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I think it will be too difficult for the guy. It is easier to change the microcontroller and use the ADC. The circuit needs to be redesigned anyway, a voltage divider is needed.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I am with Chris. The resistor and cap circuit should be in the tips and tricks, however, I did not check... and, I did not want to do his homework! lol
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
In the days before ADC keypads became fashionable, Parallax put out an app note pdf with an app in it called " One Input - Many Switches" . I used this with great success.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Saw this after a day of online meetings, and thought it was a good challenge. I've built the circuit almost as shown (different transistor and a pot instead of the fixed resistors, and 12F509 rather than 16F505) and it does work as described.
I don't want to give too much away, but some hints. Resistor and capacitor circuit is the way, but you can't add any. So, you have to use what you have. The chip has weak pull ups, which can give you the equivalent of a voltage source with a fairly high value resistor in series, and all microcontroller pins naturally have some capacitance. Look at the links above to see how the pot commands work. Let us know when you work it out!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I looked up pot in help and there is trigonometry circle.
It doesn't need #include <trig2places.h></trig2places.h>
;Circle and filled circle commands on a graphic LCD.;This uses the 2-place trigonometric routines found in the include file.;Thomas Henry -- 4/17/2014;----- Configuration
#chip16F88, 8;PIC16F88 running at 8 MHz
#configmclr=off;reset handled internally
#configosc=int;use internal clock
#include<GLCD.h>
#include<Trig2Places.h>;----- ProgramGLCDCLScircle(10,10,10);upper leftcircle(117,10,10);upper rightfilledcircle(63,31,10);centercircle(63,31,20);centerfilledcircle(10,53,10);lower leftfilledcircle(117,53,10);lower right
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
How can a PIC16F505 use just RB1 input to read 3 states, (i.e 0Volts, 6V or 12V)? Based on the input, the output would be 0V=Do nothing, 6V=Output to RC3, 12V=Output to RC2. 0V=all LED's off. Any help is very much appreciated!
Last edit: Phil D 2020-04-07
Welcome Phil.
No schematic.
Thank you Anobium - Apologies, now attached.
This makes a little more sense. :-)
Is this an existing project? Can you share the code?
If I understood the idea correctly , then measure the voltage level, it is necessary to use a voltage divider so that the input of the microcontroller does not exceed 5V and the input of the microcontroller must support the A / D function.
If I understood the idea correctly , then measure the voltage level, it is necessary to use a voltage divider so that the input of the microcontroller does not exceed 5V and the input of the microcontroller must support the A / D function.
This one.... ?
Thank you very much for your advice, it really is very helpful - I will look into these 'exchanges' :) I really appreciate you (and Janis) helping me with this!
Thanks for the feedback Janis and Anobium. You are correct regarding the ADC comment and the required voltage scaling. What confuses me is how the heck it works as my professor demonstrated a working example before we went into COVID-19 lockdown - so it does work based on all the hardware shown in the schematic. My task is to figure out the PIC instructions just for RB1 input and split the two incoming +V signals into two outputs (RC2 & RC3). I have been banging my head on the wall for nearly a week to get my head around this and I can't for the life of me see how. We are not allowed to change, add or remove any components - Arrrg :(
Last edit: Phil D 2020-04-07
Can I just check....... first name of the professor is? I do not want to hack someone off. :-)
So, look at http://ww1.microchip.com/downloads/en/DeviceDoc/01146B.pdf Any hints in this document?
LOL - Pawel is his name. I will have a look over the Tips and Hint sheet tonight. Thanks!
But, this chip does not have ADC. I would simply pull of the old PIC16F505 chip and replace with PIC16F15324 then using the voltage divider use the ADC to read the value.
Anobium, yes. I therefore mentioned in my comment that the PIC must support an A / D converter. I saw that the PIC16F505 has no analog input, I guess maybe I was wrong ... But it really isn't. Like the traditional 16F628 :). Look for another microcontroller
Explain to the professor 1) PIC16F505 does not support A / D converter. 2) the voltage level must be changed. Without it, nothing can be done. A voltage divider with resistors is the simplest option. You may not need transistor Q1, and replace the resistors R6 and R7 with the required ratings that Anobium drew. Instead of capacitor C8, zener diode 5.1V are inserted. This way, nothing will be added or subtracted, but exchanged.
Thank you very much for the recomendations, it really is very helpful - I will look into these 'exchanges' :) I really appreciate you helping me with this!
But how in the heck did my professor make this ciruit work during his live demostration??!! I ask when i speak to him next...
He will probably have used the Timer, here was an application note about it but I can't find it at the moment.
I did however find a web page that is applying the principal.
take a look here:
https://www.microcontrollertips.com/mcus-using-digital-input-read-analog-signal-without-adc/
I am with Chris. The resistor and cap circuit should be in the tips and tricks, however, I did not check... and, I did not want to do his homework! lol
Am I missing something here ! Isn't this just the POT command in GCB aka the BUTTON command in Basic Stamp - with a scaling resistor on the input.
@Geoffrey.. well remembered. Glad someone knows the system and the Help!!!
Yes, well spotted, I didn't know that existed and Evan had forgotten that he had written it.
In the days before ADC keypads became fashionable, Parallax put out an app note pdf with an app in it called " One Input - Many Switches" . I used this with great success.
Saw this after a day of online meetings, and thought it was a good challenge. I've built the circuit almost as shown (different transistor and a pot instead of the fixed resistors, and 12F509 rather than 16F505) and it does work as described.
I don't want to give too much away, but some hints. Resistor and capacitor circuit is the way, but you can't add any. So, you have to use what you have. The chip has weak pull ups, which can give you the equivalent of a voltage source with a fairly high value resistor in series, and all microcontroller pins naturally have some capacitance. Look at the links above to see how the pot commands work. Let us know when you work it out!
This command [Pot] seems very useful. I'll try to add that to the memory bank for next time I need it.
I looked up pot in help and there is trigonometry circle.
It doesn't need #include <trig2places.h></trig2places.h>