Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

12f675 wont wake up

Status
Not open for further replies.

PeterK

New Member
Hi,

I programmed a 12f675 with comparotors off and digital i/o's.

I have a 32.768 k osc.

I programmed the watchdog off.

I use the example in picbasic for wake up from interupt and change the Port statements to GPIO and set INTCON.3 = 1 to enable int on change and INTCON.0 = 0 to clear it.

I put the device into sleep, give a change of level interupt on GPIO.2, the device momtarily wakes up, but then goes to sleep again.

I put a statement in so if the GPIO.2 goes low (ie Interupt) then exit the sleep loop and flash a led continiuously.

I know it wakes up as the current drawn goes up as observed by my current meter.

Any assistance appreciated.
 
Does your BASIC compiler specifically support the 12F675?, I notice you mention changing the code to GPIO - which leads to suspect perhaps it doesn't?.

Different PIC's react in different ways to wakeups, some perform a reset, some simply carry on from where the sleep instruction was issued. I think the 12F675 carries on from where it was.

You also need to check what code the compiler is producing, it's really essential to have a working knowledge of assembler to use a high level compiler effectively.
 
PeterK said:
...
I put a statement in so if the GPIO.2 goes low (ie Interupt) then exit the sleep loop and flash a led continiuously.
...
.


where do you put this instruction in?
inside the interrupt subroutine?? or main loop?
 
Hi,

The program I have is as follows
DEFINE ONINT_USED 1

INTCON.3 = 1 ' Enable the port change interrupt

CMCON = 7 ' Disables Analog Inputs
ANSEL = 0 ' Sets Analog Inputs as Digital I/O

TRISIO = $FF ' All As Inputs

On_Test: ' Wait for the interupt on GPIO.2, low from Switch

Pause 1

IF GPIO.2 = 0 Then
GoTo Awake
EndIf

INTCON.0 = 0 ' Clear the RB port change flag bit

Nap 7 ' Go to sleep. When the watchdog is
' disabled, NAP won't wake up until
' an interrupt occurs.

GoTo On_Test ' Do it again upon waking

Awake:

Low GPIO.0
Pause 10
High GPIO.0
Pause 10

GoTo Awake

I hope someone can explain
Q. 0n INTCON.3 = 1 and
INTCON.0 = 0
Are they references to banks?
Thanks. Peter
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top