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.

Rtcc program simulation issue [microcontroller : Pic18f46j11; internal rtcc]

Status
Not open for further replies.

fag.bhu

Newbie level 4
Joined
Jan 1, 2012
Messages
6
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,358
HI,

I am using the internal RTCC of the PIC18f46j11 controller ....... While configuring the internal RTCC, I am facing some issues as follows:
when I put some value in the RTCVALH & RTCVALL registers after configuration of the RTCCFG register , no values are loaded in the RTCVALH & RTCVALL registers i.e. they remain as it is "00"
The contents of these registers remain unaffected when I try to access them. I am using MPLAB to simulate this program. I am thus not able to see any value in the WATCH Window of MPLAB IDE .....



I am not able to set this rtc due to the above mentioned reasons ........ Please look into the matter & suggest some solution for the same...
The assembly code is as follows :


#include<P18F46J11.INC>
CONFIG OSC=HS REC_VALUE EQU 0X20
;the value received at
;Rx1 will be tansfered to this register R2 EQU 0X40
;RTCCFG EQU 0XF3F
; RTCC CONFIGURATION REGISTER
;RTCVALL EQU 0XF98
; RTCC LOWER VALUE REGISTER
;RTCVALH EQU 0XF99
; RTCC HIGHER VALUE REGISTER
ORG 0
;******************************************************************
;setting date and time
;******************************************************************
movlb 0x0f
movlw 0x55
movwf EECON2,0
movlw 0xAA
movwf EECON2,0

MOVLW B'00000000'
MOVWF BSR
MOVLW B'10101111'
MOVWF R2
MOVFF R2,RTCCFG
MOVLW 0X00
MOVWF RTCVALH,BANKED
MOVLW 0X02
MOVWF RTCVALL,BANKED
;SETTING THE YEAR

MOVLW B'10101110'
MOVWF R2
MOVFF R2,RTCCFG
MOVLW B'00000001'
MOVWF RTCVALH
;SETTING THE MONTH

MOVLW B'00001001'
MOVWF RTCVALL
;SETTING THE DATE

MOVLW B'10101101'
MOVWF RTCCFG
MOVLW B'00010010'
MOVWF RTCVALL
;SETTING HOURS

MOVLW B'00000001'
MOVWF RTCVALH
;SETTING WEEKDAY

MOVLW B'10101100'
MOVWF RTCCFG
MOVLW B'01010000'
MOVWF RTCVALH
;SETTING MINUTES

MOVLW B'01000000'
MOVWF RTCVALL
;SETTING SECONDS


revert asap ....


regards,

fag
 

Check you really want to be in register bank zero.
It would be much easier if you used bit names rather than binary numbers for all the config bits.
Why are you writing to RTCCFG so many times?

Brian.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top