Pin control
Programming Debugging C Interface Reference Platform Notes Release Notes DownloadPin control
Pin control is available in SPI sessions only.
You can control the following pins - MCLR, PGC, PGDO, PGM/RTS/AMCLR.
MCLR pin
MCLR pin is special, it can output high voltage. In NSDSP-2, you can configure it to output high voltage using the HVP setting. The following table shows how the MCLR and HVP settings determine the state of the MCLR pin:
MCLR | HVP | MCLR Voltage |
---|---|---|
0 | 0 | 0 |
0 | 1 | High voltage |
1 | 0 | VDD |
1 | 1 | VDD |
For NSDSP-1, you can achieve a similar effect if you combine it with NSHVX, except that NSHVX-1 uses external PGM/RTS/AMCLR pin instead of the internal HVP setting.
NSDSP-2 supports two high voltage levels - 9 and 12 volts. The level must be set using the NSDSP Object before you open the SPI session.
PGC and PGDO pin
These pins are used as SPI pins. Therefore, if you want to manipulate these pins SPI must be disabled. Both pins are controlled by a single command which either sets the state of both pins at the same time or returns the pins to SPI. There are no commands to control these pins individually.
LED
In NSDSP-2 you can also control states of red and green LED.
Timing
All commands are executed by NSDSP at regular intervals. The time between consecutive commands depends on the SPI rate. The table below shows the list of available SPI rates along with the corresponding time intervals between commands:
Frequency | Interval |
---|---|
50 kHz | 161.3 μs |
100 kHz | 80.7 μs |
250 kHz | 32.7 μs |
500 kHz | 16.7 μs |
1 MHz | 8.7 μs |
1.5 MHz | 6 μs |
2 MHz | 4.7 μs |
2.4 MHz | 4 μs |
3 MHz | 3.3 μs |
4 MHz | 2.7 μs |
6 MHz | 2 μs |
If you want to delay commands, you can insert delays. The shortest delays simply skip one command. Longer delays may be specified in milliseconds or microseconds. The delay produced by the delay functions is guaranteed to last for at least the specified time, but may last longer. Maximum delay is 3 seconds.
When you specify longer delays, it is a good idea to increase timeouts, so that the operation wouldn't time out in the process.
© 2007-2025 Northern Software Inc. All Rights Reserved.