Search found 113 matches

by blackcattech
Fri Jan 03, 2014 9:19 am
Forum: General
Topic: Timer 1 oscillator
Replies: 4
Views: 2657

Re: Timer 1 oscillator

Correct, I meant series... Product over sum and all that... Anyway, the calculation I saw shows that 22pF capacitors are about right for a 12.5pF xtal, depending on the parasitics. I guess 18pF or even 15pF might be closer if the parasitics are more than a couple of pF. However, the datasheet sugges...
by blackcattech
Thu Jan 02, 2014 5:41 pm
Forum: General
Topic: Timer 1 oscillator
Replies: 4
Views: 2657

Re: Timer 1 oscillator

The xtal is rated for 12.5pF. From what I've read (from an app note from the manufacturer) you calculate the parallel value for the capacitors you choose and add a bit for parasitics so 22pF seems about right. (22/2 = 11 + 1.5pF parasitic) The Microchip datasheet actually suggests 33pF for a 32kHz x...
by blackcattech
Wed Jan 01, 2014 6:55 pm
Forum: General
Topic: Timer 1 oscillator
Replies: 4
Views: 2657

Timer 1 oscillator

I'm having some issues with the timer 1 oscillator and was wondering if anyone else had come across this. I use a 32768Hz watch crystal, 12.5pF and 2x 22pF load capacitors. At room temperature all works fine but if I move the unit in to a cool, moist place (garage for example) then the oscillator st...
by blackcattech
Wed Sep 04, 2013 11:22 am
Forum: Compiler
Topic: Modules not being recognised in a main program
Replies: 4
Views: 2846

In the words of Homer Simpson, 'D'oh!'

Thanks. I knew it would be something really stupid I was doing wrong...
by blackcattech
Wed Sep 04, 2013 11:13 am
Forum: Compiler
Topic: Modules not being recognised in a main program
Replies: 4
Views: 2846

Oh, and I should mention I've added a RW_Byte command to the SPI modules which simply returns the SSP Buffer register after writing a byte. My understanding of the SSP module is that data is clocked in as it is being clocked out so it reads and writes at the same time. I would suspect there is no re...
by blackcattech
Wed Sep 04, 2013 11:11 am
Forum: Compiler
Topic: Modules not being recognised in a main program
Replies: 4
Views: 2846

Some of the code is a bit messy, I've tried to do it quickly so I can test the module work as expected. Module RFM70 #option RFM70_CSN = PORTB.4 // Chip Select (active low) pin #option RFM70_CE = PORTB.0 // Chip Enable pin #option RFM70_IRQ = PORTB.5 // IRQ pin #if IsOption(RFM70_SPI1) Include "SPI....
by blackcattech
Wed Sep 04, 2013 11:10 am
Forum: Compiler
Topic: Modules not being recognised in a main program
Replies: 4
Views: 2846

Modules not being recognised in a main program

I'm working on a module for the RFM70 transceiver. I've ported the supplied sample code in to Swordfish as a module. All seems OK, the code explorer shows all consts, variables and subs and if I set an option that would normally be set externally, the module compiles. However, when I try and include...
by blackcattech
Wed Aug 21, 2013 1:57 pm
Forum: Compiler
Topic: WREG saving in interrupts?
Replies: 11
Views: 4814

Ah, OK. I was expecting WREG to be in there somewhere. I guess MOVWF is obvious, but the restoring code isn't so obvious unless you know more about PIC assembly.
by blackcattech
Wed Aug 21, 2013 1:47 pm
Forum: Compiler
Topic: WREG saving in interrupts?
Replies: 11
Views: 4814

OK, I've edited out the actual content of the ISR, but my code is: Interrupt OnInt() Dim C As Byte Save(0,FSR0,FSR1,WREG) If Timer0IF = true Then // Timer 0 called 10 times a second. Decrements timers. Timer0H = T0ReloadH // Reload ... Timer4IF = false EndIf Restore End Interrupt And the ASM output ...
by blackcattech
Wed Aug 21, 2013 12:52 pm
Forum: Compiler
Topic: WREG saving in interrupts?
Replies: 11
Views: 4814

I've checked the assembly code and it does do 'REFTIE 1' However, something very odd. I can't see anything restoring WREG despite it being saved. The code only seems to restore '0', FSR0 and FSR1. Indeed, the code before the restoration code is a DECFSZ WREG command (followed by a BRA -6) so obvious...
by blackcattech
Tue Aug 20, 2013 8:44 pm
Forum: Compiler
Topic: WREG saving in interrupts?
Replies: 11
Views: 4814

I don't know if it makes any difference, but I only write the variable outside the ISR. It is a 'timer'. The ISR is called at a fixed frequency. It tests if the variable is non-zero and if so decrements it, setting a flag when it reaches zero. What seems to be happening is that the lower byte is bei...
by blackcattech
Tue Aug 20, 2013 7:49 pm
Forum: Compiler
Topic: WREG saving in interrupts?
Replies: 11
Views: 4814

I only have one ISR defined in this program, although it services multiple interrupts. However, isn't GIE disabled as soon as you enter the ISR and not re-enabled until the interrupt exits? Am I right in my understanding that you are talking about using both interrupt priority levels when you talk a...
by blackcattech
Tue Aug 20, 2013 11:07 am
Forum: Compiler
Topic: WREG saving in interrupts?
Replies: 11
Views: 4814

WREG saving in interrupts?

I've been having a problem where a Word variable which is access in my ISR sometimes isn't set properly outside the ISR. I finally worked out that if the ISR call coincides with the write to the variable then only the lower byte is written correctly. I've found a fix for this but I am confused as to...
by blackcattech
Fri Aug 16, 2013 2:15 pm
Forum: Compiler
Topic: Double passing of strings
Replies: 14
Views: 5236

Thanks, Jerry. I will have to look in to using MPLAB but I was a bit put off using that as last time I tried I ended up bricking my PICKit3 and had a right hassle fixing it. If I'm understanding your results correctly, it appears the compiler is looking at the first call of a routine to determine th...
by blackcattech
Thu Aug 15, 2013 3:25 pm
Forum: Compiler
Topic: Double passing of strings
Replies: 14
Views: 5236

I'll have to have a think and see what I can come up with. I have no easily replicable output means, I'm using an OLED on custom hardware for text display so pasting the output routines I use would be of little use to you here. I also don't have an RS232 input so I can't use a terminal instead.... A...