CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Setting up Timer1 oscillator of PIC18F45K20

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
kgng97ccs



Joined: 02 Apr 2022
Posts: 97

View user's profile Send private message

Setting up Timer1 oscillator of PIC18F45K20
PostPosted: Thu May 12, 2022 4:38 am     Reply with quote

This relates to setting up the Timer1 oscillator of PIC18F45K20.

The 18F45K20.h file has the following options for Timer1:
Code:
#define T1_DISABLED         0
#define T1_INTERNAL         0x85
#define T1_EXTERNAL         0x87
#define T1_EXTERNAL_SYNC    0x83

#define T1_CLK_OUT          8

#define T1_DIV_BY_1         0
#define T1_DIV_BY_2         0x10
#define T1_DIV_BY_4         0x20
#define T1_DIV_BY_8         0x30

There is no #define constant to set the T1OSCEN bit (bit 3) of T1CON.

It seems that the constant should be 0b00001000, but this number (8) is assigned to T1_CLK_OUT.

Is it that one has to specifically define the constant or access the register in order to set this bit?
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu May 12, 2022 5:09 am     Reply with quote

This is how you enable the external oscillator circuit for Timer1;
Code:
setup_timer_1(T1_EXTERNAL | T1_DIV_BY_1 | T1_CLK_OUT);


T1_CLK_OUT enables the driver for the T1OSO pin (Timer1 osc out).
So in a way, it is enabling "clock out".
kgng97ccs



Joined: 02 Apr 2022
Posts: 97

View user's profile Send private message

PostPosted: Thu May 12, 2022 8:15 pm     Reply with quote

Thank you for your help.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group