17.02.2015 Views

CCS C Compiler Manual PCB / PCM / PCH

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

pin_select()<br />

Syntax:<br />

Parameters:<br />

pin_select(peripheral_pin, pin, [unlock],[lock])<br />

peripheral_pin – a constant string specifying which peripheral pin to map<br />

the specified pin to. Refer to #pin_select for all available strings. Using<br />

“NULL” for the peripheral_pin parameter will unassign the output<br />

peripheral pin that is currently assigned to the pin passed for the pin<br />

parameter.<br />

pin – the pin to map to the specified peripheral pin. Refer to device's<br />

header file for pin defines. If the peripheral_pin parameter is an input,<br />

passing FALSE for the pin parameter will unassign the pin that is<br />

currently assigned to that peripheral pin.<br />

unlock – optional parameter specifying whether to perform an unlock<br />

sequence before writing the RPINRx or RPORx register register<br />

determined by peripheral_pin and pin options. Default is TRUE if not<br />

specified. The unlock sequence must be performed to allow writes to the<br />

RPINRx and RPORx registers. This option allows calling pin_select()<br />

multiple times without performing an unlock sequence each time.<br />

Returns:<br />

Availability:<br />

Requires:<br />

Examples:<br />

lock – optional parameter specifying whether to perform a lock sequence<br />

after writing the RPINRx or RPORx registers. Default is TRUE if not<br />

specified. Although not necessary it is a good idea to lock the RPINRx<br />

and RPORx registers from writes after all pins have been mapped. This<br />

option allows calling pin_select() multiple times without performing a<br />

lock sequence each time.<br />

Nothing.<br />

On device with remappable peripheral pins.<br />

Pin defines in device's header file.<br />

pin_select(“U2TX”,PIN_B0);<br />

//Maps PIN_B0 to U2TX //peripheral pin, performs unlock<br />

//and lock sequences.<br />

pin_select(“U2TX”,PIN_B0,TRUE,FALSE);<br />

//Maps PIN_B0 to U2TX //peripheral pin and performs //unlock<br />

sequence.<br />

pin_select(“U2RX”,PIN_B1,FALSE,TRUE);<br />

Example Files:<br />

Also See:<br />

//Maps PIN_B1 to U2RX //peripheral pin and performs lock<br />

//sequence.<br />

None.<br />

#pin_select<br />

160

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!