Sign in

username:

password:



Not a member?

Search piclist



Search tips

Subscribe to piclist



piclist by Keywords

12F675 | 16F628 | 16F84 | 16f877 | 16F877A | 16F88 | 18F458 | ADC | AVR | Bootloader | CAN | CCS | CRC | EAGLE | EEPROM | ICD | ICSP | IDE | JDM | LED | Macros | Microchip | MPLAB | PCB-CAD | PIC10F | Pic12f675 | PIC16F84 | PIC16F84A | PIC16F877 | PIC18 | PIC18F452 | PicBasic | PICC | PICSTART | PWM | RS-485 | RS232 | SMT | SPI | UART | USART | USB | Wireless | Wisp628 | Xilinx


Ads

Discussion Groups

See Also

DSPFPGAElectronics

Discussion Groups | Piclist | Wake Up On Key Stroke


Advertise Here

A discussion group for the PICMicro microcontroller. Also called the Microchip PIC, this list is dedicated to the use and abuse of this fine, simple, microcontroller. Close to topic posts are welcome, ie. general electronics.

Wake Up On Key Stroke - jmsmith871 - Sep 17 17:55:23 2008

Although I've been using PICs for years, I'm only now studying the
SLEEP instruction and code to wake up the processor. It's not going
well at the moment.

Microchip's app note AN552, "Implementing Wake-up on Key Stroke," has
sample code for a 16C71. I pasted the code into the MPLAB IDE, and it
assembled without errors. A PICStart Plus programmed it into a 16C71
with no errors.

However, it does not perform. When a key is pressed, no LED lights, as
it should. The PIC's crystal oscillator runs (4 MHz), and the LEDs
light when tested separately, in the circuit.

Anyone have experience with this program, or with others that I could
try? Using the 16C71 is not necessary; I only used that because the
app note code is written for it.

Best regards,
John
Germantown, Ohio

------------------------------------

to unsubscribe, go to http://www.yahoogroups.com and follow the instructions

______________________________
Stellaris® MCU Family: New Parts, New Package, New Price.


(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )


Re: Wake Up On Key Stroke - tigger - Sep 19 4:48:55 2008

--- In p...@yahoogroups.com, "jmsmith871" wrote:
>
> Although I've been using PICs for years, I'm only now studying the
> SLEEP instruction and code to wake up the processor. It's not going
> It is not going well at the moment.
>
Hi John. Like you, I only started using 'sleep' late in my pic
programming career, but I found it easy to use, and implemented it
without difficulty on a 12f629 in an application where I wanted a
response to a single change of state input.

On this pic all you need to do is enable change of state interrupts on
the port, without enabling global interrupts. I include the following
in the initialisation routine -

bsf status,rp0 ;Switch to register bank 1
movlf h'2e',ioc ;enable ioc interupts on gpio 1,2,3,5
clrf option_reg ;general enable pullups (bit 7 clear)
movlf h'36',wpu ;enable pullups on inputs gpio1,2,4,5
bcf status,RP0 ;Switch Back to reg. Bank 0

movlf is a macro consisting of movlw followed by movwf with
appropriate operands.

In the main routine I have this -

sleep ;stop here until a change of state on one of the inputs
movfw gpio ;clear the 'interrupt'
bcf intcon,0
;continue with response to keypress

it is very simple and works perfectly.

best wishes, Andy

------------------------------------

to unsubscribe, go to http://www.yahoogroups.com and follow the instructions



(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )

Re: Wake Up On Key Stroke - jmsmith871 - Sep 19 8:28:52 2008

--- In p...@yahoogroups.com, "tigger" wrote:
>
> Hi John. Like you, I only started using 'sleep' late in my pic
> programming career, but I found it easy to use, and implemented it
> without difficulty on a 12f629 in an application where I wanted a
> response to a single change of state input.

Thanks, Andy,

While attempting to get the AN522 code to work in the 16C71, I
inadvertently destroyed the chip. Small loss; I was only using the
'C71 because the app note code was written for it, and I didn't want
to migrate code before understanding it.

However, with a couple of minor migration changes, the code worked
immediately in a 16F628.

Thanks much for your help and encouragement. I've saved your message
in a text file, and will study it before proceeding.

Best regards,
John
------------------------------------

to unsubscribe, go to http://www.yahoogroups.com and follow the instructions



(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )