Hi guys, okay I've been having a mess today & I am quite happy with myself. I managed to use the comparator successfully, now I have added a button into the routine.
It is all doing what I want it...
Type: Posts; User: robbo78; Keyword(s):
Hi guys, okay I've been having a mess today & I am quite happy with myself. I managed to use the comparator successfully, now I have added a button into the routine.
It is all doing what I want it...
Thanks guys, I will have a play :)
Rob
Hi Tabsoft, thanks for comfirming :) also thanks again for all your help, I wouldnt have got to this point if it wasnt for you. I havent got a simulator so I just test straight on the BB.
I will...
Hi, okay I've been playing about with comparator interrupt now & think I have got the hang of it using flags. The code below is something little I came up with :)
Now I think I would like to...
Hi Tabsoft, okay thanks for all that. I will go back to flagging. I think I was
Getting a bit ahead of myself lol.
Let you know how it goes :)
Hi Tabsoft, I got the comparator working perfectly :D so I decided to move onto adding an interrupt, which believe it or not hasn't worked. Here is the code I have fully written, maybe you can help...
Brilliant! Thanks for the info again your the best! I should be able to get this working how I want it to now, then & only then will I move onto interupt with it.
Thanks again,
Rob
Hi Tabsoft, okay had another read at first it was just going over my head. Am I right in saying I need to read bit 6 of CMCON0? So CMCON0.6?
Thanks,
Rob
Hi Tabsoft,
Right I have changed the bits in the VRCON to the right stuff, so I think that is right now. I did change bits in the CMCON0 but none of it seemed to make a difference, so I have put...
Hi Tabsoft, thanks a lot for your help I appreciate it. I will go back through everything you have stated & set it up right this time. I did think there were other bits to change but didnt want to...
Okay I have had a go & failed :( What am I doing wrong?
'PIC12f683
#CONFIG
__config _INTRC_OSC_NOCLKOUT & _WDT_OFF & _MCLRE_OFF & _CP_OFF
#ENDCONFIG
DEFINE OSC 4 '4mhz ocsillator
Thats great :) thanks for the help, now I can have a go at the code.
Richard, I'm specifically talking about just the VRR nothing else. I just want to know if I've got the workings out right. If you need the whole code to tell me if that part is right or not then I...
Okay Richard thanks for your help.
So lets say I wanted an LED to be OFF if the voltage on cin+ is below 1.1v, & LED to be ON if the voltage is higher than 1.1v. Would I use this -
VR3 ......
Edit: just re-read your post. I need to be able to read a pin & output on it at the same time (obviously with pauses, so do I need to use comparator with output?
Hi Richard, I just came back here...
Update: Ive looked in the data sheet & found out the reason for dividing by either 24 or 32, if your working out low range then : 24, high range : 32. Thats another thing understood.
So the last...
Okay I think I have made sense of this now :) - correct me if I'm wrong.
So if I wanted to set the comparator up with say an internal reference & output (cm<2:0> = 011), I would set the cmcon0...
Thanks Tabsoft for that info & trying to help. I will go over all that until it becomes clear, I refuse to give up!
Thanks again,
Rob
Back again already, Comparators are mind boggling !!
Firstly I have no idea how to even set the mode of the comparator, let alone working out & setting the VRC. I have been researching all day,...
Oh I see, yes it sounds like the comparator will be the best then. Anyway thanks for your help guys, I have learned a lot.
I will be back lol
Rob
Hi Henrik, thanks for explaining that it makes things a lot clearer as to how I'm going to run the code. What I would like to do is have one of the inputs (gp2), taking a reading from ADC every say...
So if I want to use IOC, I would need to read the button or any other type of input such as the adc?
I'm only asking as I need to be able to use interrupt on like 5 inputs, not just 1. Although...
Hi Henrik, thanks for helping. I have changed to the code to do as you said: goto's instead of gosub's & made the ISR set flag only (i think).
It all seems to work better now, however I still...
UPDATE: I've just worked it out I think, its because I haven't got any debounce in there so every 'tap' could be jumping a couple of modes instead of seeing it as 1 button tap & jumping 1 mode.
...
Right I have changed the code from what Tabsoft last posted, so now there are 3 modes each blinking led at a different rate depending on the mode. Every tap of the button is supposed to goto the next...