Maybe I can now... 15 years ago would be a different story.I suspect you and Henrik could code it in about five minutes!
You are doing great! Keep at it!
Oh, forgot to mention the assignment is due Friday![]()
Maybe I can now... 15 years ago would be a different story.I suspect you and Henrik could code it in about five minutes!
You are doing great! Keep at it!
Oh, forgot to mention the assignment is due Friday![]()
Dave
Always wear safety glasses while programming.
Hi everyone.
I've been busy on the 'assignment'.
I've got the first part going namely:
I built a test circuit which I made a small mistake on, then having zero programming confidence quickly convinced myself I'd made a code error, turned out I'd soldered a link into the wrong place (hours wasted), grrrr.Do a "MAIN_LOOP" that will TOGGLE a LED with a button press. Every time you press a button the LED changes state.
So on my PIC12F683 GPIO.5 has a push button attached which changes an the state of an LED on GPIO.0 everytime it's pressed, so far so good, now for the tricky part....!
It's taking longer than expected so my homework may not been handed in until Monday.
Still, only 14 Years and 48 weeks to catch up with you mackrackit!
Dave
Last edited by LEDave; - 24th March 2010 at 23:59.
And I am trying to catch up with Bruce...Still, only 14 Years and 48 weeks to catch up with you mackrackit!
It never ends![]()
Dave
Always wear safety glasses while programming.
Hi everyone.
Struggling a bit (well quite a bit actually) with the second / third parts of the project.
The brief says:
Ok, so what I'm trying to do here is to use the INTERRUPT flag as my counter (INTCON.2=1) I've set the prescaler at 1:256 = 65536us = 7.6HZ and set 'I' as a VAR BYTE.Then make a BYTE size variable and add the PBP interrupt routine for another LED. The new variable will increment a value of 1 every time the interrupt "triggers".
My theory goes something like this:
If count (VAR BYTE 'I' incremented by the INTERRUPT flag) = 10 then TOGGLE the LED.
Here's how I'm trying to do it and where I'm falling down.
I'm thinking at 10 'counts' at 7.6HZ should be approximately blink the LED once a second-ish.Code:IF INTCON.2=1 ' INTERRUPT flag overflows THEN I = I + 1 ' add 1 to the value of I. INTCON.2=0 ' Reset the overflow flag. IF I<=10 GOTO MAIN ' If count doesn't = 10 loop again. IF I =10 GOTO TOG ' If count = 10 then TOGGLE the LED.
All a bit fragmented I know but I hope what on saying is on the right tracks.
Any thoughts, pointers?
Dave
The basic interrupt routine you have worked with
SOMETHING...Code:DISABLE TLOOP: 'DO SOMETHING INTCON.2=0 RESUME ENABLE
I = I + 1
IF ??? THEN
???
RESET COUNTER
ENDIF
Tick Tock...![]()
Dave
Always wear safety glasses while programming.
That's what I was trying to fit in.Code:DISABLE TLOOP: IF INTCON.2=1 THEN I = I + 1 :INTCON.2=0 IF I<=100 GOTO MAIN IF I =100 GOTO TOG tog:TOGGLE GPIO.2 RESUME: ENABLE
Blimmey, it's nearly Friday already
Am I close-ish.
Dave
Close-ish...
IF INTCON.2=1
is not needed in the interrupt routine, that is what send the code there in the first place.
The rest might work.
Does it??
Dave
Always wear safety glasses while programming.
Bookmarks