Finally got the HI2C working on this chip (I think it was a #config problem). Now I am having trouble getting the timer1 module to cause an interrupt on overflow (during sleep).
This is what I have (it works fine on a 16F1705 - which as far as I can see has the same registers associated with timer1 and interrupts)
#chip 16LF18326,4
#config RSTOSC=hfint1, MCLRE=Off, WDTE=off, boren=off
dir porta.4 in 'timer1
dir porta.5 in 'timer1
TMR1H=b'1000000'
TMR1L=b'0000000'
pir1.0=0
t1con=b'10001101' 'timer1 1:1
intcon.7=1
pie1.0=1
t1gcon.7=0
do
'********program here
sleep
nop
pir1.0=0
loop
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have a clock crystal (32kHz) on the socsi/sosco pins as a secondary oscillator to provide interrupts every second (accurately). I am using the internal oscillator at 4MHz as the cpu oscillator.
As far as I can see the secondary oscillator pins cannot be reconfigured by the PPS (the T1GPPS is a gate for the oscillator which I have disabled).
I cannot find the vendor demos\GCB board folders.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Well I'm glad I've finally found the demos!
No those alterations still do not work. I'm pretty sure everything is correct and it works on a 16F1705 which has very similar settings for the T1 oscillator.
I'm beginning to wonder if the oscillator module in this chip is a bit more fussy and the clock crystal is not oscillating - I will investigate.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
#Config WRT_OFF, CPD_ON, MCLRE_ON, FEXTOSC_OFF, CLKOUTEN_OFF 'These configs = User non-votatile protection off (WRT), Data non-votatile protection off (CPD), MCLR pin function enablesd, External oscillator not enabled and clockout function is disables ( enable portc.5 to I/O port).
So, FEXTOSC_OFF, CLKOUTEN_OFF is the key.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Finally got the HI2C working on this chip (I think it was a #config problem). Now I am having trouble getting the timer1 module to cause an interrupt on overflow (during sleep).
This is what I have (it works fine on a 16F1705 - which as far as I can see has the same registers associated with timer1 and interrupts)
Look in your install for this demo. 15 Rotate the LEDs using the Timer Overflow Event.gcb This is in the Vendor Demos\GCB Board folders.
But, you have not set T1GPPS = 0x04. Is this required?
And, are you saying when you select 4mhz the incorrect oscillator is selected?
I have a clock crystal (32kHz) on the socsi/sosco pins as a secondary oscillator to provide interrupts every second (accurately). I am using the internal oscillator at 4MHz as the cpu oscillator.
As far as I can see the secondary oscillator pins cannot be reconfigured by the PPS (the T1GPPS is a gate for the oscillator which I have disabled).
I cannot find the vendor demos\GCB board folders.
I did not show the complete folder structure - it was more of a pointer for you. :-)
..\GCB@Syn\GreatCowBasic\Demos\Vendor Boards\Great Cow Basic Demo Board\16f18326 ChipRange Demonstrations
So I am currently in https://sourceforge.net/p/gcbasic/discussion/ how do I find that directory?
This is in your local computer installation. You have 500+ demos installed.
Try this. I am wonder if we are setting, in the lowlevel code, something that you are also setting.
Well I'm glad I've finally found the demos!
No those alterations still do not work. I'm pretty sure everything is correct and it works on a 16F1705 which has very similar settings for the T1 oscillator.
I'm beginning to wonder if the oscillator module in this chip is a bit more fussy and the clock crystal is not oscillating - I will investigate.
No it is not even oscillating. With a 16F1705 in its place I see the 32kHz oscillations on pin RA5.
Study these...these are the demo configs.
#Config WRT_OFF, CPD_ON, MCLRE_ON, FEXTOSC_OFF, CLKOUTEN_OFF
'These configs = User non-votatile protection off (WRT), Data non-votatile protection off (CPD), MCLR pin function enablesd, External oscillator not enabled and clockout function is disables ( enable portc.5 to I/O port).So, FEXTOSC_OFF, CLKOUTEN_OFF is the key.
Thanks again. That has done the trick. These newer types certainly have challenging #config settings.
I guess I also need WRT_OFF to write to memory.
Don't be guessing..... LOL!!!