Did you define OSC 16 in your code?
Al.
Did you define OSC 16 in your code?
Al.
All progress began with an idea
I would start by checking the comfigurations of the pins being used to connect the one wire devices. There are quite a few new configuration registers compared to the 4620. I have converted a lot of code from the 4620 to 46K22. Look at the data sheet. Your code should be compatable 100%. Just look at the config's.
Dave Purola,
N8NTA
EN82fn
I too use the Ds1307 in a few of my projects, most of which are based on an 18F4580. These are running at 40Mhz (10 Mhz xtal with OSC set to 40 and HS_PLL in the config), and on occasion these would either display 10:10 for time and date regardless of being either breadboarded or on a plug in module for the Easypic development board. I often found that changing the 37 khz crystal resolved the issue, or connecting a LED and suitable resistor between the SQW pin and GND so it pulsed at 1 sec intervals would somehow cause the chip to communicate to the PIC
I believe I got all the registers I needed to set. I have the RTC on pins D6 and D7 (Both set to output):
SDA VAR Portd.6 ' RTC I2C serial clock line
SCL VAR Portd.7 ' RTC I2C serial data line
TRISD=%00000010
'MPASM CONFIG
@ __config _CONFIG1H, _FOSC_INTIO67_1H & _FCMEN_OFF_1H & _PRICLKEN_ON_1H & _IESO_OFF_1H
@ __config _CONFIG2L, _PWRTEN_OFF_2L & _BOREN_OFF_2L & _BORV_285_2L
@ __config _CONFIG2H, _WDTEN_OFF_2H & _WDTPS_32768_2H
@ __config _CONFIG3H, _CCP2MX_PORTB3_3H & _PBADEN_OFF_3H & _MCLRE_INTMCLR_3H
@ __config _CONFIG4L, _STVREN_OFF_4L & _LVP_OFF_4L & _XINST_OFF_4L & _DEBUG_OFF_4L
@ __config _CONFIG5L, _CP0_OFF_5L & _CP1_OFF_5L & _CP2_OFF_5L & _CP3_OFF_5L
@ __config _CONFIG5H, _CPB_OFF_5H & _CPD_OFF_5H
@ __config _CONFIG6L, _WRT0_OFF_6L & _WRT1_OFF_6L & _WRT2_OFF_6L & _WRT3_OFF_6L
@ __config _CONFIG6H, _WRTC_OFF_6H & _WRTB_OFF_6H & _WRTD_OFF_6H
@ __config _CONFIG7L, _EBTR0_OFF_7L & _EBTR1_OFF_7L & _EBTR2_OFF_7L & _EBTR3_OFF_7L
@ __config _CONFIG7H, _EBTRB_OFF_7H
All interrupts and ADC's are disabled also.
Dave,
You were correct, and it was a register I shouldn't have missed... ANSELx registers. I guess the 4620 default was digital I/O since it ran fine in the past on that micro. I would have guessed the 46k22 would have defaulted to digital as well since everything else that required digital I/O worked. I had one other small issue where the speed difference in processors was going too fast for voltage to drain on a pin that I am using for both input and output, but a very small delay was all that was needed there. Everything is working now.
Thanks to all who offered suggestions! I tried them all.
Jim
Yes, I have found there are quite a few new functions added to the "K22" series of processors. You have to keep in mind the programmable alternate pins as well as the power control modules. Disabling unused functions saves a lot of power.
Dave Purola,
N8NTA
EN82fn
Bookmarks