I would think a person would want to read that pin a number of times though, a kind of 'software hysteresis', just to make sure the pin isn't jumping 0 to 1 to 0 to 1, and causing something to go a bit flakey......unless of course the jumping around is what you're looking for!![]()
The 16F628a does not have a ADC. The difference between using the IO pin vs the comparator-module is the non-defined space between about 2,5 and 4 volts.
That means that within this area the PIC could percieve a high as a low and vv. This problem does not occur when using the comparator, so in the long run the comparator is better. I guess this is what skimast said aswell.
So let us come back to the comparator. The LDR is connected to RA2. Which fuses are needed to make RA2 connect to the (non-)inverting input, the other input to vref and to disable the other comparator? I am adressing all of you.
I thought the word for VRCON, CMCON etc. is fuses. Good to know better.
So what I want to know: Which numbers are to be used for VRCON and CMCON for the effect wanted?
Generally speaking - the 'FUSES', specifically CONFIG fuses are set a programming time by the programmer.
Anything else that can be set at run time (including ram used for variables) are called registers.
Hate to say it, but it's all in the datasheet for your PIC.So what I want to know: Which numbers are to be used for VRCON and CMCON for the effect wanted?
I know, skimask. But I would not ask if I could filter out the useful information myself. If you do not want to tell me, fine.
Can you help me out here aswell, g-hoot?
It's not that I don't want to tell you (like it's some sort of state secret or something). I mean, look at the project. You obviously have a clue as to what you're doing and how to get there from here. It's just that I would've led you to the right piece of information sooner or later, then you could've figured it out for yourself....that whole 'give a fish, teach to fish' thing...
Ted's,
I think I understand this less than you, so don't put too much faith in mu help. I still don't understand what a comparator does?... The idea of checking for high or low is what I like best (cause it's simple), but I guess there can be some issues with in bouncing like skimask mentioned. Maybe you could use a weak pull-up resistor to keep the pin high to prevent the bouncing problem. Or, you could simply cut and paste the RCTime code I posted and be done. ;-) I agree with skimask that all the info is in the data sheet, but I still have a hard time understanding what the data sheet says! They sure aren't written for people that are using PBP! That's why I posted my exact RCTIME code for you. I know to most here, that it is day one basics, but for us new guys, it's like learning a new language, and a little spoon feeding is nice and helps in understanding what's going on. :-)
Gary
Bookmarks