 |
 |
| View previous topic :: View next topic |
| Author |
Message |
SkeeterHawk
Joined: 16 Oct 2010 Posts: 57 Location: Florissant, CO
|
| Can the CCS Compiler Control the "Input Threshold Contr |
Posted: Mon Oct 27, 2025 6:41 pm |
|
|
I am using compiler version 5.114 on a PIC18F57Q84. In the datasheet for that part, in section 19.7, it mentions that the INLVLx register can be used to control the input threshold for specific pins to make them a Schmitt trigger or TTL. It says in section 50.3.4 of the same datasheet that for the Schmitt trigger it will trigger at 0.2 VDD, and for the TTL buffer it will trigger at 0.8V. I am using the chip at 5V, so I assume that the Schmitt Trigger threshold will be 0.2 x 5V = 1V. I am using an optocoupler on this line that isn't a logic output, so if I can use it at 0.8V instead of 1V, it will trigger earlier which will help my application. I have poured over the device file for the ...57Q84 and I don't see any way to manipulate this register. Is the only way that I can hope to manipulate this register is to use the
| Code: | | #bit Bit_INLVLA5 = getenv("SFR:INLVLA").5 // function? (For example) |
_________________ Life is too short to only write code in assembly... |
|
 |
Ttelmah
Joined: 11 Mar 2010 Posts: 19970
|
|
Posted: Wed Oct 29, 2025 12:39 am |
|
|
There are other ways of controlling this, but unfortunately it is not going to
do what you want. You are misunderstanding the thresholds.
The signal is seen as changing when it travels from Vil to Vih.
Vil for a Schmitt input is 0.2Vdd, but Vih is 0.8Vdd. So the signal has to
travel between 1v and 4v to actually be seen as a change.
Nothing at all happens 'at' the low threshold, except if a signal was 'high',
it is then seen as low, when it passes this downwards. A rising signal
will not be seen as high till it passes the Vih.
The alternative thresholds for normal use are the TTL thresholds, so
0.8v and 2,4v. You would normally just set the threshold for the whole
port, rather than just for a single bit.
You don't tell us what the actual voltage output of the opto, is, but you
can do a detection at a level, with the comparator inputs. You can control
the voltage used for comparison with the DAC, and with a resistor, can
add a little hysteresis to avoid unwanted triggers. |
|
 |
|
|
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
|