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

Question about CLC, PIC16F1619

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



Joined: 21 Mar 2020
Posts: 44

View user's profile Send private message

Question about CLC, PIC16F1619
PostPosted: Thu Jan 14, 2021 4:05 pm     Reply with quote

Hey, i have a question about the clc unit.
I use the PIC 16LF1619.

In the ccs compiler i can't find a command to connect or not connected the 4 inputs individually to the gate.

On page 447 of the datasheet it says, the pins can be connected or not connected.
The corresponding register: CLCxGLS0: GATE 1 LOGIC SELECT REGISTER.

many greetings
temtronic



Joined: 01 Jul 2010
Posts: 9241
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Thu Jan 14, 2021 4:41 pm     Reply with quote

I opened the manual (F11 as I use MPLAB...) and put 'CLC' in the search box.
There were 4 entries !
Now if this doesn't work for you, you may have an older version of the compiler.
This thread has got me curious to see if I can use the CLC module to replace a 30 year old PAL device.....
Ttelmah



Joined: 11 Mar 2010
Posts: 19537

View user's profile Send private message

PostPosted: Fri Jan 15, 2021 8:19 am     Reply with quote

The selections to the gate are done with #pin_select. There are four
input function selections CLCIN0 to CLCIN3.
So to route PIN A0 to CLCIN0, you use:
#PIN_SELECT CLCIN0=PIN_A0
etc..
If you look at table 19-1 these then become the bottom 4 options here.
The alternative is to select internal functions (so oscillator, UART etc.).
So with the pins setup if required. you use
clcx_setup_input(n, selection), where 'n' is the input number, 1 to 4, and
'selection;, is one of the header defines:
Code:

#define CLC_INPUT_CLCIN0                    0   
#define CLC_INPUT_CLCIN1                    0x01   
#define CLC_INPUT_CLCIN2                    0x02   
#define CLC_INPUT_CLCIN3                    0x03   
#define CLC_INPUT_CLC1OUT                   0x04       
#define CLC_INPUT_CLC2OUT                   0x05       
#define CLC_INPUT_CLC3OUT                   0x06         
#define CLC_INPUT_CLC4OUT                   0x07         
#define CLC_INPUT_C1OUT                     0x08         
#define CLC_INPUT_C2OUT                     0x09         
#define CLC_INPUT_COG1A                     0x0A   
#define CLC_INPUT_COG1B                     0x0B   
#define CLC_INPUT_CCP1OUT                   0x0C         
#define CLC_INPUT_CCP2OUT                   0x0D         
#define CLC_INPUT_PWM3                      0x0E           
#define CLC_INPUT_PWM4                      0x0F           
#define CLC_INPUT_SCK1                      0x10   
#define CLC_INPUT_SDO1_SDA1                 0x11
#define CLC_INPUT_NCO                       0x12
#define CLC_INPUT_ZCD                       0x13   
#define CLC_INPUT_U1TX                      0x14   
#define CLC_INPUT_U1DT                      0x15   
#define CLC_INPUT_TIMER4                    0x16   
#define CLC_INPUT_TIMER6                    0x17   
#define CLC_INPUT_TIMER0                    0x18   
#define CLC_INPUT_TIMER1                    0x19   
#define CLC_INPUT_TIMER2                    0x1A   
#define CLC_INPUT_IOCIF                     0x1B   
#define CLC_INPUT_ADCRC                     0x1C   
#define CLC_INPUT_LFINTOSC                  0x1D   
#define CLC_INPUT_HFINTOSC                  0x1E   
#define CLC_INPUT_FOSC                      0x1F 


So if you wanted to use (say) pin A0 as input 1, for CLC1, you would need:
Code:

#PIN_SELECT CLCIN0=PIN_A0

//then
clc1_setup_input(1, CLC_INPUT_CLCIN0);
andresteff



Joined: 21 Mar 2020
Posts: 44

View user's profile Send private message

CLCxGLS0: GATE 1 LOGIC SELECT REGISTER
PostPosted: Fri Jan 15, 2021 2:17 pm     Reply with quote

thanks, but my question was a different one.
Each gate has 4 inputs, for 4 different signals.

In the datasheet on page 440 (PIC16F1619) it says:

"Enable the chosen inputs through the four gates
using CLCxGLS0, CLCxGLS1, CLCxGLS2, and
CLCxGLS3 registers.
"

Each of the 4 signals of a gate can be connected or not connected.
As inverting or not inverting.
With the: CLCxGLS0: GATE 1 LOGIC SELECT REGISTER (Page 447)
I can not find a command for it!
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Jan 15, 2021 6:52 pm     Reply with quote

The data sheet page that you referenced corresponds to these parameters
in the 16F1619.h file.
Quote:

/ As an alternative to the above defines any of the following can be
// OR'ed together // to enable the individual inputs to the specified gate.
#define CLC_GATE_INVERTED_INPUT_1 0x001
#define CLC_GATE_NON_INVERTED_INPUT_1 0x002
#define CLC_GATE_INVERTED_INPUT_2 0x004
#define CLC_GATE_NON_INVERTED_INPUT_2 0x008
#define CLC_GATE_INVERTED_INPUT_3 0x010
#define CLC_GATE_NON_INVERTED_INPUT_3 0x020
#define CLC_GATE_INVERTED_INPUT_4 0x040
#define CLC_GATE_NON_INVERTED_INPUT_4 0x080
#define CLC_GATE_OUTPUT_INVERTED 0x100


So I think this is how CCS expects you to do it:
Code:

clc1_setup_gate(1, CLC_GATE_NON_INVERTED_INPUT_1 |
                   CLC_GATE_NON_INVERTED_INPUT_2 |
                   CLC_GATE_INVERTED_INPUT_3 |
                   CLC_GATE_INVERTED_INPUT_4);
Ttelmah



Joined: 11 Mar 2010
Posts: 19537

View user's profile Send private message

PostPosted: Sat Jan 16, 2021 3:19 am     Reply with quote

and (of course) just omit the gate inputs that don't want a connection.
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