February 2013 Blog Posts (2)

Interrupt Handling Tips

Few things that took me a while to figure out:

1. When using high and low priority interrupts, GIEH must ALSO be enabled along with GIEL (bits 7 and 6) for low priority interrupts to occur.

2. Even when interrupts are not enabled (such as external interrupts on INT0), these are still being flagged. Thus, if there are multiple sources of interrupts and if the interrupt source checking is not handled carefully, disabled interrupt routines may still occur. For example, in my…

Continue

Added by Soon Kyu Lee on February 22, 2013 at 2:18am — No Comments

Writing to 2nd line on LCD for PIC18F4620

Code given in textbook is something like this:

WR_INS

bcf RS ;clear Register Status bit

movwf temp_lcd ;store instruction

andlw 0xF0 ;mask 4 MSB

movwf LATD ;send 4 MSB

bsf E ;pulse enable high

call delay5ms

swapf temp_lcd, 0 ;swap nibbles (result into WREG)

andlw 0xF0 ;mask 4 LSB

bcf E

movwf LATD ;send 4 LSB

bsf E ;pulse enable high

nop

bcf E

call delay5ms ;allow time for change

return

But this does not…

Continue

Added by Soon Kyu Lee on February 3, 2013 at 5:00pm — No Comments

Monthly Archives

2024

2023

2018

2016

2015

2014

2013

2012

2011

2010

2009

1999

1991

1990

1989

1988

1987

1986

1985

1984

1983

1982

1981

1980

1979

1978

1977

1976

1975

1974

1973

1972

1971

1970

1969

1968

1967

1966

1965

© 2024   Created by PML.   Powered by

Badges  |  Report an Issue  |  Terms of Service