PIC18F25K80 timer1 problem

A forums to allow bugs and problems with Flowcode v7 to be reported and resolved.

Moderator: Benj

Post Reply
User avatar
STibor
Posts: 263
Joined: Fri Dec 16, 2011 3:20 pm
Has thanked: 116 times
Been thanked: 113 times
Contact:

PIC18F25K80 timer1 problem

Post by STibor »

Hello!

I compiled an old v6 project in v7.
An old "T1SOSCEN error" emerged.
Old thread: http://www.matrixtsl.com/mmforums/viewt ... 59&t=17312

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: PIC18F25K80 timer1 problem

Post by Benj »

Hello,

For 8-bit PIC devices V7 and V8 use a different compiler to V6 which has a different syntax for accessing registers.

Instead of

Code: Select all

st_bit(t1con, T1OSCEN);
Try this.

Code: Select all

st_bit(T1CON, T1OSCEN);

User avatar
STibor
Posts: 263
Joined: Fri Dec 16, 2011 3:20 pm
Has thanked: 116 times
Been thanked: 113 times
Contact:

Re: PIC18F25K80 timer1 problem

Post by STibor »

Thanks,

I know the syntax but there is nothing T1CON, T1SOSCEN bit, only T1CON, SOSCEN.
I think you've passed the bug from an old version of V6.

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: PIC18F25K80 timer1 problem

Post by Benj »

Hello,

Aha yes in the xc8 compiler definition for the device the T1CON register has these bits.

Code: Select all

typedef union {
    struct {
        unsigned                        :2;
        unsigned NOT_T1SYNC             :1;
    };
    struct {
        unsigned TMR1ON                 :1;
        unsigned RD16                   :1;
        unsigned nT1SYNC                :1;
        unsigned SOSCEN                 :1;
        unsigned T1CKPS                 :2;
        unsigned TMR1CS                 :2;
    };
    struct {
        unsigned                        :4;
        unsigned T1CKPS0                :1;
        unsigned T1CKPS1                :1;
        unsigned TMR1CS0                :1;
        unsigned TMR1CS1                :1;
    };
    struct {
        unsigned                        :3;
        unsigned T1OSCEN                :1;
        unsigned                        :3;
        unsigned T1RD16                 :1;
    };
} T1CONbits_t;

User avatar
STibor
Posts: 263
Joined: Fri Dec 16, 2011 3:20 pm
Has thanked: 116 times
Been thanked: 113 times
Contact:

Re: PIC18F25K80 timer1 problem

Post by STibor »

I modified the fcd file.
I replaced T1SOSCEN to SOSCEN.
This is how the timer1 interruption works well.
Attachments
t1soscen.PNG
(12.6 KiB) Downloaded 2133 times

Post Reply