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.

Relevant Include Files:<br />

None, all functions built-in<br />

Relevant getenv() parameters:<br />

PIN:pb<br />

Returns a 1 if bit b on port p is on this part<br />

Example Code:<br />

#use fast_io(b)<br />

...<br />

Int8 Tris_value= 0x0F;<br />

int1 Pin_value;<br />

...<br />

set_tris_b(Tris_value);<br />

output_high(PIN_B7);<br />

If(input(PIN_B0)){<br />

output_high(PIN_B7);}<br />

//Sets B0:B3 as input and B4:B7 as output<br />

//Set the pin B7 to High<br />

//Read the value on pin B0, set B7 to low if pin B0 is high<br />

Internal LCD<br />

Some families of PIC microcontrollers can drive a glass segment LCD directly, without the need<br />

of an LCD controller. For example, the PIC16C92X, PIC16F91X, and PIC16F193X series of<br />

chips have an internal LCD driver module.<br />

Relevant Functions:<br />

setup_lcd<br />

(mode, prescale, [segments])<br />

lcd_symbol<br />

(symbol, segment_b7 ...<br />

segment_b0)<br />

lcd_load(ptr, offset, length)<br />

lcd_contrast (contrast)<br />

Relevant Preprocessor:<br />

None<br />

Configures the LCD Driver Module to use the specified mode,<br />

timer prescaler, and segments. For more information on valid<br />

modes and settings, see the setup_lcd( ) manual page and the<br />

*.h header file for the PIC micro-controller being used.<br />

The specified symbol is placed on the desired segments, where<br />

segment_b7 to segment_b0 represent SEGXX pins on the PIC<br />

micro-controller. For example, if bit 0 of symbol is set, then<br />

segment_b0 is set, and if segment_b0 is 15, then SEG15 would<br />

be set.<br />

Writes length bytes of data from pointer directly to the LCD<br />

segment memory, starting with offset.<br />

Passing a value of 0 – 7 will change the contrast of the LCD<br />

segments, 0 being the minimum, 7 being the maximum.<br />

54

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

Saved successfully!

Ooh no, something went wrong!