MOUNTAIN747
- 26th February 2013, 22:13
Greetings!
My project uses a 16F886 @8Mhz and a MCP79410 RTCC. I am pleased with the digital calibration and the unit is keeping very accurate time. HOWEVER, I have been working with the Alarms for several days and I’m getting nowhere! I have three identical boards and the RTCC acts the same on all boards. I must be missing something!
MFP is tied to RB0 with pull up resistor and a button for manual interrupt with DT_INT’s. The button interrupt is working as expected.
The ISR checks to see if ALM0IF or ALM1IF has been set, if NOT the interrupt was caused by button press. The OLED notifies upon interrupt which flag is set, if any.
My major problem is that I can‘t get the darn thing to go into alarm state. I expect an interrupt if RTCC goes into alarm state, its not happening... No interrupt... No Alarm flag set. As I said all three board are working the same so it must be something in the setup I missed.
PBP 2.60, PMASM
; Clock set to 0000, Alarm0 set, MFP set to Hi in default position, goes low on interrupt
Set_TimeDate:
rtcsec = %10000000 ;top 4 bits ST&tens, bottom 4 bits ones
rtcmin = %00000000 ;can be a Hex $ entry,
rtchour = %00000000 ;bit6,12/24hr : bit5 pm/am : bit4=tens : bottom 4bits=ones
rtcday = %00000001 ;oscon bit5 : Vbat bit4 : Vbaten bit3 : bit 2-0 day
rtcdate = %00000000
rtcmon = %00000000 ;bits4 tens : bottom 4 bits ones
rtcyear = %00000000
rtccon = %10010000 ;[OUT][SQWE][ALM1][ALM0][EXTOCS][RS2][RS1][RE0] CONTROL
rtccal = %00000000 ;Calibration
i2cwrite I2C_Dat, I2C_Clk, $DE,$00,[STR RTCbuffer\9] ' Write all 8 RTC reg
Return
;Set Alarm0 for Lo on alarm interrupt, Alarm set to Seconds match, Seconds set to 15
Set_RTCC_Alarm0:
Alrm0_sec = $0F
Alrm0_min = %00
Alrm0_hour = %00
Alrm0_day = %00 ; [ALM0POL][ ALM0C2][ALM0C1][ALM0C0][ ALM0IF ] [ DAY ] Addr 0Dh
Alrm0_date = %00
Alrm0_mon = %00
i2cwrite I2C_Dat, I2C_Clk, $DE,$0A,[STR Alrm0_buffer\6]
Return
;Set Alarm1 for Lo on alarm interrupt, Alarm set to Seconds match, Seconds set to 15
Set_RTCC_Alarm1:
Alrm1_sec = $0F
Alrm1_min = %00
Alrm1_hour = %00
Alrm1_day = %00 ; [ALM1POL][ ALM1C2][ALM1C1][ALM1C0][ ALM1IF ] [ DAY ] Addr 14h
Alrm1_date = %00
Alrm1_mon = %00
i2cwrite I2C_Dat, I2C_Clk, $DE,$11,[STR Alrm1_buffer\6]
Return
OLED display posts a constant update of the clock. If I push the INT button, OLED post BIN value of Alrm0_day and Alrm1_day. This tells me if ALM0IF and ALM1IF is clear or set. Following my interpretation of the datasheet almost everything else is working as expected. Calibration works well, PWM on MFP works well, EEProm works well in Page Write and Byte Read, and ID is cool.
PBP I2C command doesn’ like the EEProm Random Read or Current Address Read. I guess some bit banging will be required. SRAM wants to give me back only seven bits instead of eight; what’s with that?
Any comments or direction will be appreciated!
Wayne
My project uses a 16F886 @8Mhz and a MCP79410 RTCC. I am pleased with the digital calibration and the unit is keeping very accurate time. HOWEVER, I have been working with the Alarms for several days and I’m getting nowhere! I have three identical boards and the RTCC acts the same on all boards. I must be missing something!
MFP is tied to RB0 with pull up resistor and a button for manual interrupt with DT_INT’s. The button interrupt is working as expected.
The ISR checks to see if ALM0IF or ALM1IF has been set, if NOT the interrupt was caused by button press. The OLED notifies upon interrupt which flag is set, if any.
My major problem is that I can‘t get the darn thing to go into alarm state. I expect an interrupt if RTCC goes into alarm state, its not happening... No interrupt... No Alarm flag set. As I said all three board are working the same so it must be something in the setup I missed.
PBP 2.60, PMASM
; Clock set to 0000, Alarm0 set, MFP set to Hi in default position, goes low on interrupt
Set_TimeDate:
rtcsec = %10000000 ;top 4 bits ST&tens, bottom 4 bits ones
rtcmin = %00000000 ;can be a Hex $ entry,
rtchour = %00000000 ;bit6,12/24hr : bit5 pm/am : bit4=tens : bottom 4bits=ones
rtcday = %00000001 ;oscon bit5 : Vbat bit4 : Vbaten bit3 : bit 2-0 day
rtcdate = %00000000
rtcmon = %00000000 ;bits4 tens : bottom 4 bits ones
rtcyear = %00000000
rtccon = %10010000 ;[OUT][SQWE][ALM1][ALM0][EXTOCS][RS2][RS1][RE0] CONTROL
rtccal = %00000000 ;Calibration
i2cwrite I2C_Dat, I2C_Clk, $DE,$00,[STR RTCbuffer\9] ' Write all 8 RTC reg
Return
;Set Alarm0 for Lo on alarm interrupt, Alarm set to Seconds match, Seconds set to 15
Set_RTCC_Alarm0:
Alrm0_sec = $0F
Alrm0_min = %00
Alrm0_hour = %00
Alrm0_day = %00 ; [ALM0POL][ ALM0C2][ALM0C1][ALM0C0][ ALM0IF ] [ DAY ] Addr 0Dh
Alrm0_date = %00
Alrm0_mon = %00
i2cwrite I2C_Dat, I2C_Clk, $DE,$0A,[STR Alrm0_buffer\6]
Return
;Set Alarm1 for Lo on alarm interrupt, Alarm set to Seconds match, Seconds set to 15
Set_RTCC_Alarm1:
Alrm1_sec = $0F
Alrm1_min = %00
Alrm1_hour = %00
Alrm1_day = %00 ; [ALM1POL][ ALM1C2][ALM1C1][ALM1C0][ ALM1IF ] [ DAY ] Addr 14h
Alrm1_date = %00
Alrm1_mon = %00
i2cwrite I2C_Dat, I2C_Clk, $DE,$11,[STR Alrm1_buffer\6]
Return
OLED display posts a constant update of the clock. If I push the INT button, OLED post BIN value of Alrm0_day and Alrm1_day. This tells me if ALM0IF and ALM1IF is clear or set. Following my interpretation of the datasheet almost everything else is working as expected. Calibration works well, PWM on MFP works well, EEProm works well in Page Write and Byte Read, and ID is cool.
PBP I2C command doesn’ like the EEProm Random Read or Current Address Read. I guess some bit banging will be required. SRAM wants to give me back only seven bits instead of eight; what’s with that?
Any comments or direction will be appreciated!
Wayne