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.

}<br />

}<br />

}<br />

output_toggle(PIN_B0);<br />

previous_tick = current_tick;<br />

Example<br />

Files:<br />

Also See:<br />

None<br />

get_ticks(), set_ticks()<br />

#use touchpad<br />

Syntax:<br />

Elements:<br />

#USE TOUCHPAD (options)<br />

RANGE=x<br />

Sets the oscillator charge/discharge current range. If x is L, current is nominally<br />

0.1 microamps. If x is M, current is nominally 1.2 microamps. If x is H, current is<br />

nominally 18 microamps. Default value is H (18 microamps).<br />

THRESHOLD=x<br />

x is a number between 1-100 and represents the percent reduction in the nominal<br />

frequency that will generate a valid key press in software. Default value is 6%.<br />

SCANTIME=xxMS<br />

xx is the number of milliseconds used by the microprocessor to scan for one key<br />

press. If utilizing multiple touch pads, each pad will use xx milliseconds to scan for<br />

one key press. Default is 32ms.<br />

PIN=char<br />

If a valid key press is determined on “PIN”, the software will return the character<br />

“char” in the function touchpad_getc(). (Example: PIN_B0='A')<br />

SOURCETIME=xxus (CTMU only)<br />

xx is thenumber of microseconds each pin is sampled for by ADC during each<br />

scan time period. Default is 10us.<br />

Purpose:<br />

This directive will tell the compiler to initialize and activate the Capacitive Sensing<br />

Module (CSM)or Charge Time Measurement Unit (CTMU) on the microcontroller.<br />

The compiler requires use of the TIMER0 and TIMER1 modules for CSM and<br />

Timer1 ADC modules for CTMU, and global interrupts must still be activated in<br />

the main program in order for the CSM or CTMU to begin normal operation. For<br />

most applications, a higher RANGE, lower THRESHOLD, and higher SCANTIME<br />

will result better key press detection. Multiple PIN's may be declared in “options”,<br />

but they must be valid pins used by the CSM or CTMU. The user may also<br />

generate a TIMER0 ISR with TIMER0's interrupt occuring every SCANTIME<br />

milliseconds. In this case, the CSM's or CTMU's ISR will be executed first.<br />

148

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

Saved successfully!

Ooh no, something went wrong!