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

Switching inLVL register in EUSART

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



Joined: 15 Sep 2003
Posts: 9

View user's profile Send private message

Switching inLVL register in EUSART
PostPosted: Wed Mar 24, 2021 4:34 pm     Reply with quote

Hi,

PIC 16F18456
CCS 5.084

Standard problem 5V PIC and 3.3 UART device. Of course it won't work because PIC input High is >0.8Vdd.

Can I change INLVL register to work as TTL not ST? This would solve this problem (I think). Of course 3.3V device must tolerate 5V input.

I didn't find information how to change INLVL register in CCS. Any suggestion?

Regards
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

Re: Switching inLVL register in EUSART
PostPosted: Wed Mar 24, 2021 4:47 pm     Reply with quote

Bieli wrote:
I didn't find information how to change INLVL register in CCS. Any suggestion?


In the current version of the compiler, it has the set_input_level_x()
function, where 'x' is the port a, b, c, etc.

The CCS manual says:
Quote:

Function:
These functions allow the I/O port Input Level Control (INLVLx) registers
to be set. Each bit in the value represents one pin. A 1 sets the
corresponding pin's input level to Schmitt Trigger (ST) level, and a 0 sets
the corresponding pin's input level to TTL level.


If that's not supported in your version, then use this (for example):

Put this line above main():
Code:
#byte INLVLA = getenv("SFR:INLVLA")

Then in main(), do this:
Code:
INLVLA = 0x01;  // To set pin A0 to be a Schmitt Trigger input
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