Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

My RTC is ds1307 not work

Status
Not open for further replies.
Actually, RB6/PGC and RB7/PGD can be used as both ICSP for device programming and Digital I/O during runtime, however you cannot use the debugging feature if RB6/PGC and RB7/PGD are used as Digital I/O and it must be disabled by properly configuring the Configuration Register bits.

One of the more straight forward methods of implementing buttons is to use either the External Interrupt of RB0 or Interrupt On Change feature of RB4:RB7. Using this technique allows a button closure to trigger an interrupt service routine (ISR) which can handle the appropriate action depending on which button was pressed/closed.

Reference: PIC16F87XA Datasheet , Section: 4.2 PORTB and the TRISB Register, Page: 44
Four of the PORTB pins, RB7:RB4, have an interrupton-
change feature. Only pins configured as inputs can
cause this interrupt to occur (i.e., any RB7:RB4 pin
configured as an output is excluded from the interrupton-
change comparison). The input pins (of RB7:RB4)
are compared with the old value latched on the last
read of PORTB. The “mismatch” outputs of RB7:RB4
are OR’ed together to generate the RB port change
interrupt with flag bit RBIF (INTCON<0>).

This interrupt can wake the device from Sleep. The
user, in the Interrupt Service Routine, can clear the
interrupt in the following manner:

a) Any read or write of PORTB. This will end the
mismatch condition.
b) Clear flag bit RBIF.

A mismatch condition will continue to set flag bit RBIF.
Reading PORTB will end the mismatch condition and
allow flag bit RBIF to be cleared.

The interrupt-on-change feature is recommended for
wake-up on key depression operation and operations
where PORTB is only used for the interrupt-on-change
feature. Polling of PORTB is not recommended while
using the interrupt-on-change feature.

This interrupt-on-mismatch feature, together with software
configurable pull-ups on these four pins, allow
easy interface to a keypad and make it possible for
wake-up on key depression. Refer to the application
note, AN552, “Implementing Wake-up on Key Stroke”
(DS00552).

RB0/INT is an external interrupt input pin and is
configured using the INTEDG bit (OPTION_REG<6>).
RB0/INT is discussed in detail in Section 14.11.1 “INT
Interrupt”.


BigDog
 

Re: My RTC is ds1307 not work (C problem)

....
If you need inspiration for composing an I2C library of routines, you may want to reference the Hi-Tech routines for the PIC18.
....
Attached is the I2C Library Source Code and Header File.
....

@ bigdogguru
Thanky you for the published I2C library.

@ C gurus

In many cases, a mixture of signed and unsigned chars can be seen in the published routines (such as the "unsigned char getsI2C" function returns with -1 !). I do not know the Hi-Tech C, but this difference does not cause translation errors? Of course I also know that the signed char -1 is equal to the unsigned char 255, but the C compilers are generally sensitive to this difference.

Regards
zuisti
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top