?_5O %OOlp3"Ԡ 5(      :  - "-$TJTJT  "--- "-$TJTJT--"AvantGarde Bk BT-"System---"AvantGarde Bk BT- . 2 =PCW,J-"AvantGarde Bk BT----"AvantGarde Bk BT- .2 {FPEOCVTHATl-"AvantGarde Bk BT----"AvantGarde Bk BT- .2 { vile roject dit ptions ompile iew ools elp '   ' 6 4/ * #  - ---\8  %>>%%EErrr ! !   ---- $##$"6""6----$%:=:=:%:%:--- "-$%:=:=:%:%:--"AvantGarde Bk BT----"AvantGarde Bk BT-  . 2 b.N% 2 .O% 2 .S% 2 A% 2 *\v% 2 \.C% 2 Ml% 2 .P% 2 Cr% 2 $GX%- "AvantGarde Bk BT- -- -"AvantGarde Bk BT-  . 2 bJew: 2 Open= 2 Aave=2 .Save s$:2 *.Sae All/ % 2 \Mlose 2 .Cose All' : 2 Crint 2 . Pinter Setup    2 $.eit1- - -r8 .fJfJg.g.f.OO...AA..\-o-o/\/\-._M_Ma.a._MUUMM.CC..CMMCCG'_'_)G)G'-- - - $$-- --$LDLDL--- "- $LDLDL-- ----"AvantGarde Bk BT-  . 2 rTNL 2 TOL 2 upL 2 irL 2 :TFL 2 lTIL 2 TCL- - -- -"AvantGarde Bk BT-  . 2 rpew 2 upen2 T Oen All files;  O2 TPint All files  $2 :hind text in project    .2 l]nclude Dirs.   2 t lose Project   - - -Q8TvpvpxTxTvTuuTTuuui t tii T>h>h@T@T>Tp]p]rTrTpTttTT-- --$      --- "- $      -- "AvantGarde Bk BT- -- -"AvantGarde Bk BT-  . 2 P  2 M - "AvantGarde Bk BT- -- -"AvantGarde Bk BT-  .2 ' IC Wizard  2 2anual- - -8'' 2 2 -- --$sBBxsxsB--- "- $sBBxsxsB-- ----"AvantGarde Bk BT-  . 2 ~Us 2 ts 2 ~Cs 2 9~Ps 2 kos 2 as 2 ~Fs 2 ~Rs 2 3~Ns 2 eis 2 Bs 2 ~Gs 2 es 2 -vs- - -- -"AvantGarde Bk BT-  .92 !ndo Ctrl+Z  #t@2 ~&Cu Shift+Del#  "92 !opy Ctrl+C  " @2 9&aste Shift+Ins   #2 k~ Cpy from file9 '  2 ~ Pste to file/   =2 $ind Ctrl+F  #72  eplace Ctrl+R  # 72 3 ext F3  +2 e~Fnd Matching } or ) F4 "     2 ~Toggle ookmark!& 2  oto Bookmark  & 32 ~Nxt Window Ctrl+N5 "  # 02 -~Preious Window Ctrl+P - " #- - -8~~~~   ~ ~ ~==?~?~=ooqqo~~~~~~~779~9~7iikki~~~11221-- - -- -"AvantGarde Bk BT-  . 2 0~ 2 1~- - -- -"AvantGarde Bk BT-  .2 * Shift+Ctrl+0    2 * - - -- -"AvantGarde Bk BT-  .2 = Shift+Ctrl+1  2 &* Shift+Ctrl+2   2 N* Shift+Ctrl+3   2 v* Shift+Ctrl+4   2 * Shift+Ctrl+5   2 * Shift+Ctrl+6   2 * Shift+Ctrl+7   2 * Shift+Ctrl+8   2 >* Shift+Ctrl+9   - - -- -"AvantGarde Bk BT-  . 2 &2 2 N3 2 v4 2 5 2 6 2 7 2 8 2 >9 - - -8****-- - -\8)*)***)Q*Q*RRQy*y*zzy********A*A*BBA-- --$555--- "- $555-- - -- -"AvantGarde Bk BT-  . 2 *0 2 *1- - -- -"AvantGarde Bk BT-  .2 = Ctrl+0   2 = - - -- -"AvantGarde Bk BT-  .2 PCtrl+1 2 = Ctrl+2  2 4= Ctrl+3  2 \= Ctrl+4  2 = Ctrl+5  2 = Ctrl+6  2 = Ctrl+7  2 = Ctrl+8  2 $= Ctrl+9  - - -- -"AvantGarde Bk BT-  . 2 *2 2 4*3 2 \*4 2 *5 2 *6 2 *7 2 *8 2 $*9 - - -8*==***==**-- - -\8*==***7=7=8*8*7*_=_=`*`*_*==***==***=׶=***==***'='=(*(*'-- --$l$$ll--- "- $l$$ll-- ----"AvantGarde Bk BT-  . 2 nCl- - -- -"AvantGarde Bk BT-  .2 ompile'- - -$nnn-- - - $(($&:&&:-- --$EE--- "- $EE-- - -- -"AvantGarde Bk BT-  .2 qReal absE2 Tab ize2  Auto ndent 2  ordStar keys   72 9 ditor Font  "2 kSntax Highlighting'   82  Eitor Colors/   2 ecall Open Files  2  Tolbar.) 2 3ile Formats.  '  2 elobal Defines.   '2 Deugger/Programer.3   ' *2 Iclude Dirs.    - ----"AvantGarde Bk BT-  . 2 qNT 2 ?S 2 QI 2 W 2 9E 2 ky 2 d 2 R 2 o 2 3F 2 eG 2 &b 2 n - - -8 Nu]u]wNwNu?RR??QZZQQ     ==??=ooqqo  77997iikki&@@&&-- --$55--- "- $55-- - -- -"AvantGarde Bk BT-  . 2 U#B 2 }#C 2 #K 2 #P 2 #T- - -- -"AvantGarde Bk BT-  .2 U3 ackground2 }<omments 2 4eywords2 3 reProcessor ? 2 /ext- - -;8#Y3Y3Z#Z#Y#<<###44###33###//##-- --$--- "- $-- - -- -"AvantGarde Bk BT-  .2 - C/ASM ist #2 _ ymbol Map' "2 Call ree 2  Sttistics&  2  ata Sheet  2 ' alid Fuses 2 YVald Interrupts    <2  inary File    2  OD Debug File!  - ----"AvantGarde Bk BT-  . 2 -&L! 2 _S! 2 T! 2 a! 2 D! 2 'V! 2 Yi! 2 B! 2 C!- - -g8 &08082&2&0bbddb**,,*\\^^\-- - - $$   -- --$$ $ --- "- $$ $ -- ----"AvantGarde Bk BT-  . 2 D 2 e 2 F 2 DN 2 vS 2 i 2 x 2 P 2 >M 2 pt- - -- -"AvantGarde Bk BT-  .2  evice Editor  b2 Dvice Selector5  b2  ile Compare ' 2 Dumeric Converter'   d"2 verial Port Monitor   " d2  Dsassembler#& 2 Etract Cal Data&    2  rogram Chip  '  2 >PLAB 2 pInernet#  - - -r8 HHJJHzz||zBBDDBttvvt-- - - $G _ _ cG c$F VZ aF lF VZ a-- --$Z p p Z Z p--- "- $Z p p Z Z p-- - -- -"AvantGarde Bk BT-  . 2 c VZ 2 c eZ 2 +c DZ 2 Sy aZ - - -- -"AvantGarde Bk BT-  ."2 u iew Recent Changes  "2 w -mail Tech Support   2 +y ownload Updates  2 Sc Dta Sheets+   - - -08c u u c c c w w c c c .y .y /c /c .y V V Wy Wy V-- - - $e e ` a $n c X n c -- --$' W W ' ' W--- "- $' W W ' ' W-- ----"AvantGarde Bk BT-  . 2 L; A' 2 ~; C' 2 ; I' 2 ; K' 2 ; L' 2 F; E' 2 x; B' 2 ; P' 2 ; D' 2 ; O' 2 ?; S' - - -- -"AvantGarde Bk BT-  . 2 LT boutW2 ~Z ontents  ' 2 C ndex2 Q eyword at cursor    2 L ast Error   2 FP ditor !2 xP uilt in functions   c 2 P reprocessor cmds   '2 W ata types  2 \ perators   2 ?N tatements  ' - - -}8 ; OT OT Q; Q; O; Z Z ; ; ; C C ; ; ; Q Q ; ; ; L L ; ; ; IP IP K; K; I; {P {P }; }; {; P P ; ; ; W W ; ; ; \ \ ; ; ; CN CN E; E; C-- - -$ CEE@@CCEE$ CC $[[$ZnZZn-- - - $nn-- - - $  $-- - -$PPPLLP$KOPLKK $O\OKK\$XZMnBZXZMn-- - -$ `b`[^``bb$ ^````^`^^ $b%b^^%$k$`8U$k$`8-- - -$>*>>*$ us<<suuus $uuqq-- - -$ $ll-- - - $mm$o[oo[-- /&;)z4BLUEPAPR.BMPF |AWBTREE-|AWDATA|CONTEXT|CTXOMAPf|FONT^|KWBTREEu|KWDATA9|KWMAPR|SYSTEMT|TOPICV|TTLBTREE\|bm0|bm1|bm2dS|bm3`|bm4B|bm5Vn|bm6B|bm7uy p lp.3  <      1Courier New-"System---1Courier New- . 2 C T-1Courier New----1Courier New- .2 CiTEST.C2 rMAIN ?614RAM=5d(2  DELAY_MS 0/19 RAM=102  READ_DATA (INLINE) RAM=5G62  PROCESS_DATA (INLINE) RAM=11K32 / OUTPUT_DATA (INLINE) RAM=6+2 ^ PUTHEX (INLINE) RAM=2"2 1PUTHEX1 0/18 RAM=2<2 1# @PUTCHAR_9600_52_49 0/30 RAM=2O 2 1 -----1Courier New- .62 @PUTCHAR_9600_52_49 0/30 RAM=2"2 1PUTHEX1 0/18 RAM=2<2 J1# @PUTCHAR_9600_52_49 0/30 RAM=2O<2 y1# @PUTCHAR_9600_52_49 0/30 RAM=2O-- "-$ C6E4EAA4C6A4A6C6 $d2C2C6d6-  "---$ \Z~~Z\Z\\ $XX\\---- $#$('---- $---- $---- $----$   e e      $,  ,---- $/z{/~----$ WYYUUWUUW $xWWx---- $yXXy----$ SxUvU#Q#QvSxQvQxSx $ttStSxtx---- $v<U=UAv@--y p lp.3  <      1Courier New-"System---1Courier New- . 2 C W-1Courier New----1Courier New- .2 CiTEST.C"2 rMAIN ?406RAM=5d(2  DELAY_MS 0/19 RAM=102  READ_DATA (INLINE) RAM=5w62  PROCESS_DATA (INLINE) RAM=11{32 / OUTPUT_DATA (INLINE) RAM=6+2 ^ PUTHEX (INLINE) RAM=2"2 1PUTHEX1 0/18 RAM=2<2 1# @PUTCHAR_9600_52_49 0/30 RAM=2 2 1 -----1Courier New- .62 @PUTCHAR_9600_52_49 0/30 RAM=2"2 1PUTHEX1 0/18 RAM=2<2 J1# @PUTCHAR_9600_52_49 0/30 RAM=2<2 y1# @PUTCHAR_9600_52_49 0/30 RAM=2-- "-$ C6E4EAA4C6A4A6C6 $d2C2C6d6-  "---$ \Z~~Z\Z\\ $XX\\---- $#$('---- $---- $---- $----$   e e      $,  ,---- $/z{/~----$ WYYUUWUUW $xWWx---- $yXXy----$ SxUvU#Q#QvSxQvQxSx $ttStSxtx---- $v<U=UAv@--++lps;pW = #&WordMicrosoft Word  c Courier New-@Times New Roman-  2 1 c % 2 n_.c *@"Arial-2 pcBYTE 17647. 2 pc .2 pcBYTE 27647. 2 pc .2 p cBYTE 37647. 2 p  c .2 p  cBYTE 47647. 2 p  c .- ! `-  "-`m  "-- ! `-  "-```l-- ! `-  "-``-- ! l-  "-ll-- ! `-  "-```l-- ! `-  "-``-- ! l-  "-ll-- ! `-  "-```l-- ! `-  "-`` -- ! l -  "-l l -- ! ` -  "-` ` ` l -- ! ` -  "-` ` -- ! ` -  "-` m -- ! ` -  "-` ` ` l -- !_ m-  "-m-- !_ m-  "-m-- !_ m-  "-m-- !_ m -  "-m  -- !_ m -  "-m  -2 _.cLowest ..;.* 2 |.c -2 <_.cBYTE 7647 2 <N.c -2 _.cin RAM.<7E 2 n.c . 2 c . 2 c . 2 Gc . 2  c . 2  c .- ! -  "--- ! -  "--- ! -  "--- ! i-  "---#@ J(cCorie Ne@ime Ne Roan-     2 _c*@"ria pBYE 167. p 2 cYTE274 2 c. p BYE 367. p   2  cYTE474 2  -- ! -  "-$-- ! $-  "-$-- ! -  "--- ! -  "- -- ! -  "-  -- !  -  "-  -- ! -  "-  -- !  -  "--- ! -  "--- ! -  "--- ! -  "--- !  -  "--- ! -  "--- ! i-  "---#@ J (~/`` x$  9CXX#@ J (~/`` x$  9CXX#@ J (~  ~/`` x C #@ J 9(~  ~/`` x C #@ J Y(~ ~  ~`` x$ #@ J y(~ ~  ~`` x$ #@ J (~ ~  ~`` x$ #@ J (~ ~  ~`` x$ #@ J (~ ~  ~`` x$ -- ! -  "-$-- ! $-  "-$-- !  -  "--- ! -  "--- ! -  "- -- !  -  "-  -- !  -  "-    -- !  -  "-  -- !  -  "-  -- !  -  "-    -- !  -  "-    - 2 1 c - 2 g1 c - 2 1 c - 2 '1 c - 2 1 c - 2 1 c - 2 G1 c - 2 1 c -- 2 1 c %- "-- !w ---_J $ @"Arial-2 %  $I _LSB%-- 2 %9  $I _ $@"Arial- 2 s  $I _ 6_I $ ''--- !wg---#- 2 $#MSB7-- 2 $4# $- 2 r# 6#''& "- - J%##1=HQX]^|[]ahq|{pg`\ZvW~UQJA6) - -&&  "- - z%;!"$+'7+B1M7WFiXwb}mx    - 7 A L X d p S w_ vk tw q m h a R @ 6 +    - -&--- !e---- 2 8 Bit.7 2  -2 Iexpone.*....2 nt. 2 # -2 with ;.2 hbias of ..*.2 7F .3 2 V -'--- !dX---- 2 Sign7.. 2 9 --2 TBitC 2 T  6''--- !--- %-  2 '% 23 Bit Mantisa..7E..*. 2 ' %  -'& "- - %E- - $HH--&-3*lpn;k &&WordMicrosoft Word   Courier New-@Times New Roman-  2   %@"Arial- 2 c  - 2   - 2 "  - 2   -- "-- !L--  "-!&2 #!Lowest BYTE in RAM..;.*7647.<7E 2 #! -'& "--%C-- $ FF--&-lp1# m dB  BC (8#.#.VVVVVVVVVVVVVVVQVVVVVVVVVVVVVVVVVVVVVVVVVV /?/?/~/m /h ?/h ?~/]  ??x/;  ?x/; <x/; s??Àx.; <??< LJx.;???8<? Ǐx~.2?<x.0~?<?x|.&<?? xx#.#ǟ|px@x<>Çx<?? xpc0.#|8xxp ??8? x`c.#|88 ?q 8<x? ?x`/#Ï<<?Ã8 ?c8x<?? ?ÇxA/#Ç>???#>Áx~/#? ??!?>?xx/#1Ǐ?????!????<xx/#1>?? ?? pC8 ?|?xx/#q>?p8p???xx~/#~?< ? p<?x/#<<> ? <@ x/# 8 ?! ?? x??/#q|?À1 ? ?< |3#1??#0< ?;#18 p|8?x<?Z#q8> ~q#q>8?x#p~|?#p~q#x?##)VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV~U~U~U~UVJ J2TJ2?TJ2?T~TVJ I2TI2TI2T~?TVI  I2TI1TI1T}TUI2UI2UI2UI2UJ3UJ4UJ4UJ4UJ4UJ4UJ4UJ4UJ4UJ4UJ4UJ4U#` 4U3#!4?!4?! 3?!4807?!4z??!4?!4?!4?!4?!4?!/?!/??!/??!/??!/??!.??!+??!+??!+??+??+??+??*??*??x*??p>0+??0 +??0p 8!*??>x#*??C?*??8<+??08+??0+??0*x ?x1# ?0  p# ?00" ?p>8# ?|"  ??"? ?` ?߯d ?!  ?!  ?!  ?! @ ?!  ?!  ! ? ?! ? ?! ??? ?! 0? ? x ? ? { p? ? a 0 ?! c 0? ?! c 0x? ?!  xxc <0hx ?! 0pc 0 ?! x? ?! <?? ?! <? !  ? !   ? ~   ? <   ? 8 ? 8p ? 8 ? 0 ? 0c ? 8c  ? 8c  ? 8c  ? 8x  ?  ?  9|? À  |?  |? ??  A|? ?? 8a|? ? |Ï`|? ? p|?  p|? ! ~|? ! |? ! |Ïx<? ! 8c0`?  ?  ?  ? ?    ?  ?  ? p  ? x? ? 8?a ?  0a჎?Ç ? xa~? ? c~? ? ?!~? ??  ~? ? x ~? ? ? ~? ? xaᏄ? ? ?? ?x ?? ? ?? ?x > ??? ?> x`  8?8 ? ?? ?> 8 ? ? ?< 8  ? ?< < ? ?| |8?   ?|?x8 ??|8? !|  ?< ?| ~?? ?<> !> ?~߁~? À?<> !>  ?|~|0>? À?|? !< ??|?x>? `?  < ????|p??? ??  < ??< ?|0? ?  >? ???< |?? ?  > ??? ?|>? ?>??  >x?~ ><| p?? ?x~?  ?<<p??? ?<?>?c> ??|<`?>π? ?? ~?> ??~<<?`~ ? ?~?> ???_? ? ???? ~? ???  ??? Ï ??? ?C ??? p ~? ???? ~ 8 ?#?? p ?!? ?> ?? ?? ??  ?A??  ? @??  ? ?  ? ?  ??`? ! ?p?o ~! ?p?~! ?p <! ?x? !? ??? ?! ??~! ?0@?q? !? ? p??? !` ?0`?? ! ?x?? ! ??~? ! ??K? ! ?? ? ! ??@? Ï! ??? ! ??? ! ??? ! ???? !? ???? ! ???? ! ???? !_??? ! ??? ! ??? ! ?? ! ??? ! ???? ! ?? ! ??? ! ??? ! ?? ? ! ?? ?? ! ?? ? ! ?? ? ! ?? ? ! ?? ? ! ?? ? ! ? ? ! ? ? ! ? ? ! ? ? ! ? ? ! ?? ? ! ?? ? ! ??  ! ?  ! ? ? ! ?  ! ? ? ! ?  ! ?? ! ?? ! ?? ! ? !? ? !? ?? ! ? !? ??? !? ?? !? ? ? !? ?? !? ?? !? ?!? ?0!? ?*!?  ?*!?  4?*!? ?*!? ?*!? +!? 30!?1!?0!?0!?0!?0!?0!?0!?0!?1!?0!?0!?0!?0!?0!?0!?0!?0!?0!?1!?1!?0!?1!?1!?0!?0!?0!?1!?F!?F!?F!?F!?G!?F!?G!?G!?1!?O!?O!?O!?O!?O!?O!?0!?0!?F!?F!?F!?F!?F!?F!?F!?e!e H !e8!h!?q!':VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV ?HHpЇ???Hj??HUp?~?HOp~?><?xHL|p|?8?p?HL|<p|??pp?p?HL<>0|??p?pHL0?0x>?0?~HL?0x<0HL0x<0HL x<0>HL x?78?<HL x?8>|?HL x??p8>xIL x??08?xIL? x??0?p?x?HL x?0?p?x?HL >x?8x>xHL x?`8xHL ?x??><<HL???x>~HL??|>??x~?HL<>x? IL~~?@^L3kL???tLVVVVVVVVVVVVVVVVVVVVH ? ' ((  ?9 { C sT ejS,\XK'Uw1=Q^!8/WM RuW:3|? axx??8:3 ?p?? xp?8:0s?p? > axq?:p< |q>?8:?|<>~ <> Ǐ|y??8:x8<Ç8 Ǐ|y??p:??~Ï8 Ǐ<|yC?:?? 8Ǐ|y>?:q? ??q8Ǐ|y~?A~:p???Lj?8Ǐ?|y~?p:?Ǐ?>?8ǟ`||y>?p>x:???8 ?Ǐa8|p>?0>8:?>?q?8> x@?>?8~8:?<?p< `@??~8>:8???x??> p`? |:8??0>?q?> ? ~:8~??1?q?>????? ~?:>??0?? ?<???Ïy? G????~?ÇǟS ?Ϗ??x<s?] ??Ãx>#?l>??|8?#{?>8? ??<???$??+VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV7  , 7B777?7er7V`??7L?7L?7L?7L 6A ?72׿?7' ?7H?7??7??7 ?7?7?7??7??7?7?7??7?7?7?7?7??7??7??7??7??7??7??7??7??7??7??7??7??7??7??77??7??77?7?77?7?7?7?7?7?7?7?7?7?7?7?7?7?7?7?7?7?7?7?7?7?7?7?6?6?7?6?7?7?6?7?7?7?7?7?7?7?7?7?7?6?7?6?6?6?6?6?6?6?6?6?6?6?6?6?6?6?6?6?6?6?6?6?6?6?6?6?6?6?6?6?6?6?6?6?6?6?6?6?6?6?6?6?6?6?6?6?6?6?6?6?6?6?6?6?6?6?6?6?6?6?6?6?6?6?6?6?6?66 6  ?6 ?6 ?6 ?6? ??6 ??6 ??6 ?6   ? %   ?% ?   $    ??$    ???$    ??$     ??$?     ?$     ?$    ???$?    ???$    ???$    ???$  ~  ??%  >   ?%     ?%     ?%?    ;? ?)   ?6?   ?6?   ?6?   ?6?  ~ ?6?  > ?6  ~? ?6?   ?6?   ?6 ?6?> ?6? ?6?? ?6?? ?6? ?6??6??6??6??6??6??6??6??6??6??6??6??6??6??6??6??6??6??6??6??6??6??6??6??6??6??6??6??6??6??6??6??6??6??66??6?6?6?6??6??6?6??6??6??6??6?6??6??6??6??6?6?6?6??6??6??6??6?6?6?6 /..9..?.?.?. ?. ?. ??.j ?. ?. ??. ??. ??. ?. ?. . >. ?. ?>. ?. ??. ??. ??.Ç ?.Ï ?.Ï ?. . ??.? ???. ??. ??. ?.? . .Ï ?. ?@. ??. ??. ??. ??. ??. ?. ??. ?. ??. ??. ? ?.??. ??. ??. x_?. ?. ?@t4?. ?4?. 4?. 4?. 4?. g4?.14?.k 14?.14?.14?.D ?14?.14?.14?.>14?.>14?.>14?.>14?.>14?.>14?.>14?.>14?.>14?.>14?.>14?.>14?.>14?.>14?.>14?.>14?.>14?.>14?.>14?.>14?.>14?.>14?.>14?.>14?.>14?#>14?">14?">14?">14?">14?">14?">1- "2?1!%,?1y#*,1S+*,+30+|$0@?8+|O1?D+8 3T+8p1?[+0`/l*8a!Ew*8 A*p<+<+/|+?~+?~+ ?,,,!VV3? 2 3 3 3 3 3 3 3? 3? 3? 3? 2 2 2 2 2 3 VVVVVVVVVVVVVVVVVVVVVVVVVVLKj <?Kj?>?KW KW< ppKWx< `?p?KW8< p`??pKW8<\p??0KW<p??0KW<0?pKW<0<p?KW<0KX<0LX<<0 LW<<|x?LW|<?~p?KW<p~?pKW<p?~?pKW<px?@x?KW<p p?KW<<p KW<<pLW<<?~LW<<??UW|<?eW>?qW|VVVVVVVl!;CCS C CompilerZmainrZ secondGff  CCSC.cnt ̡,# LX1HPXTC Compiler Reference ManualI + &<P i~iC CompilerReference Manual/X+ &P i~i/+ &Pi~iU*T+ &TP i~iCustom Computer Services Inc.July 2001f51DCopyright 1994, 2001 Custom Computer Services, Inc.^2T, &eiCopyright 1994, 2001 Custom Computer Services, Inc.All rights reserved worldwide. No part of this work may be reproduced or copied in any form or by any means- electronic, graphic, or mechanical, including photocopying, recording, taping, or information retrieval systems0 without prior permission.,D) "@~i9}1rP}Overview9 D- *Pi~iOVERVIEWJ}1OSGe PCB, PCM and PCH OverviewGG* $:i PCB, PCM and PCH OverviewC) 5iThe PCB, PCM and PCH are separate compilers. PCB is for 12 bit opcodes, PCM is for 14 bit opcodes and PCH is for the 16 bit PIC 18. Since much is in common between the compilers both are covered in this reference manual. Features and limitations that apply to only specific controllers are indicated within. These compilers are specially designed to meet the special needs of the PIC controllers. These tools allow developers to quickly design application software for these controllers in a highly readable high-level language.G; ) iThe compilers have some limitations when compared to a more traditional C compiler. The hardware limitations make many traditional C compilers ineffective. As an example of the limitations, the compilers will not permit pointers to constant arrays. This is due to the separate code/data segments in the PIC hardware and the inability to treat ROM areas as data. On the other hand, the compilers have knowledge about the hardware limitations and does the work of deciding how to best implement your algorithms. The compilers can implement very efficiently normal C constructs, as well as input/output operations and bit twiddling operations.*e ' i= ; 1;C PCW Overview:e * $ i PCW Overview  * "iPCW is the professional package that includes both the PCM and PCB compilers. PCW has a Windows IDE. PCW has the same syntax as the command line compilers. The PCH compiler is available for PCW as an optional add-on.B ( 1S( g @Technical Support? g * $*i Technical Supportj( ; Di  The latest software can be downloaded via the Internet at: http://www.ccsinfo.com/download.htmlfor 30 days after the initial purchase. For one years worth of updates, you can purchase a Maintenance Plan directly from CCS. Also found on our web page are known bugs, the latest version of the software, and other news about the compiler.We strive to ensure that each upgrade provides greater ease of use along with minimal, if any, problems. However, this is not always possible. To ensure that all problems that you encounter are corrected in a diligent manner, we suggest that you email us at support@ccsinfo.com outlining your specific problem along with an attachment of your file. This will ensure that solutions can be suggested to correct any problem(s) that may arise. We try to respond in a timely manner and take pride in our technical support.g @* "iSecondly, if we are unable to solve your problem by email, feel free to telephone us at (262) 797-0455 x 32. Please have all your supporting documentation on-hand so that your questions can be answer @ ed in an efficient manner. Again, we will make every attempt to solve any problem(s) that you may have. Suggestions for improving our software are always welcome and appreciated.= @1_C@9AgBInstallation:@9A* $ i Installation.@gBE Xi PCB, PCM, and PCH Installation:Insert the disk in drive A and from Windows Start|Run type:A:SETUPPCW Installation:Insert CD ROM, select each of the programs you wish to install and follow the on-screen instructions.S"9AB1B CInvoking the Command Line CompilerP&gB C* $Li Invoking the Command Line Compiler,B6C) "@~ijC CC' iThe command line compiler is invoked with the following command:K6CC, (>ii CCSC options cfilename:C%D( $iValid options::CD#Ҁtn  j  ii8i@i+FBSelect PCB (12 bit)-DDo not create debug fileA%DEs#n  j  i i6i@i+FMSelect PCM (14 bit)+DSStandard .COD format debug file7D>Fs#nn  j  i i4i>i+FHSelect PCH (PIC18)+DM.MAP format debug file@EFs#n  j  i i4i>i+F7Select PC7 (PIC17)+DCExpanded .COD format debug file8>FGs#pn  j  i i.i8i+FSSelect PCS (SX)+YxOptimization level x (0-9)8FGHs#pn  j  i i6i>i+ESStandard error file+TCreate call tree (.TRE);GHs#vn  j  i i:iBi+EOOld error file format+ACreate stats file (.STA)<GHIs#xn  j  i i:iBi-JDo not create PJT file-MDo not create symbol file-HI* $Pi~iyRIJJ' iThe xxx in the following are optional. If included it sets the file extension:-IwJ* $Pi~iAJJ9K#Ҁn  j  ii8iHi+LNxxxNormal list file+O8xxx8 bit Intel HEX output fileGwJKs#n  j  iiBiRi+LSxxxMPASM format list file+OWxxx16 bit Intel HEX output file:9KLs#tn  j  ii<iLi+LOxxxOld MPASM list file+OBxxxBinary output file<KOMs#xn  j  ii:iBi+LYxxxSymbolic list file-ODo not create object file"LMs#Dn  j  i i<i@i-LDo not create list file-OMN* $Pi~i3MNW#~f  i i+PKeep compile status window up after compile;NOI#bv  ii+PxxKeep status window up for xx seconds after compile9NOI#br  i i+PNKeep status window up only if there are no errors6O,I#bl  i i+PEKeep status windO,gBow up only if there are errors-OY* $Pi~i:,W#~t  i i+ZKeep scratch and debug files on disk after compile-Y* $Pi~iI`#̀  iix:̀iI="..."Set include directory search path, for example:I="c:\picc\examples;c:\picc\myincludes"If no I= appears on the command line the .PJT file will be used to supply the include file paths.-* $Pi~i]`Tj#  ii:#xxx="yyy"Set a global #define for id xxx with a value of yyy, example:#debug="true"-* $Pi~iHT W#~  ii+STDOUTOutputs errors to STDOUT (for use with third party editors)7I#bn  ii+SETUPInstall CCSC into MPLAB (no compile is done)z1 I#bb  i i+VShow compiler version (no compile is done)>I#b|  i i+QShow all valid devices in database (no compile is done)R#0 .iIf @filename appears on the CCSC command line command line options will be read from the specified file. Parameters may appear on multiple lines in the file. If the file CCSC.INI exists in the same directory as CCSC.EXE then command line parameters are read from that file before they are processed on the command line.Examples:g8/ .pii CCSC +FM C:\PICSTUFF\TEST.CCCSC +FM +P +T TEST.CB#̇1Ṫ .MPLAB Integration? * $*i MPLAB Integration]'̇h6 :OiThe CCSC.EXE Windows program will work as a bridge from MPLAB to the C compiler. Simply enter the following from Start|Run type:CCSC +SETUPThis will configure MPLAB. When creating a new project select CCS as the LANGUAGE TOOL SUITE. Then select the .HEX file and click on NODE PROPERTIES. Here you need to select the compiler you want to use (PCB, PCM, and PCH). If your first compile is done from the CCS IDE then it will create a MPLAB project file eliminating the need to create a new project and edit the nodes as described above. .0 .-iIf your MPLAB version is older than 3.40, you will need to download the latest version from Microchip's web page at: http://www.Microchip.com< hj1$ jDirectories9.* $i DirectoriessKj( iThe compiler will search the following directories for Include files. W,m+ &XP:HDirectories listed on the command lineW,Č+ &XP:HDirectories specified in the .PJT fileY.m+ &\P:HThe same directory as the source file yMČ, &iBy default, the compiler files are put in C:\Program Files\PICC and the example programs and all Include files are in C:\Program Files\PICC\EXAMPLES.The compiler itself is a DLL file. The DLL files are in a DLL directory by default in C:\Program Files\PICC\DLL. Old compiler versions may be kept by renaming this directory.= ӎ1b ӎ JFile Formats: * $ i File Formatsӎ 5 8iThe compiler can output 8 bit hex, 16 bit hex, and binary files. Two listing formats are available. Standard format resembles the Microchip tools and may be required by some third-party t ools. The simple format is easier to read. The debug file may either be a Microchip .COD file or Advanced Transdata .MAP file. All file formats and extensions are selected via the options|file formats window on the DOS IDE and the compiler|options in the Windows IDE.* J' iJ 1- Direct Device ProgrammingGJ* $:i Direct Device Programming0 .iThe IDE has a program option in the main menu bar. When invoked, the IDE will issue a command to start the user's device programmer. The commands are specified in the Options|Programer Options window. The %H is replaced with the HEX filename and %D is replaced with the device number. Put a ! at the end if the command line if you would like a pause before returning to IDE. Only programs that can be invoked by a command will work with this option.H1Iͅ d|Device Calibration DataEd* $6i Device Calibration DataR+ $iSome devices from Microchip have calibration data programmed into the program area when shipped from the factory. Each part has its own unique data. This poses some special problems during development. When an UV erasable (windowed) part is erased, the calibration data is erased as well. Calibration data can be forced into the chip during programming by using a #ROM directive with the appropriate data.The PCW package includes a utility program to help streamline this process. When a new chip is purchased, the chip should be read into a hex file. Execute the File|Read calibration data utility and select a name (.C) for this part. The utility will create an Include File with specified name that will have the correct #ROM directives for the part. During prototype development add a #Include directive and change the name before each build to the part # that is about to be programmed. For production (OTP parts) simply comment out the #Include.*d|' iAR1~ HUtility Programs>|* $(i Utility Programs9 @KiSIOWSIOW is a simple "dumb terminal" program that may be run on a PC to perform input and output over a serial port. SIO is handy since it will show all incoming characters. If the character is not a normally displayable character, it will show the hex code.DEVEDITDEVEDIT is a Windows utility (PCW only) that will edit the device database. The compiler uses the device database to determine specific device characteristics at compile time. This utility will allow devices to be added, modified or removed. To add a device, highlight the closest equivalent chip and click on ADD. To edit or delete, highlight the device and click on the appropriate button.EB RiPCONVERTPCONVERT is a Windows utility (PCW only) that will perform conversions from various data types to other types. For example, Floating Point decimal to 4 BYTE Hex. The utility opens a small window to perform the conversions. This window can remain active during a PCW or MPLAB session. This can be useful during debugging.CCSC +QThis will list all devices in the compiler database.CCSC +FM +VThis will show the current compiler version. Replace +FM with +FB or +FH for the other compilers.*H' i81pͅPCW IDE8 H- *Pi~iPCW IDE: 1<gFile MenuJ<9 B$i" File MenuE : BPi~iNewCreates a new fileOpenOpens a file into the editor. If there are no other files open then the project name is set to this files <name. Ctrl-O is the shortcut.SaveSaves the file currently selected for editing. Ctrl-S is the shortcut.Save AsPrompts for a filename to save the currently selected file.Save AllAll open files are saved to diskCloseCloses the file currently open for editing. Note that while a file is open in PCW for editing no other program may access the file. Shift F11 is the shortcut.<g3 4OPi~iClose AllCloses all files.PrintPrints the currently selected file.Printer SetupAllows the selection of a printer and the printer settings.ExitTerminates PCW= 1 [R Project Menu:g* $ i Project Menu: B) PՁ1~NewCreates a new project. A project may be created manually or via a wizard. If created manually only a .PJT file is created to hold basic project information. An existing .C main file may be specified or an empty one may be created. The wizard will allow the user to specify project parameters and when complete a .C, .H and .PJT file are created. Standard source code and constants are generated based on the specified project parameters.NEW PROJECT(Speed button or File|New Project)This command will bring up a number of fill-in-the-blank forms about your new project. RS232 I/O and 12C characteristics, timer options, interrupts used, A/D options, drivers needed and pin names all may be specified in the forms. When drivers are selected, required pins will be selected by the tool and pins that can be combined will be. Final pins selections may be edited by the user. After all selections are made the initial .c and .h files are created with #defines, #includes and initialization commands required for your project. This is a fast way to start a new project. Once the files are created you cannot return to the menus to make further changes..+ &@~ioDI+ &PՁ1~OpenA .PJT file is specified and the main source file is loaded./x, (PՁ1~iIt , &PՁ1~Open All FilesA .PJT file is specified and all files used in the project are opened. In order for this function to work the program must have been compiled in order for the include files to become known.Sx 2 4PՁ1~iFind Text In ProjectSearches all files in a project for a given text string.t  , &aPՁ1~Print All FilesAll files in the project are printed. In order for this function to work the program must have been compiled in order for the include files to become known./  , (PՁ1~i  , &OPՁ1~Include DirsAllows the specification of each directory to be used to search for include files for just this project. This information is saved in the .PJT file. {I R 2 4PՁ1~iClose ProjectCloses all files associated with the current project.F  1uT  APCW Editor C Features7 R  * $i Edit Menu/  , (PÁC~i D VPÁC~UndoUndoes the last deletion.CutMoves the selected text from the file to the clipboard.CopyCopies the selected text to the clipboard.PasteCopies the clipboard contents to the cursor location.Copy from FileCopies the contents of a file to the cursor location.Paste to FilePastes the selected text to a file.FindSearches for a specified string in the file.ReplaceReplaces a specified string with a new string.NextPerforms another Find or Replace.G mA6 :#PÁC~Find matching } or )The text will be highlighted up to the corresponding } or ). The editor will start counting the open and close curly braces and highlight the closing itmAR em when they are balanced. Simply place the cursor before or on the element you need to find a match for and click, and the match will be highlighted.Toggle BookmarkSets a bookmark (0-9) at the cursor location.Goto BookmarkMove the cursor to the specified bookmark (0-9).Next WindowSelects the next open file as the current file for editing.TA- *PÁC~Previous WindowSelects the previous open file as the current file for editing.= mA+B1[Ç+BeBJOptions Menu:AeB* $ i Options Menu/+BB, (P~ideB0E8 >P~Real tabsWhen selected the editor inserts a tab character (ASCII 9) when the TAB key is pressed. When it is not selected and the TAB key is pressed spaces are inserted up to the next tab position.Tab sizeDetermines the number of characters between tab positions. Tabs allow you to set the number of space equated by a tab and whether or not the tabs are converted to spaces or left as tabs.Auto indentWhen selected and the ENTER is pressed the cursor moves to the next line under the first character in the previous line. When not selected the ENTER always moves to the beginning of the next line.vBG< FP~WordStar keysWhen selected the editing keys are WordStar style. WordStar commands will enable additional keystrokes recognized by the editors. See EDITOR for more information.Syntax HighlightingWhen checked the editor highlights in color C keywords and comments.ToolbarAllows the selection of what menu items appear as buttons on the toolbar.Editor FontSelects the editor font.Editor ColorsSelects the colors used for syntax highlighting.Recall Open FilesWhen selected PCW will always start with the same files open as were open when it last shut down. When not selected PCW always starts with no files open.0EJ< FP~File FormatsAllows selection of the output file formats,Programmer optionsAllows the specification of the device programmer to be used when the PROGRAM CHIP tool is selected.Include DirsAllows the specification of each directory to be used to search for include files by default for newly created projects. This has no effect on projects already created (use Project|Include Dirs to change those).Global DefinitionsAllows the setting of #defines to be used in compiling. This is the same as having some #defines at the top of your program. This may be used for example to set debugging defines without changing the code.-GJ* $P~@J K1xT KGKkCompile Options=JGK* $&i Compile Options, KsK) "@~i 1GKMM hiPCB/PCM (speed button or compile|PCx) This command will compile your program. Use PCB for the 12-bit chips and PCM for the 14-bit chips.PCW CompileCompiles the current project (name is in lower right) using the current compiler (name is on the toolbar).Debug File OptionsMicrochip CODStandard PIC debug fileRICE16 MAPUsed only be older RICE16 S/W To Extended CODCOD file with advanced debug infoList Format OptionsSimpleA basic format with C code and ASMzOsKN+ &iStandardThe MPASM standard format with machine codeOldOlder MPASM formatb:MN( tObject file extensionThe file extension for a HEX file*NN' ijN?O+ &List file extensionThe file extension for a list fileSymbolicIncludes C symbols within the assembly NkB RiObject File Options8 bit HEX8 Bit Intel HEX file16 bit HEX16 bit Intel HEX file BinaryStraight binary (No fuse info)?OkJError File OptionsStandardCurrent Microchip standard OriginalOlder Microchip standard: ?O1 Ç ܀View Menu7 k܀* $i View Menu> 1 0Pi~iC/ASMOpens the listing file in the read only mode. The file must have been compiled to view the list file. If open this file will be updated after each compile. The listing file shows each C source line and the associated assembly code generated for the line.<܀V+ &"i For Example:? Lii delay_ms(3);0F2:MOVLW 050F3:MOVWF 080F4:DESCZ 08,F0F5:GOTO 0F4.while input(pin_0));0F6:BSF 0B,3"V7/ ,Pi~iSymbol MapOpens the symbol file in the read only mode. The file must have been compiled to view the symbol file. If open this file will be updated after each compile. The symbol map shows each register location and what program variables are saved in each location.MAPDisplays the RAM memory map for the program last compiled. The map indicates the usage of each RAM location. Some locations have multiple definitions since RAM is reused depending on the current procedure being executed.,c) "@~i<7+ &"i For Example:chF Zii 08@SCRATCH09@SCRATCH0ATRIS_A0BTRIS_B0CMAIN.SCALE0DMAIN.TIME0EGET_SCALE.SCALE0EPUTHEX.N0EMAIN.@SCRATCH%/ ,Pi~iCall TreeOpens the tree file in the read only mode. The file must have been compiled to view the tree file. If open this file will be updated after each compile. The call tree shows each function and what functions it calls along with the ROM and RAM usage for each.A (inline) will appear after inline procedures that begin with @. After the procedure name is a number of the form s/n where s is the page number of the procedure and n is the number is locations of code storage is required. If S is ? then this was the last procedure attempted when the compiler ran out of ROM space. RAM=xx indicates the total RAM required for the function.,hQ) "@~i<%+ &"i For Example:YQ9 Bii Main 0/30INIT 0/6WAIT_FOR_HOST 0/23 (Inline)DELAY_US 0/12SEND_DATA 0/65 (3 4Pi~iStatisticsOpens the stats file in the read only mode. The file must have been compiled to view the stats file. If open this file will be updated after each compile. The statistics file shows each function, the ROM and RAM usage by file, segment and name.Data SheetThis tool will bring up Acrobat Reader with the manufacture data sheet for the selected part. If data sheets were not copied to disk then the CCS CD ROM or a manufacture CD ROM must be inserted.8`< FPi~iBinary fileOpens a binary file in the read only mode. The file is shown in HEX and ASCII.COD Debug fileOpens a debug file in the read only mode. The file is shown in an interpreted form.Valid FusesShows a list of all valid keywords for the #fuses directive for this device.Valid InterruptsShows a list of all valid keywords for the #int_xxxx directive and enable/disable _interrupts for this device.Status LineClick on the left hand side of the status line to GOTO a specific line number.-(* $Pi~i; `Ȏ1ȎTools Menu8* $i Tools Menu/Ȏ/, (PU~iR, &PU~Device EditorThis tool allows the essential characteristics for each supported processor to be specified. This tool edits a database used by the compiler to contr/Rol the compilation. CCS maintains this database (Devices.dat) however users may want to add new devices or change the entries for a device for a special application. Be aware if the database is changed and then the software is updated the changes will be lost. Save your DEVICES.DAT file during an update to prevent this./63 4cPU~Device selectorThis tool uses the device database to allow a parametric selection of devices. By selecting key characteristics the tool displays all eligible devices.File CompareCompares two files. When source file is selected then a normal line by line compare is done. When list file is selected the compare may be set to ignore RAM and/or ROM addresses to make the comparison more meaningful. For example if an asm line was added at the beginning of the program a normal compare would flag every line as different. By ignoring ROM addresses then only the extra line is flagged as changed. Two output formats are available. One for display and one for files or printing.R4 6OPU~Numeric ConverterA conversion tool to convert between decimal, hex and float.Serial Port MonitorAn easy to use tool to connect to a serial port. This tool is convenient to communicate with a target program over an RS232 link. Data is shown in as ASCII characters and as raw hex.Disassembler This tool will take as input a HEX file and will output ASM. The ASM may be in a form that can be used as inline ASM.6/ ,PS~This command will take a HEX file and generate an assembly file so that selected sections can be extracted and inserted into your C programs as inline assembly. Options will allow the selection of the assembly format.Gf- *4P:12 or 14 bit opcodesL- *>P:Address, C, MC ASM labels@f- *&P:Hex or BinaryI;- *8P:Simple, ASM, C numbersf-9 @[PU~Extract Cal DataThis tool will take as input a HEX file and will extract the calibration data to a C include file. This may be used to maintain calibration data for a UV erasable part. By including the include file in a program the calibration data will be restored after re-burning the part.Program ChipThis simply invokes device programmer software with the output file as specified in the Compile\Options window. This command will invoke the device programmer software of your choice. Use the compile options to establish the command line.d4;0 .iPU~MPLABInvokes MPLAB with the current project. The project is closed so MPLAB may modify the files if needed. When MPLAB is invoked this way PCW stays minimized until MPLAB terminates and then the project is reloaded.InternetThese options invoke your WWW browser with the requested CCS Internet page:Z. ,P:View recent changesShows version numbers and changes for the last couple of months.h#. ,P:e-mail technical supportStarts your e-mail program with CCS technical support as the To: address.c. ,P:Download updatesGoes to the CCS download page. Be sure to have your reference number ready.#o/ ,P:Data SheetsA list of various manufacture data sheets for devices CCS has device drivers for (such as EEPROMs, A/D converters, RTC...)1. ,P~: o1g Help Menu7 * $i Help Menu->* $Pi~ig16 :cPS~AboutShows the version of the IDE and each installed compiler.ContentsThe help file table of contents.IndexThe help file index.Keywor>d at cursorDoes an index search for the keyword at the cursor location. Just press F1 to use this feature.F12Bring up help indexShift F12Bring up editor help->* $Pi~i@1|[LPCW Editor Keys=[* $&i PCW Editor KeysUB#T&wiCursor Movement}4[-I#bh  iiLeft ArrowMove cursor one character to the left6I#bl  iiRight ArrowMove cursor one character to the rightm$-I#bH  iiUp ArrowMove cursor one line upq(I#bP  iiDown ArrowMove cursor one line down}4I#bh  i$iCtrl Left ArrowMove cursor one word to the left6I#bl  i&iCtrl Right ArrowMove cursor one word to the rightn%I#bJ  iiHomeMove cursor to start of linek"_I#bD  i iEndMove cursor to end of lines*I#bT  iiCtrl PgUpMove cursor to top of windowv-_HI#bZ  iiCtrl PgDnMove cursor to bottom of windown%I#bJ  iiPgUpMove cursor to previous pagej!H I#bB  iiPgDnMove cursor to next pagew.I#b\  iiCtrl HomeMove cursor to beginning of filep' I#bN  iiCtrl EndMove cursor to end of filey0I#b`  iiCtrl SMove cursor one character to the leftz1I#bb  iiCtrl DMove cursor one character to the rightk"e I#bD  iiCtrl EMove cursor one line upp' I#bN  iiCtrl X** Move cursor one line downt+e I I#bV  iiCtrl AMove cursor one word to the leftu,  I#bX  iiCtrl FMove cursor one word to the rightr)I 0 I#bR  iiCtrl Q SMove cursor to top of windowu,  I#bX  iiCtrl Q DMove cursor to bottom of windowt+0  I#bV  iiCtrl RMove cursor to beginning of fileq(  I#bP  iiCtrl C* Move cursor to end of fileN ! I#b  iiShift ~Where ~ is any of the above: Extend selected area as cursor moves* K ' iV!  B#T(wiEditing Commandsw.K I#b\  i iF4Select next text with matching () or {}g I#b<  iiCtrl #Goto bookmark # 0-9l#I#bF  iiShift Ctrl #Set bookmark # 0-9i TI#b@  iiCtrl Q #Goto bookmark # 0-9hI#b>  iiCtrl K #Set bookmark # 0-9]T%@I#b(  ii%@Ctrl WScroll upc@I#b4  iiCtrl Z * Scroll downo&%@@I#bL  i iDelDelete the following charactero&@fAI#bL  iiBkSpDelete the previous characteru,@AI#bX  iiShift BkSpDelete the previous characterm$fAHBI#bH  i iInsToggle Insert/Overwrite modej!ABI#bB  iiCtrl Z** Undo last operationhHBCI#b>  iiShift Ctrl ZRedo last undor)BCI#bR  iiAlt BkSpRestore to original contentsgCCI#b<  iiCtrl EnterInsert new liner)CeDI#bR  iiShift DelCut selected text from filehCDI#b>  iiCtrl InsCopy selected text\eD)EI#b&  iiShift InsPasteeDEI#b8  i iTabInsert tab or spacesj!)EEI#bB  iiCtrl TabInsert tab or spacesx/EpFI#b^  iiCtrl P ~Insert control character ~ in textr)EFI#bR  iiCtrl GDelete the following characterdpFFGI#b6  iiCtrl TDelete next wordq(FGI#bP  iiCtrl HDelete the previous character_FGHI#b,  iiCtrl YDelete linek"GHI#bD  iiCtrl Q YDelete to end of liner)HHI#bR  iiCtrl Q LRestore to original contentsr)HeII#bR  iiCtrl X** Cut selected text from filei HII#b@  iiCtrl C** Copy selected textYeI'JI#b   iiCtrl VPaster)IJI#bR  iiCtrl K RRead file at cursor locationq('J KI#bP  iiCtrl K WWrite selected text to file`JjKI#b.  iiCtrl-F** Find textc KKI#b4  iiCtrl-R** Replace texthjK5LI#b>  i iF3Repeat last find/replace|RKL* $i* Only when WordStar mode selected** Only when WordStar mode is not selected?5LL1 L,MProject Wizard<L,M* $$i Project Wizardg:LN- (uiThe new project wizard makes starting a new project easier.After starting the Wizard you are prompted for the name for your new main c file. This file will be created along with a corresponding .h file.The tabbed notebook that is displayed allows the selection of various project parameters. For example:,MrO; DIHGeneral Tab -> Select the device and clock speedCommunications tab --> Select RS232 portsI/O Pins tab --> Select you own names for the various pinsNU- (UiWhen any tab is selected you may click on the blue square in the lower right and the wizard wilrOULl show you what code is generated as a result of your selections in that screen.After clicking OK all the code is generated and the files are opened in the PCW editorThis command will bring up a number of fill-in-the-blank forms about your new project. RS232 I/O and 12C characteristics, timer options, interrupts used, A/D options, drivers needed and pin names all may be specified in the forms. When drivers are selected, required pins will be selected by the tool and pins that can be combined will be. Final pins selections may be edited by the user. After all selections are made an initial .c and .h files are created with #defines, #includes and initialization commands require for your project. This is a fast way to start a new project. Once the files are created you cannot return to the menus to make further changes.*rO' i> U1xPre-Processor:* $ Pi~i PRE-PROCESSORNE1yUE؋Pre-Processor Command SummaryK!* $Bi Pre-Processor Command Summary E +iՀ.b.bsZv.b{wW듀W듀X{/ A_]yu{VڀStandard C#DEFINE ID STRING #ELSE #ENDIF #ERROR #IF expr #IFDEF id #INCLUDE "FILENAME" #INCLUDE #LIST #NOLIST #PRAGMA cmd #UNDEF id Function Qualifier#INLINE #INT_DEFAULT #INT_GLOBAL $Z bi/djdJ:Հ,b,b,biǒv?\Q8d6nti#INT_xxx #SEPARATE Device Specification#DEVICE CHIP #ID NUMBER #ID "filename" #ID CHECKSUM #FUSES options #TYPE type=type Built-in Libraries#USE DELAY CLOCK (CLOCK=speed) #USE FAST_IO (port) #USE FIXED_IO (port_outputs=pin,pin. . . ) #USE I2C (Master, SDA=Pin, SCL=Pin, options) ,͊ Yi䃮7G>FKK// >FۭS[q㥸#USE RS232 (Baud=baud, XMIT=pin, RCV) #USE STANDARD_IO (port) Memory Control#ASM #BIT id=const.const #BIT id=id.const #BYTE id=const #BYTE id=id #LOCATE id=const #ENDASM #RESERVE #ROM #ZERO_RAM Compiler Control#CASE #OPT n ؋ ؀ i=V+FN첚#PRIORITY #ORG Pre-Defined Identifier_ _ DATE_ _ _ _ DEVICE_ _ _ _PCB _ _ _ _ PCM_ _ _ PCH_ _ I͊!1l.!gPre-Processor DirectivesF؋g* $8i Pre-Processor Directivesu!+ $iPre-processor directives all begin with a # and are followed by a specific command. Syntax is dependent on the command. Many commands do not allow other syntactical elements on the remainder of the line. A table of commands and a description is listed on the previous page.Several of the pre-processor directives are extensions to standard C. C provides a pre-processor directive that compilers will accept and ignore or act upon the following data. This implementation will allow any pre-processor directives to begin with #PRAGMA. To be compatible with other compilers, this may be used before non-standard features.V-g]) "ZiExamples:Both of the following are validE* $6ii#INLINE#PRAGMA INLINE 5]׏1U׏" #ASM?". ,"i ׏" #ASM#ENDASM^׏O lPi~iSyntax:#asmor#asm ASIScode#endasmElements:code is a list of assembly language instructionsPurpose:The lines between the #ASM and #ENDASM are treated as assembly code to be inserted. These may be used anywhere an expression is allowed. The syntax is described on the following page. The predefined variable _RETURN_ may be used to assign a return value to a function from the assembly code. Be aware that any C code after the #ENDASM and before the end of the function may corrupt the value.|N". *Pi~iIf the second form is used with ASIS then the compiler will not do any automatic bank switching for variables that cannot be accessed from the current bank. The assembly code is used as-is. Without this option the assembly is augmented so variables are always accessed correctly by adding bank switching where needed.Examples:9 @eiiint find_parity (int data) {int count;#asmmovlw 0x8movwf countmovlw 0loop:xorwf data,wrrf data,fdecfsz count,fgoto loopmovwf _return_#endasm}\-C/ .ZPi~iExample Files:ex_glint.cAlso See:NoneWB#T*|i12 Bit and 14 Bit`CI#b. iiADDWF f,dANDWF f,dXRI#b iiCLRF fCLRW^I#b* iiCOMF f,dDECF f,d`RI#b. iiDECFSZ f,dINCF f,daqI#b0 iiINCFSZ f,dIORWF f,d\I#b& iiMOVF f,dMOVPHW[q(I#b$ iiMOVPLWMOVWF fXI#b i iNOPRLF f,d^(I#b* iiRRF f,dSUBWF f,d`>I#b. iiSWAPF f,dXORWF f,d\I#b& iiBCF f,bBSF f,b`>I#b. iiBTFSC f,bBTFSS f,b[UI#b$ iiANDLW kCALL kZI#b" iiCLRWDTGOTO k\U I#b& iiIORLW kMOVLW kZeI#b" iiRETLW kSLEEPY I#b  iiXORLWOPTIONT eI#b iiTRIS kU gI#b ii14 Bit:U I#b iiADDLW kU gI#b iiSUBLW kT eI#b iiRETFIET I#b iiRETURN*e' i / ,Plfmay be a constant (file number) or a simple variabledmay be a constant (0 or 1) or W or Ff,bmay be a file (as above) and a constant (0-7) or it may be just a bit variable reference.kmay be a constant expressionjAY) "iNote that all expressions and comments are in C like syntax.L B#TiPIC 18)Y;a#R   ii8i;ADDWFf,d,aADDWFCf,d,aANDWFf,d,a#a#F   ii.iCLRFf,aCOMFf,d,aCPFSEQf,a%;Ea#J   ii2iCPFSGTf,aCPFSLTf,aDECFf,d,a)a#R   ii:iDECFSZf,d,aDCFSNZf,d,aINCFf,d,a(EXa#P   ii8iINFSNZf,d,aIORWFf,d,aMOVFf,d,a'a#N   i"i8iMOVFFfs, fd MOVWFf,aMULWFf,a$Xea#H   ii.iNEGFf,aRLCFf,d,aRLNCFf,d,a$a#H   ii4iRRCFf,d,aRRNCFf,d,aSETFf,a*eua#T   ii8iSUBFWBf,d,aSUBWFf,d,aSUBWFBf,d,a'a#N   ii4iSWAPFf,d,aTSTFSZf,aXORWFf,d,a$ua#H   ii.iBCFf,b,aBSFf,b,aBTFSCf,b,aa#>   ii2iBTFSSf,b,aBTGf,d,aBCnvxa#*   iiiBNnBNCnBNNnxa#.   ii iBNOVnBNZnBOVnyxia#0   iiiBRAnBZnCALLn,s{a#4   ii$iCLRWDT-DAW-GOTOnwi[a#,   iiiNOP-NOP-POP-|a#6   ii$iPUSH-RCALLnRESET-[V a#<   ii(iRETFIEsRETLWkRETURNs} a#8   ii&iSLEEP-ADDLWkANDLWk~V Q a#:   ii(iIORLWkLFSRf,kMOVLBk}  a#8   ii&iMOVLWkMULLWkRETLWk}Q K a#8   ii&iSUBLWkXORLWkTBLRD*z  ^#8  ii&iTBLRD*+TBLRD*-TBLRD+*yK > ^#6  ii$iTBLWT*TBLWT*+TBLWT*-l  ^#  iiiTBLWT+**>  ' i5  1.N ; @#BIT2 ; * $i #BIT Bi =Pi~iSyntax:#bit id = x.yElements:id is a valid C identifier,x is a constant or a C variable,y is a constant 0-7.Purpose:A new C variable (one bit) is created and is placed in memory at byte y and bit x. This is useful to gain access in C directly to a bit in the processors special function register map. It may also be used to easily access a bit of a standard C variable.Examples:;  @5 8ii#bit T0IF = 0xb.2 ...T0IF = 0; // Clear Timer 0 interrupt flagint result;#bit result_odd = result.0 ...if (result_odd) ...B @ NB@S vPi~i/ۭS Example Files:ex_glint.cAlso See:#byte, #reserve, #locate 6 @@1@AE#BYTE3 @A* $i #BYTE@BW | Pi~iSyntax:#byte id = xElements:id is a valid C identifier,x is a C variable or a constantPurpose:If the id is already known as a C variable then this will locate the variable at address x. In this case the variable type does not change from the original definition. If the id is not know a new C variable is created and placed at address x with the type int (8 bit).AC/ ,Pi~iWarning: In both cases memory at x is not exclusive to this variable. Other variables may be located at the same location. In fact when x is a variable then id and x share the same memory location.<B*D. ,Pi~iExamples:CE4 6Qii#byte status = 3#byte b_port = 6struct { short int r_w; short int c_d; int unused : 2; int data : 4; } a_port;#byte a_port = 5...a_port.c_d = 1;M*DES vPi~iK ۭSExample Files:ex_glint.cAlso See:#bit, #locate, #reserve 6EE1NVEFH#CASE3 EF* $i #CASEEF8 >Pi~iSyntax:#caseElements:NonePurpose:Will cause the compiler to be case sensitive. By default the compiler is case insensitive.uFuG/ .Pi~iWarning: Not all the CCS example programs, headers and drivers have been tested with case sensitivity turned on.>FG/ .Pi~iExamples:guGKH1 2ii#caseint STATUS;void func() {int status;...STATUS = status; // Copy local status to global}[,GH/ .XPi~iExample Files:ex_cust.cAlso See:None< KHH1u HIJ_ _ DATE_ _9HI* $i _ _ DATE_ _HJ8 >_Pi~iSyntax:_ _ date_ _Elements:NonePurpose:This pre-processor identifier is replaced at compile time with the date of the compile in the form: "31-JUL-01"Examples:d:IfJ* $tiiprintf("Software was compiled on ");printf(__DATE__);V'JJ/ .NPi~iExample Files:NoneAlso See:None8fJJ1~V!J)K_#DEFINE5 J)K* $i #DEFINE,JMh YPi~iSyntax:#define id textor#define id(x,y...) textElements:id is a preprocessor identifier, text is any text, x,y and so on are local preprocessor identifiers, in this form there may be one or more identifiers separated by commas.Purpose:Used to provide a simple string replacement of the ID with the given text from this point of the program and on.In the second form (a C macro) the local identifiers are matched up with similar identifiers in the text and they are replaced with text passed to the macro where it is used.N)K O2 29Pi~iIf the text contains a string of the form #idx then the result upon evaluation will be the parameter id concatenated with the string x.If the text contains a string of the form idx##idy then parameter idx is concatenated with parameter idy forming a new identifier.Examples:oMO. ,ii#define BITS 8a=a+BITS; //same as a=a+8;#define hi(x) (x<<4)a=hi(a); //same as a=(a<<4); X O_S vPi~i_]y{w{wExamO_Jple Files:ex_stwt.c, ex_macro.cAlso See:#undef, #ifdef, #ifndef 8O1u,"̀q#DEVICE5 _̀* $i #DEVICEI `7Pi~iSyntax:#device chip optionsElements:chip is the name of a specific processor (like: PIC16C74), To get a current list of supported devices:F̀( <iiSTART | RUN | CCSC +QY2 4Pi~iOptions are qualifiers to the standard operation of the device. Valid options are:^.߂0 0\P:*=5- Use 5 bit pointers (for all parts)d4C0 0hP:*=8- Use 8 bit pointers (14 and 16 bit parts)c3߂0 0fP:*=16- Use 16 bit pointers (for 14 bit parts)tDC0 0P:ADC=x- Where x is the number of bits read_adc() should returnR0 0P:ICD=TRUE- Generates code compatible with Microchips ICD debugging hardware.-Ʉ* $Pi~i/ ,Pi~iBoth chip and options are optional, so multiple #device lines may be used to fully define the device. Be warned however a #device with a chip will clear all previous #device and #fuse settings.pɄ`1 2Pi~iPurpose:Defines the target processor. Every program must have exactly one #device with a chip.Examples:_, (ii#device PIC16C74#device PIC16C67 *=16#device *=16 ICD=TRUE#device PIC16F877 *=16 ADC=10K`q; FPi~i1IExample Files:ex_mxram.c, ex_icd.c, 16c74.hAlso See:read_adc() = 1n#%_ _DEVICE_ _:q* $ i _ _DEVICE_ _n6V8 >mPi~iSyntax:_ _ device _ _Elements:NonePurpose:This pre-processor identifier is defined by the compiler with the base number of the current device (from a #device). The base number is usually the number after the C in the part number. For example the PIC16C622 has a base number of 622.Examples:e:+ &tii#if __device__==71setup_port_a( ALL_DIGITAL );#endifj/V%; F^Pi~i:ՀExample Files:NoneAlso See:#device 7\1,$\J#ERROR4 %* $i #ERROR\fM hPi~iSyntax:#error textElements:text is optional and may be any textPurpose:Forces the compiler to generate an error at the location this directive appears in the file. The text may include macros that will be expanded for the display. This may be used to see the macro expansion. The command may also be used to alert the user to an invalid compile time situation.Examples:^, (ii#if BUFFER_SIZE>16#error Buffer size is too large#endif#error Macro test: min(x,y)Z+fJ/ .VPi~iExample Files:ex_psp.cAlso See:None71^%{#FUSES4 J* $i #FUSESpjE XPi~iSyntax:#fuse optionsElements:options vary depending on the device. A list of all valid options has been put at the top of each devices .h file in a comment for reference. The PCW device edit utility can modify a particular devices fuses. The PCW pull down menu VIEW | Valid fuses will show all fuses with their descriptions.Some common options are:A- *(P:LP, XT, HS, RC=j - * P:WDT, NOWDT JEQ- *0P:PROTECT, NOPROTECTP# - *FP:PUT, NOPUT (Power Up Timer)GQ- *4P:BROWNOUT, NOBROWNOUT2 2Pi~iPurpose:This directive defines what fuses should be set in the part when it is programmed. This directive does not affect the compilation; however, the information is put in the output files. If the fuses need to be in Parallax format, add a PAR option. SWAP has the special function of swapping (from the Microchip standard) the high and low BYTES of non-program data in the Hex file. This is required for some device programmers. Examples:=!) "(ii#fuses HS,NOWDTZ+{/ .VPi~iExample Files:ex_sqw.cAlso See:None; !1&#ID number1{* $i #ID+ CPi~iSyntax:#ID number 16#ID number, number, number, number#ID "filename"#ID CHECKSUMElements:Number16 is a 16 bit number, number is a 4 bit number, filename is any valid PC filename and checksum is a keyword.Purpose:This directive defines the ID word to be programmed into the part. This directive does not affect the compilation but the information is put in the output file.2 2CPi~iThe first syntax will take a 16-bit number and put one nibble in each of the four ID words in the traditional manner. The second syntax specifies the exact value to be used in each of the four ID words.When a filename is specified the ID is read from the file. The format must be simple text with a CR/LF at the end. The keyword CHECKSUM indicates the device checksum should be saved as the ID.Examples:Z/?+ &^ii#id 0x1234#id "serial.num"#id CHECKSUM[,/ .XPi~iExample Files:ex_cust.cAlso See:None9?1^'$#IF exprQ!$0 0Bi  #IF expr#ELSE#ELIF #ENDIFZ~; F>Pi~iSyntax:#if exprcodea2$/ .dPi~i#elif expr//Optional, any number may be used~\ iPi~icode#else//Optionalcode#endifElements:expr is an expression with constants, standard operators and/or preprocessor identifiers. Code is any standard c source code.Purpose:The pre-processor evaluates the constant expression and if it is non-zero will process the lines up to the optional #ELSE or the #ENDIF.Note: you may NOT use C variables in the #IF only preprocessor identifiers created via #define.x. ,Pi~iThe preprocessor expression DEFINED(id) may be used to return 1 if the id is defined and 0 if it is not.Examples:i<- *xii#if MAX_VALUE > 255long value;#else int value;#endifAG ^Pi~i{w{wExample Files:ex_extee.cAlso See:#ifdef, #ifndef 71(e#IFDEFX'1 2Ni  #IFDEF#IFNDEF #ELSE#ELIF#ENDIF\!q; FBPi~iSyntax:#ifdef idcode< 1 2Pi~i#elif=q?U zzPi~icode#elsecode#endif#ifndef idcode8 w. ,Pi~i#elif?d` Pi~icode#elsecode#endifElemwdents:id is a preprocessor identifier, code is nay valid C source code.Purpose:This directive acts much like the #IF except that the preprocessor simply checks to see if the specified ID is known to the preprocessor (created with a #DEFINE). #IFDEF checks to see if defined and #IFNDEF checks to see if it is not defined. Examples:iw. ,ii#define debug // Comment line out for no debug...#ifdef DEBUGprintf("debug point a");#endifj/de; F^Pi~i.bExample Files:ex_sqw.cAlso See:#if 91D)L#INCLUDE6 e* $i #INCLUDE{(OS tQPi~iSyntax:#include <filename> or#include "filename"Elements:filename is a valid PC filename. It may include normal drive and path information.Purpose:Text from the specified file is used at this point of the compilation. If a full path is not specified the compiler will use the list of directories specified for the project to search for the file. If the filename is in "" then the directory with the main source file is searched first. If the filename is in <> then the directory with the main source file s searched last.8 + &Pi~iExamples:k@O+ &ii#include <16C54.H>#include Z+L/ .VPi~iExample Files:ex_sqw.cAlso See:None81W*c #INLINE5 L* $i #INLINE8 >)Pi~iSyntax:#inlineElements:NonePurpose:Tells the compiler that the function immediately following the directive is to be implemented INLINE. This will cause a duplicate copy of the code to be placed everywhere the function is called. This is useful to save stack space and to increase speed. Without this directive the compiler will decide when it is best to make procedures INLINE.Examples:m>/ .|ii#inlineswapbyte(int &a, int &b) {int t;t=a;a=b;b=t;}q6c ; FlPi~idJExample Files:ex_cust.cAlso See:#separate :  1 D+  B#INT_xxxx7 c  * $i #INT_xxxx-  * $Pi~i  S t}Pi~i=Syntax:#INT_ADAnalog to digital conversion complete#INT_ADOFAnalog to digital conversion timeout#INT_BUSCOLBus collision#INT_BUTTONPushbutton#INT_CCP1Capture or Compare on unit 1#INT_CCP2Capture or Compare on unit 2#INT_COMPComparator detect#INT_EEPROMwrite complete#INT_EXTExternal interrupt#INT_EXT1External interrupt #1#INT_EXT2External interrupt #2#INT_I2CI2C interrupt (only on 14000)#INT_LCDactivity P nAPi~i=#INT_LOWVOLTLow voltage detected#INT_PSPParallel Slave Port data in#INT_RBPort B any change on B4-B7#INT_RCPort C any change on C4-C7#INT_RDARS232 receive data available#INT_RTCCTimer 0 (RTCC) overflow#INT_SSPSPI or I2C activity#INT_TBERS232 transmit buffer empty#INT_TIMER0Timer 0 (RTCC) overflow#INT_TIMER1Timer 1 overflow#INT_TIMER2Timer 2 overflow#INT_TIMER3Timer 3 overflow  A6 :Pi~iElements:NonePurpose:These directives specify the following function is an interrupt function. Interrupt functions may not have any parameters. Not all directives may be used with all parts. See the devices .h file for all valid interrupts for the part or in PCW use the pull down VIEW | Valid IntsThe compiler will generate code to jump to the function when the interrupt is detected. It will generate code to save and restore the machine st Ac ate, and will clear the interrupt flag. To prevent the flag from being cleared add NOCLEAR after the #INT_xxxx. The application program must call ENABLE_INTERRUPTS(INT_xxxx) to initially activate the interrupt along with the ENABLE_INTERRUPTS(GLOBAL) to enable interrupts.8 XA+ &Pi~iExamples:Y AA1 2ii#int_adadc_handler() {adc_active=FALSE;}#int_rtcc noclearisr() { ...} XAB` UPi~iπ ގVڀExample Files:See ex_sisr.c and ex_stwt.c for full example programs.Also See:enable_interrupts(), disable_interrupts(), #int_default, #int_global = A)C1{W,)CcCE#INT_DEFAULT:BcC* $ i #INT_DEFAULTL)CD8 >)Pi~iSyntax:#int_defaultElements:NonePurpose:The following function will be called if the PIC triggers an interrupt and none of the interrupt flags are set. If an interrupt is flagged, but is not the one triggered, the #INT_DEFAULT function will get called.Examples:uHcC$E- *ii#int_defaultdefault_isr() {printf("Unexplained interrupt\r\n");}BDEG ^Pi~i/djڀExample Files:NoneAlso See:#INT_xxxx, #INT_global < $EE1-E"FH#INT_GLOBAL9E"F* $i #INT_GLOBALREG8 >Pi~iSyntax:#int_globalElements:NonePurpose:This directive causes the following function to replace the compiler interrupt dispatcher. The function is normally not required and should be used with great caution. When used, the compiler does not generate start-up code or clean-up code, and does not save the registers.Examples:a"FAH4 8ii#int_globalisr() {// Will be located at location 4#asmbsf isr_flagretfie#endasm}r7GH; FnPi~i/djExample Files:ex_glint.cAlso See:#int_xxxx 6AHH1х.HIJ#LIST3 HI* $i #LISTHI8 >)Pi~iSyntax:#listElements:NonePurpose:#List begins inserting or resumes inserting source lines into the .LST file after a #NOLIST.Examples:vKI^J+ &ii#NOLIST // Don't clutter up the list file#include #LISTm2IJ; FdPi~iX{/Example Files:16c74.hAlso See:#nolist 8^JK1/K8KM#LOCATE5 J8K* $i #LOCATEKULU xPi~iSyntax:#locate id=xElements:id is a C variable,x is a constant memory addressPurpose:#LOCATE works like #BYTE however in addition it prevents C from using the area. Examples:8KM. *9ii// This will locate the float variable at 50-53 // and C will not use this memory for other// variables automatically located.float x;#locate x=0x50KULMS vPi~i/KۭSExample Files:ex_glint.cAlso See:#byte, #bit, #reserve 8MM1х0M*NO#NOLIST5 M*N* $i #NOLISTyMN7 >Pi~iSyntax:#NOLISTElements:NonePurpose:Stops inserting source lines into the .LST file (until a #LIST)Examples:vK*NPO+ &ii#NOLIST // Don't clutter up the list file#include #LISTk0NO; F`Pi~iExample Files:16c74.hAlso See:#LIST 5PO 1iU 1 >W#OPTO O2O>* $i #OPTR  E XPi~iSyntax:#OPT nElements:n is the optimization level 0-9Purpose:The optimization level is set with this directive. The directive applies to the entire program and may appear anywhere in the file. Optimization level 5 will set the level to be the same as the PCB,PCM,PCH stand-alone compilers. The PCW default is 9 for full optimization. This may be used to set a PCW compile to look exactly like a PCM compile for example. It may also be used if an optimization error is suspected to reduce optimization.>>΂/ .Pi~iExamples:3 ) "ii#opt 5V'΂W/ .NPi~iExample Files:NoneAlso See:None51 2N#ORG2W* $i #ORGP Pi~iSyntax:#org start, endor#org segmentor#org start, end {}or#org start, end auto=0Elements:start is the first ROM location (word address) to use, end is the last ROM location, segment is the start ROM location from a previous #orgPurpose:This directive will fix the following function or constant declaration into a specific ROM area. End may be omitted if a segment was previously defined if you only want to add another function to the segment. 6D VEPi~iFollow the ORG with a {} to only reserve the area with nothing inserted by the compiler.The RAM for a ORG'ed function may be reset to low memory so the local variables and scratch variables are placed in low memory. This should only be used if the ORG'ed function will not return to the caller. The RAM used will overlap the RAM of the main program. Add a AUTO=0 at the end of the #ORG line.Examples:kPB Rii#ORG 0x1E00, 0x1FFFMyFunc() {//This function located at 1E00}#ORG 0x1E00Anotherfunc(){// This will be somewhere 1E00-1F00}#ORG 0x800, 0x820 {}//Nothing will be at 800-820#ORG 0x1C00, 0x1C0FCHAR CONST ID[10}= {"123456789"};//This ID will be at 1C00//Note some extra code will//proceed the 123456789#ORG 0x1F00, 0x1FF0Void loader (){...}k06N; F`Pi~i[Example Files:loader.cAlso See:#ROM : 1U  3_ _PCB_ _7 N* $i _ _PCB_ _8 >Pi~iSyntax:_ _ pcb _ _Elements:NonePurpose:The PCB compiler defines this pre-processor identifier. It may be used to determine if the PCB compiler is doing the compilation.Examples:U* + &Tii#ifdef __pcb__#device PIC16c54#endif@G ^Pi~i첚Example Files:ex_sqw.cAlso See:__PCM__, __PCH__ : ̌1 4̌֎_ _PCM_ _7 * $i _ _PCM_ _̌8 >Pi~iSyntax:_ _ pcm _ _Elements:NonePurpose:The PCM compiler defines this pre-processor identifier. It may be used to determine if the PCM compiler is doing the compilation.Examples:U*O+ &Tii#ifdef __pcm__#device PIC16c71#endif@֎G ^Pi~iExample Files:ex_sqw.cAlso See:__PCB__, __PCH__ < O1  o 5K0_ _ PCH _ _9֎K* $i _ _ PCH _ _O8 >Pi~iSyntax:_ _ pch _ _Elements:NonePurpose:The PCH compiler defines this pre-processor identifier. It may be used to dKO֎etermine if the PCH compiler is doing the compilation.Examples:Z/K+ &^ii#ifdef _ _ PCH _ _#device PIC18C452#endif@O0G ^Pi~i첚Example Files:ex_sqw.cAlso See:__pcb__, __pcm__ 8h1U 6h#PRAGMA5 0* $i #PRAGMA7h!M hoPi~iSyntax:#pragma cmdElements:cmd is any valid preprocessor directive.Purpose:This directive is used to maintain compatibility between C compilers. This compiler will accept this directive before any other pre-processor command. In no case does this compiler require this directive.Examples:Ef) "8ii#pragma device PIC16C54[,!/ .XPi~iExample Files:ex_cust.cAlso See:None: f1o ރ 72#PRIORITY7 2* $i #PRIORITYM h%Pi~iSyntax:#priority intsElements:ints is a list of one or more interrupts separated by commas.Purpose:The priority directive may be used to set the interrupt priority. The highest priority items are first in the list. If an interrupt is active it is never interrupted. If two interrupts occur at around the same time then the higher one in this list will be serviced first.Examples:>2O) "*ii#priority rtcc,rbl1; FbPi~i/djExample Files:NoneAlso See:#int_xxxx 9O1 8*#RESERVE6 ** $i #RESERVE~/ ܀Pi~iSyntax:#reserve addressor#reserve address, address, addressor#reserve start:endElements:address is a ROM address, start is the first address and end is the last addressPurpose:This directive allows RAM locations to be reserved from use by the compiler. #RESERVE must appear after the #DEVICE otherwise it will have no effect.Examples:R(** $Pii#DEVICE PIC16C74#RESERVE 0x60:0X6fl1/; FbPi~i+Example Files:ex_cust.cAlso See:#org 5"1ރ 9"T#ROM2T* $i #ROM"A\ #Pi~iSyntax:#rom address = {list};Elements:address is a ROM word address, list is a list of words separated by commasPurpose:Allows the insertion of data into the .HEX file. In particular, this may be used to program the '84 data EEPROM, as shown in the following example.Note that this directive does not prevent the ROM area from being used. See #ORG to reserve ROM.Examples:K"T) "Dii#rom 0x2100={1,2,3,4,5,6,7,8}g,A; FXPi~i+Example Files:NoneAlso See:#ORG : -1 :-dE#SEPARATE7 d* $i #SEPARATE-V8 >uPi~iSyntax:#separateElements:NonePurpose:Tells the compiler that the procedure IMMEDIATELY following the directive is to be implemented SEPARATELY. This is useful to prevent the compiler from automatically making a procedure INLINE. This will save ROM space but it does use more stack space. The compiler will make all procedures marked SEPARATE, separate, as requested, even if there is not enough stack space to execute.Examples:tEd/ .ii#separateswapbyte (int *a, int *b) {int t;t=*a;*a=*b;*b=t;}o4VE; FhPi~iu{EExample Files:ex_cust.cAlso See:#inline 6{1Z [ ;{#TYPE3 E* $i #TYPE{P n}Pi~iSyntax:#type standard-type=sizeElements:Purpose:By default the compiler treats SHORT as one bit, INT as 8 bits and LONG as 16 bits. The traditional C convention is to have INT defined as the most efficient size for the target processor. This is why it is 8 bits on the PIC. In order to help with code compatibility a #TYPE directive may be used to will allow these types to be changed. #TYPE can redefine these keywords. tE0/ ,Pi~iNote that the commas are optional. Since #TYPE may render some sizes inaccessible (like a one bit int in the above) four keywords representing the four ints may always be used: INT1, INT8, INT16 and INT32. Be warned CCS example programs and include files may not work right if you use #TYPE in your program.Examples:L#|) "Fii#TYPE SHORT=8, INT=16, LONG=32[,0/ .XPi~iExample Files:ex_cust.cAlso See:None7|1   <B#UNDEF4 B* $i #UNDEFJM hwPi~iSyntax:#undef idElements:id is a pre-processor id defined via #definePurpose:The specified pre-processor ID will no longer have meaning to the pre-processor.Examples:i=B, (zii#if MAXSIZE<100#undef MAXSIZE#define MAXSIZE 100#endifj/J; F^Pi~iՀExample Files:NoneAlso See:#define ; X1:[  =X #USE DELAY8* $i #USE DELAY X g MPi~iSyntax:#use delay (clock=speed)or#use delay(clock=speed, restart_wdt)Elements:speed is a constant 1-100000000 (1 hz to 100 mhz)Purpose:Tells the compiler the speed of the processor and enables the use of the built-in functions: delay_ms() and delay_us(). Speed is in cycles per second. An optional restart_WDT may be used to cause the compiler to restart the WDT while delaying.Examples:oE * $ii#use delay (clock=20000000)#use delay (clock=32000, RESTART_WDT)F  G ^Pi~izXzExample Files:ex_sqw.cAlso See:delay_ms(), delay_us() =  1/  >  #USE FAST_IO:  * $ i #USE FAST_IO   J bPi~iSyntax:#use fast_io (port)Elements:port is A-GPurpose:Affects how the compiler will generate code for input and output instructions that follow. This directive takes effect until another #use xxxx_IO directive is encountered. The fast method of doing I/O will cause the compiler to perform I/O without programming of the direction register. The user must ensure the direction register is set correctly via set_tris_X().Examples:< Y ) "&ii#use fast_io(A)b S vPi~in7G61Example Files:ex_cust.cAlso See:#use fixed_io, #use standard_io, set_tris_X() > Y L1I ?LB#USE FIXED_IO;* $"i #USE FIXED_IOLkAT v Pi~iSyntax:#use fixed_io (port_outputs=pin, pin?)Elements:port is A-G, pin is one of the pin constants defined in the devices .h file.Purpose:This directive affects how the compiler will generate code for input and output instructions that follow. This directive takes effect ukAntil another #use xxx_IO directive is encountered. The fixed method of doing I/O will cause the compiler to generate code to make an I/O pin either input or output every time it is used. The pins are programmed according to the information in this directive (not the operations actually performed). This saves a byte of RAM used in standard I/O.<A. ,Pi~iExamples:T+kAA) "Vii#use fixed_io(a_outputs=PIN_A2, PIN_A3)JABG ^Pi~i8d67GExample Files:NoneAlso See:#use fast_io, #use standard_io : AB1 @BBI#USE I2C6 BB* $i #USE I2CZBC> LPi~iSyntax:#use i2c (options)Elements:Options are separated by commas and may be:R"BC0 0DP:MASTER- Set the master modeP C6D0 0@P:SLAVE- Set the slave modem=CD0 0zP:SCL=pin- Specifies the SCL pin (pin is a bit address)V&6DD0 0LP:SDA=pin- Specifies the SDA pin d4D]E0 0hP:ADDRESS=nn- Specifies the slave mode address[+DE0 0VP:FAST- Use the fast I2C specification[+]EF0 0VP:SLOW- Use the slow I2C specificationm=EF0 0zP:RESTART_WDT- Restart the WDT while waiting in I2C_READ[+FF0 0VP:FORCE_HW-Use hardware I2C functions.`FmH2 2Pi~iPurpose:The I2C library contains functions to implement an I2C bus. The #USE I2C remains in effect for the I2C_START, I2C_STOP, I2C_READ, I2C_WRITE and I2C_POLL functions until another USE I2C is encountered. Software functions are generated unless the FORCE_HW is specified. The SLAVE mode should only be used with the built-in SSP.Examples:nF I/ .ii#use I2C(master, sda=PIN_B0, scl=PIN_B1)#use I2C(slave,sda=PIN_C4,scl=PIN_C3 address=0xa0,FORCE_HW)UmHIG ^Pi~i5(̀8KExample Files:ex_extee.c with 2464.cAlso See:i2c_read(), i2c_write() < II10  AIJ#USE RS2329IJ* $i #USE RS232\IJ> LPi~iSyntax:#use rs232 (options)Elements:Options are separated by commas and may be:Q!JK0 0BP:BAUD=x- Set baud rate to xQ!JWK0 0BP:XMIT=pin- Set transmit pinOKK0 0>P:RCV=pin- Set receive pinTWK*L0 0P:RESTART_WDT- Will cause GETC() to clear the WDT as it waits for a character.KL1 07P:INVERT- Invert the polarity of the serial pins (normally not needed when level converter, such as the AX232). May not be used with the internal SCI.Y)*LOM0 0RP:PARITY=X- Where x is N, E, or O.sCLM0 0P:BITS =X- Where x is 5-9 (5-7 may not be used with the SCI).YOMKN0 0P:FLOAT_HIGH- The line is not driven high. This is used for open collector outputs.MN1 0P:ERRORS- Used to cause the compiler to keep receive errors in the variable RS232_ERRORS and to reset errors when they occur.{KKNyO0 0P:BRGH1OK- Allow bad baud rates on chips that have baud rate problems.lN!0 0P:ENABLE=pin- The specified pin will be high during transmit. This may be used to eyO!Inable 485 transmit.OyOp3 49Pi~iPurpose:This directive tells the compiler the baud rate and pins used for serial I/O. This directive takes effect until another RS232 directive is encountered. The #USE DELAY directive must appear before this directive can be used. This directive enables use of built-in functions such as GETC, PUTC, and PRINTF. When using parts with built-in SCI and the SCI pins are specified, the SCI will be used. If a baud rate cannot be achieved within 3% of the desired value using the current clock rate, an error will be generated.pA!/ .Pi~iThe definition of the RS232_ERRORS is as follows:No UART:f9pF- *rP:Bit 7 is 9th bit for 9 bit data mode (get and put).nA- *P:Bit 6 set to one indicates a put failed in float high mode.AF/ .$Pi~iWith a UART:D9- *.P:Used only by get:Q$- *HP:Copy of RCSTA register except:\/9- *^P:Bit 0 is used to indicate a parity error.<". ,Pi~iExamples:Z1|) "bii#use rs232(baud=9600, xmit=PIN_A2,rcv=PIN_A3)L"S vPi~i' VrExample Files:ex_sqw.cAlso See:getc(), putc(), printf() A|\1  B\#USE STANDARD_IO>* $(i #USE STANDARD_IO.\ȈB RPi~iSyntax:#USE STANDARD_IO (port)Elements:port may be A-GPurpose:This directive affects how the compiler will generate code for input and output instructions that follow. This directive takes effect until another #use xxx_io directive is encountered. The standard method of doing I/O will cause the compiler to generate code to make an I/O pin either input or output every time it is used. On the 5X processors this requires one byte of RAM for every port set to standard I/O.vE>1 2Pi~iStandard_io is the default I/O method for all ports.Examples:@Ȉ~) ".ii#use standard_io(A)L>G ^Pi~i8d6nExample Files:ex_cust.cAlso See:#use fast_io, #use fixed_io : ~K1  CK#ZERO_RAM7 * $i #ZERO_RAMKr8 >qPi~iSyntax:#zero_ramElements:NonePurpose:This directive zero's out all of the internal registers that may be used to hold variables before program execution begins. Examples:J, (<ii#zero_ramvoid main() {}[,r/ .XPi~iExample Files:ex_cust.cAlso See:NoneAX1~  DXData Definitions=* $&Pi~iDATA DEFINITIONS; XЌ1  EЌData Types8* $i Data TypesЌ+ $iThe following tables show the syntax for data definitions. If the keyword TYPEDEF is used before the definition then the identifier does not allocate space but rather may be used as a type specifier in other data definitions. If the keyword CONST is used before the identifier, the identifier is treated as a constant. Constants must have an initializer and may not be changed at run-time. Pointers to constants are not permitted.SHORT is a special type used to generate very efficient code for bit operations and I/O. Arrays of SHORT and pointers to SHORT are not permitted. Note: [ ] in the following tables indicates an optional item.* ' i WcB#T* iData Declarationsh2 6#O#n|w 5 $iiexternIs allowed as a qualifier however, has no effect.@hL#hw 5 $iiregister Is allowed as a qualifier however, has no effect.<) "&iType-specifier&Nk#Lw 5 $iiint1Defines a 1 bit number q"O#nDw 5 $iiint8Defines an 8 bit numberr#N1O#nFw 5 $iiint16Defines a 16 bit numberr#O#nFw 5 $iiint32Defines a 32 bit numbers$1O#nHw 5 $iicharDefines a 8 bit character2O#ndw 5 $iifloatDefines a 32 bit floating point numberv' O#nNw 5 $iishortBy default the same as int1t%O#nJw 5 $iiintBy default the same as int8v' O#nNw 5 $iilongBy default the same as int16p$gL#hHw 5 $iivoidIndicates no specific typeAO#nw 5 $iidoubleIs a reserved word but is not a supported data type.gD Vi?All types, except float, by default are unsigned; however, maybe preceded by unsigned or signed. Short and long may have the keyword INT following them with no effect. Also see #TYPE.declarator:)#R s j D ii i(i>i[const][*]id[ cexpr ][= init])wu#R s  D wii iNi^|Zero or more comma separated;+ $3iThe id after ENUM is created as a type large enough to the largest constant in the list. The ids in the list are each created as a constant. By default the first id is set to zero and they increment by one. If a =cepr follows an id that id will have the value of the constant expression and the following list will increment by one.The :cexpr after an id specifies in a struct or union the number of bits to use for the id. This number may be 1-8. Multiple [] may be used for multiple dimension arrays. Structures and unions may be nested. The id after STRUCT may be used in another STRUCT and the {} is not used to reuse the same structure form again.5 wp( iExamples:u3;B Rgiiint a,b,c,d;typedef int byte;typedef short bit;bit e,f;byte g[3][2];char *h;enum boolean {false, true};boolean j;byte k = 5;byte const WEEKS = 52;byte const FACTORS [4] ={8, 16, 64, 128};struct data_record {byte a [2];byte b : 2; /*2 bits */byte c : 3; /*3 bits*/int d;}Dp)1  F)iFunction Definition@i* $,Pi~iFUNCTION DEFINITIOND)1  G Function DefinitionAi* $.i Function Definition^6L( liThe format of a function definition is as follows:I4# a  ii<"i0niqualifierid( [ [type-specifier id ] ){ [ stmt ] } LA~#ʀ  "i62iYq4i̵^|Optional See Below^|Zero or more comma separated. See Data Types ^|Zero or more Semi-colon separated. See Statements.Y14( biThe qualifiers for a function are as follows:5 A+ &P:HVOID? + &(P:Htype-specifier:H + &P:H#separate8   + &P:H#inline8 H  + &P:H#int_..-  * $Pi~iZ0 ? * "aiWhen one of the above are used and the function has a prototype (forward declaration of the function before it is defined) you must include the qualifier on both the prototype and function definition. A (non-standard) feature has been added to the compiler to help get around the problems created by the fact that pointers cannot be created to constant strings. A function that has one CHAR parameter will accept a constant string where it is called. The compiler will generate a loop that will call the function once for each character in the string.4 s ( iExample:f:?  , (tiivoid lcd_putc(char c ) {...}lcd_putc ("Hi There.");Es  1h H ` Reference ParametersB ` * $0i Reference ParametersL" * "EiThe compiler has limited support for reference parameters. This increases the readability of code and the efficiency of some inline procedures. The following two procedures are the same. The one with reference parameters will be implemented with greater efficiency when it is inline.` @ NWiifunct_a(int*x,int*y){/*Traditional*/if(*x!=5) *y=*x+3;}funct_a(&a,&b);funct_b(int&x,int&y){/*Reference params*/ if(x!=5) y=x+3;}funct_b(a,b);M @1  I @U@C Statements and Expressions @IU@* $>Pi~iC STATEMENTS AND EXPRESSIONS? @@14  J@@BProgram Syntax<U@@* $$i Program Syntax,@@) "@~i@A( iA program is made up of the following four elements in a file. These are covered in more detail in the following paragraphs.9@A+ &P:HComment HA%B+ &:P:HPre-Processor Directive@AeB+ &*P:HData DefinitionD%BB+ &2P:HFunction Definition*eBB' i8B C1 ہ K C@C*DComment5 B@C* $i Comment C*D* "iA comment may appear anywhere within a file except within a quoted string. Characters between the /* and */ are ignored. Characters after a // up to the end of a line are also ignored.; @CeD1 p LeDDEStatements8*DD* $i StatementsXeDE pPi~iIX{=0: `.G/%y  +if while do for switch return goto label break continue expr ; stmt ; D0F1 ہ & M0FhFZStatements8EhF* $iSTATEMENTSm0FFW#~,  iiSTATEMENTEXAMPLEMhFGr#  HiLi Nif (expr) stmt; [else stmt;]if (x==25) x=1;else x=x+1;JFbH#؀  <i6i48while (expr) stmt;while (get_rtcc()!=0) putc(n);LG-I#΀  Hi@iBdo stmt while (expr);do { putc(c=getc());} while (c!=0);QbHIl#  $iDiFfor (expr1;expr2;expr3) stmt;for (i=1;i<=10;++i) printf("%u\r\n",i);-IK#   |ii&switch (expr) { case cexpr: stmt; //one or more case [default:stmt]... }switch (cmd) { case 0: printf("cmd 0"); break; case 1: printf("cmd 1"); break; default: printf("bad cmd"); break; }$ILq#H  0i*i,return [expr];return (5); KLq#@  0i$i&goto label;goto loop;"L;Mt#D  6i(i*label: stmt;loop: I++;|LMh#(  iibreak;break;;M=Nk#6  $iicontinue;continue;MNn#&  *iiexpr;i=1;r =N0Oh#  i i ;;QN u#  0i~i" {[stmt]} ^ |Zero or more semi-colon separated.{a=1; b=1;}0O EN&0OZ( LiNote: Items in [ ] are optional3 1p NAIF0Z* $ i IF-* $Pi~i=oH `zPi~iStatement:if (expr) stmt; [else stmt;]Example:S', (Niiif (x==25) x=1;else x=x+1;So7 >8Pi~i̵Also See:Statements ,A) "@~i6w1& 5 OwWhile3 A* $i Whileu2wC VdPi~iStatement:while (expr) stmt;Example:`)7 >Riiwhile (get_rtcc()!=0)putc(n);S҃7 >8Pi~i̵Also See:Statements ,) "@~i3҃11v  P1aDo0a* $ i Dov.1ׄH `\Pi~iStatement:do stmt while (expr);b5a9- *jiiExample:do { putc(c=getc());} while (c!=0);m)ׄD XRPi~i̵XAlso See:Statements , While 49څ1o5 Y Qڅ IFor1 * $i ForBڅP pPi~iStatement:for (expr1;expr2;expr3) stmt;Example:W, + &Xiifor (i=1;i<=10;++i)printf("%u\r\n",i);UI8 @:Pi~i̵Also See:Statements 71  RSwitch4 I* $i SwitchqwR tPi~iStatement:switch (expr) { case cexpr: stmt; //one or more case [default:stmt] }Example:@0 .3iiswitch (cmd) { case 0: printf("cmd 0"); break; case 1: printf("cmd 1"); break; default: printf("bad cmd"); break; }Uw8 @:Pi~i̵Also See:Statements 7@̉1/Y  S̉Return4 * $i Returnm-̉m@ PZPi~iStatement:return [expr];Example:6( iireturn (5);[m< H>Pi~i̵Also See:Statements 531R M T3eGoto2e* $i Gotoj*3ϋ@ PTPi~iStatement:goto label;Example:5 e( iigoto loop;-ϋ1* $Pi~iU8 @:Pi~i̵Also See:Statements 611S  ULabel3 * $i Labelk+Z@ PVPi~iStatement:label: stmt;Example:5 ( iiloop: i++;-Z* $Pi~iU8 @:Pi~i̵Also See:Statements 6G1AM  VGzBreak3 z* $i Break]#G׎: DFPi~iStatement:break;Example:1 z( iibreak;-׎5* $Pi~iU8 @:Pi~i̵Also See:Statements 95Ï1J R WÏ "Continue6  * $i ContinueÏ `&Ïl: DLPi~iStatement:continue;Example:4 ( iicontinue;-l* $Pi~iU"8 @:Pi~i̵Also See:Statements 5W1> XWExpr2"* $i Expr\"W: DDPi~iStatement:expr;Example:/( iii=1;-A* $Pi~iU8 @:Pi~i̵Also See:Statements 2A17R Y;-) "@~i ;XM: D<Pi~iStatement:;Example:,y( ii;-M* $Pi~iUy8 @:Pi~i̵Also See:Statements 501 y Z0bStmt2b* $i Stmt-0* $Pi~iVb7R tPi~iStatement:{[stmt]} \Zero or more semi colon separatedExample:?v- *$ii {a=1; b=1;}U78 @:Pi~i̵Also See:Statements < v1X [@gExpressions9@* $i Expressions,l) "@~i P@B#TiConstants:XlI#b  i i123DecimalWkI#b  ii0123OctalV I#b  ii0x123Hex\kI#b&  ii0b010010BinaryZwI#b"  i i'x'CharactercI#b4  ii'\010'Octal Character`w:I#b.  ii'\xA5Hex Charactertq#  ifi '\c'Special Character. Where \c is one of: \nLine Feed- Same as \x0a\rReturn Fee - Same as \x0d\tTAB- Same as \x09\bBackspace- Same as \x08\fForm Feed- Same as x0c\aBell- Same as \x07\vVertical Space- Same as \x0b\?Question Mark- Same as \x3f\Single Quote- Same as \x60\"Double Quote- Same as \x22\\A Single Backslash- Same as \x5cw.:I#b\  ii"abcdef"String (null is added to the end)F%I#b  ii"abc" "def"Strings with auto-concatenation (same result as above)*O' iR%B#T iIdentifiers:mOWI#b  iiABCDEUp to 32 characters beginning with a non-numeric. Valid characters are A-Z, 0-9 and _ (underscore).cI#b4  iiID[X]Single Subscripti W#I#b@  iiID[X][X]Multiple Subscripts?I#b~  iiID.IDStructure or union reference (first ID is a variable)K#?I#b  iiID->IDStructure or union reference (first ID is a pointer to variable)(g& i: ?1\K@Operators7 g* $i Operators-* $Pi~igoW#~0n * i i+Addition Operator?I#b~n * i i+=Addition assignment operator, x+=y, is the same as x=x+yBI#bn * i i&=Bitwise and assignment operator, x&=y, is the same as x=x&y_I#b,n * ii&Address operatorcUI#b4n * ii&Bitwise and operatorKI#bn * i i^=Bitwise exclusive or assignment operator, x^=y, is the same as x=x^yl#UUI#bFn * ii^Bitwise exclusive or operatorKI#bn * i il=Bitwise inclusive or assignment operator, xl=y, is the same as x=xlyl#UUI#bFn * iilBitwise inclusive or operatoro&I#bLn * i i?:Conditional Expression operatorZUI#b"n * i i- -Decrement?I#b~n * i i/=Division assignment operator, x\=y, is the same as x=x/y`I#b.n * ii/Division operatorX^I#bn * i i==EqualitydI#b6n * ii>Greater than operatorq(^3I#bPn * i i>=Greater than or equal to operatorYI#b n * i i++Incrementc3I#b4n * ii*Indirection operatorZII#b"n * i i!=InequalityDI#bn * i i<<=Left shift assignment operator, x<<=y, is the same as x=x<n * ii!Logical negation operatorcl 7 I#b4n * i illLogical OR operator=  I#bzn * i i%=Modules assignment operator x%=y, is the same as x=x%y_7  I#b,n * ii%Modules operatorE  I#bn * i i*=Multiplication assignment operator, x*=y, is the same as x=x*yf  I#b:n * ii*Multiplication operatorh x I#b>n * ii~One's complement operator<  I#bxn * i i>>=Right shift assignment, x>>=y, is the same as x=x>>ydx aI#b6n * i i>>Right shift operatork" I#bDn * i i->Structure Pointer operationo&a;I#bLn * i i-=Subtraction assignment operatorcI#b4n * ii-Subtraction operatorw.;!@I#b\n * iisizeofDetermines size !@gin bytes of operand*K@' iG!@@1 y F ]@@hNExpressions PrecedenceAK@@* $.i Operator PrecedenceH@A+ &:iIn descending precedence@A#&( w z iiii i$i(expr)1AB# b w z iii.i>iPi!expr~expr++exprexpr++- -exprexpr- -.AsC# \ w z ii(i8iTiXi(type)expr*expr&valuesizeof(type)(B8D# P w z ii.iDiHiLiexpr*exprexpr/exprexpr%exprsCD# > w z ii.i2i6i:iexpr+exprexpr-expr!8DE# B w z ii2i6i:i>iexpr<>expr3DF# f w z ii0iFi^ibiexprexprexpr>=expr!E@G# B w z ii2i6i:i>iexpr==exprexpr!=exprFG# , w z iii i$i(iexpr&expr@GH# , w z iii i$i(iexpr^exprG[I# 0 w z ii i$i(i,iexpr | exprHJ# 0 w z ii i$i(i,iexpr&& expr[IJ# 2 w z ii"i&i*i.iexpr || exprJJK4#8,i!value ? expr: expr/JK# ^ w z ii8iRiViZivalue = exprvalue+=exprvalue-=expr.KL# \ w z ii6iPiTiXivalue*=exprvalue/=exprvalue%=expr0KtM# ` w z ii:iTiXi\ivalue>>=exprvalue<<=exprvalue&=expr-L>N# Z w z ii6iNiRiVivalue^=exprvalue|=exprexpr, expr*tMhN' iC>NN1F Â^NNBuilt-In Functions?hNN* $*Pi~iBUILT-IN FUNCTIONSS"N=O1<_=OOBuilt-In Function List By CategoryP&NO* $Li Built-In Function List By Category9=OO+ &iRS232 I/OfO Pi~iON'' VrSjCgetc() 1putc() gets() puts() printf() kbhit() set_uart_speed() 7 O+ &iI2C I/OQg Pi~ifK )̀5(̀8K&̀i2c_start() i2c_stop() I2C_read i2c_write() i2c_poll() <+ &"iDiscrete I/O<' APi~i 3I&Kx7ѳ93I}=هN#ـj.61output_low() output_high() output_float() output_bit() input() output_X() input_X() port_b_pullups() set_tris_X() @g+ &*iSPI two wire I/OI' Z Pi~iH0OWxC"setup_spi() spi_read() spi_write() spi_data_is_in() FgP. ,0i Parallel Slave I/OS Z Pi~i%O666setup_psp() psp_input_full() psp_output_full() psp_overflow() 6 P3+ &iDelays5M jjPi~iXzz% delay_us() delay_ms() delay_cycles() B3+ &.iProcessor Controls-$ =Pi~iiD[ޓD ގπ`asleep() reset_cpu() restart_cause() disable_interrupts() enable_interrupts() ext_int_edge() read_bank() write_bank() Ei+ &4iBit/Byte Manipulationh$ш :ePi~iF* ^zD㍤=QvC`^7Ò+b<O##shift_right() shift_left() rotate_right() rotate_left() bit_clear() bit_set() bit_test() swap() make8() make16() make32() 6 i+ &iTimersvшt Pi~it58.O63KO3KOsetup_timer_X() set_timer_X() get_timer_X() setup_counters() setup_wdt() restart_wdt() C4+ &0iCapture/Compare/PWMh(@ PPPi~i1V\K{setup_ccpX() set_pwmX_duty() >4ڊ+ &&i A/D ConversionPZ Pi~ij\#ڊ‹+ &&i Analog CompareL3 62Pi~i~B}Fsetup_comparator() ;‹I+ & i Voltage RefF3 6&Pi~iͺ\setup_vref() ?IΌ+ &(i Internal EEPROMwg Pi~i7bt|cڀ✀read_eeprom() write_eeprom() read_program_eeprom() write_program_eeprom() read_calibration() ?Ό+ &(i Standard C Math aPi~i}V.ߠ㓎ㅞ㈈v"}|Lj+abs() acos() asin() atan() ceil() cos() exp() floor() labs() log() log10() pow() sin() sqrt() tan() ?ď+ &(i Standard C Char Pi~i1111ďN11IIOIIIII?4 ?4 ?4 .:atoi() atol() atoi32() atof() tolower() toupper() isalnum() isalpha() isamoung() isdigit() islower() isspace() isupper() isxdigit() strlen() strcpy() strncpy() strcpy() qďV T]Pi~i?4 ?4 ?4 ?4 ?4 ?4 ?4 OD/:?4 ?4 ?4 ?4 strcmp() stricmp() strncmp() strcat() strstr() strchr() strrchr() strtok() strspn() strcspn() strpbrk() strlwr() A+ &,i Standard C memory]V@ P:Pi~iѣ2memset() memcpy() 7+1RÂT`+_ABS( )4 _* $i ABS( )N+Q pPi~iSyntax:value = abs(x)Parameters:x is a signed 8, 16, or 32 bit int or a float.Returns:Same type as the parameter.Function:Computes the absolute value of a number. Availability:All devicesRequires:#include Examples:j>_, (|iisigned int target,actual;...error = abs(target-actual);i.; F\Pi~iv"Example Files:NoneAlso See:labs() 81ta>ACOS( )5 * $i ACOS( )Q>< H*Pi~iSee:SIN() 8v1TbvASIN( )5 >* $i ASIN( )Qv< H*Pi~iSee:SIN() 841t c4iATAN( )5 i* $i ATAN( )Q4< H*Pi~iSee:SIN() -i* $Pi~i71dNATOF()0 N' i ATOF()-{* $Pi~iNMJ bPi~iSyntax:result = atof(string)Parameters:string is a pointer to a null terminated string of characters.Returns:Result is a 32 bit floating point number.Function:Converts the string passed to the function into a floating point representation. If the result cannot be represented, the behavior is undefined. Availability:All devicesRequires:#include Examples:a{. ,iichar string [10];float x;strcpy (string, "123.456");x = atof(string);// x is now 123.456ZM^ Pi~i111111 VrExample Files:ex_tank.cAlso See:atoi(), atol(), atoi32(), printf() -* $Pi~i@1eEATOI( ) ATOL( )DE) "6i ATOI( )ATOL( )ATOI32()%jb Pi~iSyntax:ivalue = atoi(string)orlvalue = atol(string)ori32value = atoi32(string)Parameters:string is a pointer to a null terminated string of characters.Returns:ivalue is an 8 bit int.lvalue is a 16 bit int.i32value is a 32 bit int.Function:Converts the string pointed too by ptr to int representation. Accepts both decimal and hexadecimal argument. If the result cannot be represented, the behavior is undefined.}IE 4 8Pi~iAvailability:All devices.Requires:#include Examples:j Tj. ,iichar string[10];int x;strcpy(string,"123");x = atoi(string);// x is now 123n3 ; FfPi~i VrExample Files:input.cAlso See:printf() = 91Y f9sBIT_CLEAR( ):s* $ i BIT_CLEAR( )9b YPi~iSyntax:bit_clear(var,bit)Parameters:var may be a 8,16 or 32 bit variable (any lvalue) bit is a number 0-31 representing a bit number, 0 is the least significant bit.Returns:undefinedFunction:Simply clears the specified bit (0-7, 0-15 or 0-31) in the given variable. The least significant bit is 0. This function is the same as: var &= ~(1<Examples:p , (ii// Calculate cost based on weight rounded // up to the next poundcost = ceil( weight ) * DollarsPerPound;j/:@; F^Pi~i㈈Example Files:NoneAlso See:floor() 7w1<jw @COS( )4 @* $i COS( )Qw @< H*Pi~iSee:SIN()  @@@L@1 kL@@"CDELAY_CYCLES( )= @@* $&i DELAY_CYCLES( )@L@BM hPi~iSyntax:delay_cycles (count)Parameters:count - a constant or variable 1-255Returns:undefinedFunction:Creates code to perform a delay of the specified number of instruction clocks (1-255). An instruction clock is equal to four oscillator clocks.Availability:All devicesRequires:NothingExamples:~S@B+ &iidelay_cycles( 1 ); // Same as a NOPdelay_cycles(25); // At 20 mhz a 5us delayGB"CG ^Pi~iXzzExample Files:ex_cust.cAlso See:delay_us(), delay_ms() < B^C1Ԅl^CCiGDELAY_MS( )9"CC* $i DELAY_MS( )^CEE XPi~iSyntax:delay_ms (time)Parameters:time - a variable 0-255 or a constant 0-65535Returns:undefinedFunction:This function will create code to perform a delay of the specified length. Time is specified in milliseconds. This function works by executing a precise number of instructions to cause the requested delay. It does not use any timers. If interrupts are enabled the time spent in an interrupt routine is not counted toward the time.o>CF1 2|Pi~iAvailability:All devicesRequires:#use delayExamples:wEF1 2ii#use delay (clock=20000000)delay_ms( 2 );void delay_seconds(int n) { for (;n!=0; n- -) delay_ms( 1000 );}ZFiGS vPi~iXz% \QExample Files:ex_sqw.cAlso See:delay_us(), delay_cycles(), #use delay < FG1_mGG LDELAY_US( )9iGG* $i DELAY_US( )^GGJ1 2|Pi~iAvailability:All devicesRequires:#use delayExamples:i  GETC()GETCH() GETCHAR() A< FPi~iSyntax:value = getc()Parameters:NoneReturns:A 8 bit characterFunction:This function waits for a character to come in over the RS232 RCV pin and returns the character. If you do not want to hang forever waiting for an incoming character use kbhit() to test for a character available. If a built-in USART is used the hardware can buffer 3 characters otherwise GETC must be active while the character is being received by the PIC.Availability:All devicesQ#. ,FPi~iRequires:#use rs232Examples:Ww, (iiprintf("Continue (Y,N)?");do {answer=getch();}while(answer!='Y' && answer!='N');f<_ Pi~i' Vr䃮Example Files:ex_stwt.cAlso See:putc(), kbhit(), printf(), #use rs232, input.c8wt1 X`utGETS( )5 <* $i GETS( )ptfM hPi~iSyntax:gets (string)Parameters:string is a pointer to a array of characters.Returns:undefinedFunction:Reads characters (using GETC()) into the string until a RETURN (value 13) is encountered. The string is terminated with a 0. Note that INPUT.C has a more versatile GET_STRING function.Availability:All devicesRequires:#use rs232Examples:r. ,iichar string[30];printf("Password: ");gets(string);if(strcmp(string,password)) printf("OK");Df; FPi~iExample Files:NoneAlso See:getc(), get_string in input.c< 1/v I2C_POLL( )9* $i I2C_POLL( )A P1Pi~iSyntax:i2c_poll()Parameters:NoneReturns:1 (TRUE) or 0 (FALSE)Function:The I2C_POLL() function should only be used when the built-in SSP is used. This function returns TRUE if the hardware has a received byte in the buffer. When a TRUE is returned, a call to I2C_READ() will immediately return the byte that was received.Availability:Devices with built in I2CRequires:#use i2cExamples:4 6iii2c_start(); // Start conditioni2c_write(0xc1); // Device address/Readcount=0;while(count!=4) {while(!i2c_poll()) ;buffer[count++]= i2c_read(); //Read Next}i2c_stop(); // Stop conditionb _ Pi~i fK8K )̀&̀Example Files:ex_slave.cAlso See:i2c_start, i2c_write, i2c_stop, i2c_poll ;  1`w   I2C_READ()8  * $i I2C_READ()K a Z Pi~iSyntax:data = i2c_read();ordata = i2c_read(ack);Parameters:ack -Optional, defaults to 1.0 indicates do not ack.1 indicates to ack.Returns:data - 8 bit intFunction:Reads a byte over the I2C interface. In master mode this function will generate the clock and in slave mode it will wait for the clock. There is no timeout for the slave, use I2C_POLL to prevent a lockup. Use RESTART_WDT in the #USE I2C to strobe the watch-dog timer in the slave mode while waiting.O!  . ,BPi~iRequires:#use i2cExamples:Ua 2 - *iii2c_start();i2c_write(0xa1);data1 = i2c_read();data2 = i2c_read();i2c_stop();n  _ Pi~ifK8K )̀&̀Example Files:ex_extee.c with 2416.CSee Also:i2c_start, i2c_write, i2c_stop, i2c_poll < 2 ; 19x; t | I2C_START()9 t * $i I2C_START(); z A PPi~iSyntax:i2c_start()Parameters:NoneReturns:undefinedFunction:Issues a start condition when in the I2C master mode. After the start condition the clock is held low until I2C_WRITE() is called. If another I2C_start is called in the same function before an i2c_stop is called then a special restart condition is issued. Note that specific I2C protocol depends on the slave device.Availability:All devices.Requires:#use i2cExamples:t  0 .iii2c_start();i2c_write(0xa0); // Device addressi2c_write(address); // Data to device i2c_start(); // Restart i2c_write(0xa1); // to change data directiondata=i2c_read(0); // Now read from slave i2c_stop();{z | k Pi~i )̀8K5(̀&̀tiExample Files:ex_extee.c with 2416.cAlso See:i2c_stop, i2c_write, i2c_read, i2c_poll, #use i2c ;  1y I2C_STOP()8| * $i I2C_STOP() B RPi~iSyntax:i2c_stop()Parameters:NoneReturns:undefinedFunction:Issues a stop condition when in the I2C is in master mode.Availability:All devicesRequires:#use i2cExamples: 2 2iiii2c_start(); // Start conditioni2c_write(0xa0); // Device addressi2c_write(5); // Device commandi2c_write(12); // Device datai2c_stop(); // Stop condition| k Pi~ifK8K5(̀&̀tiExample Files:ex_extee.c with 2416.cAlso See:i2c_start, i2c_write, i2c_read, i2c_poll, #use i2c = 1Dz 4 'B I2C_WRITE( ): 4 * $ i I2C_WRITE( )L  G \Pi~iSyntax:i2c_write (data)Parameters:data is an 8 bit intReturns:This function returns the ACK Bit. 0 means ACK, 1 means NO ACK.Function:Sends a single byte over the I2C interface. In master mode this function will generate a clock with the data and in slave mode it will wait for the clock from the master. No automatic timeout is provided in this function. This function returns the ACK bit. The LSB of the first write after a start determines the direction of data transfer (0 is master to slave). Note that specific I2C protocol depends on the slave device.m<4 @@ 1 2xPi~iAvaila @@ bility:All devicesRequires:#use i2cExamples: ?A 8 >iilong cmd;...i2c_start();// Start conditioni2c_write(0xa0);// Device addressi2c_write(cmd);// Low byte of commandi2c_write(cmd>>8);// High byte of commandi2c_stop();// Stop condition}@@ 'B k Pi~ifK )̀5(̀&̀tiExample Files:ex_extee.c with 2416.cAlso See:i2c_start(), i2c_stop, i2c_read, i2c_poll, #use i2c 9?A `B 1{`B B G INPUT( )6 'B B * $i INPUT( )~0`B E N jaPi~iSyntax:value = input (pin)Parameters:Pin to read. Pins are defined in the devices .h file. The actual value is a bit address. For example, port a (byte 5) bit 3 would have a value of 5*8+3 or 43. This is defined as follows: #define PIN_A3 43Returns:0 (or FALSE) if the pin is low,1 (or TRUE) if the pin is highFunction:This function returns the state of the indicated pin. The method of I/O is dependent on the last USE *_IO directive. By default with standard I/O before the input is done the data direction is set to input. dB E 1 2Pi~iAvailability:All devicesRequires:Pin constants are defined in the devices .h fileExamples:mE DF . ,iiwhile ( !input(PIN_B1) ); // waits for B1 to go highif( input(PIN_A0) )printf("A0 is now high\r\n");iE G S vPi~i#ـ 3I&KExample Files:EX_PULSE.CAlso See:input_x(), output_low(), output_high(), #use xxxx_io: DF :G 1QD|:G qG J INPUT_x()7 G qG * $i INPUT_x():G I G \Pi~iSyntax:value = input_a()value = input_b()value = input_c()value = input_d()value = input_e()Parameters:NoneReturns:An 8 bit int representing the port input data.Function:Inputs an entire byte from a port. The direction register is changed in accordance with the last specified #USE *_IO directive. By default with standard I/O before the input is done the data direction is set to input. Availability:All devicesRequires:Nothing8 qG I + &Pi~iExamples:>I I ) "*iidata = input_b();PI J G ^Pi~i}=هNExample Files:ex_psp.cAlso See:input(), output_x(), #USE xxxx_IO< I J 1x}J K {N ISAMOUNG( )9J K * $i ISAMOUNG( )^J L ` Pi~iSyntax:result = isamoung (value, cstring)Parameters:value is a charactercstring is a constant stringReturns:0 (or FALSE) if value is not in cstring1 (or TRUE) if value is in cstringFunction:Returns TRUE if a character is one of the characters in a constant string.Availability:All devicesRequires:NothingExamples:wK hM - *iichar x;...if( isamoung( x, "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ") ) printf("The character is valid");L {N րPi~iIIIIIIIExample Files:ctype.hAlso See:isalnum(), isalpha(), isdigit(), isspace(), islower(), isupper(), isxdigit() > hM N 1\~N SO A ISALNUM(char)g{N SO 3 6i  ISALNUM(char)ISALPHA(char)ISDIGIT(char)ISLOWER(char)ISSPACE(char)ISUPPER(char)ISXDIGIT(char)&N ~ ʀQPi~i"Syntax:value = isalnum(datac)value = isSO {N alpha(datac)value = isdigit(datac)value = islower(datac)value = isspace(datac)value = isupper(datac)value = isxdigit(datac)Parameters:datac is a 8 bit characterReturns:0 (or FALSE) if datac dose not match the criteria, 1 (or TRUE) if datac does match the criteria.Function:Tests a character to see if it meets specific criteria as follows:1SO  N jcPi~iisalnum(x)X is 0..9, 'A'..'Z', or 'a'..'z'isalpha(x)X is 'A'..'Z' or 'a'..'z'isdigit(x)X is '0'..'9'islower(x)X is 'a'..'z' isupper(x)X is 'A'..'Z isspace(xX is a spaceisxdigit(x)X is '0'..'9', 'A'..'F', or 'a'..'f'Availability:All devicesRequires:ctype.hExamples: Ѓ 4 61iichar id[20]; ...if(isalpha(id[0])) {valid_id=TRUE;for(i=1;i  1 2|Pi~iAvailability:All devicesRequires:#use rs232Examples:( 8 > Jiichar timed_getc() { long timeout; timeout_error=FALSE; timeout=0; while(!kbhit&&(++timeout<50000)) // 1/2 second delay_us(10); if(kbhit())return(getc()); else {timeout_error=TRUE;return(0); }}- e * $Pi~iD8 G ^Pi~i䃮Example Files:ex_tgetc.cAlso See:getc(), #USE RS232 8e ( 1l( ] LABS( )5 ] * $i LABS( )L( M hPi~iSyntax:result = labs (value)Parameters:value is a 16 bit signed long intReturns:A 16 bit signed long intFunction:Computes the absolute value of a long integer.Availability:All devices.Requires:stdlib.h must be included.Examples:\] 0 + &iiif( labs( target_value - actual_value ) > 500 )printf("Error is over 500 points\r\n");h- ; FZPi~i}Example Files:NoneAlso See:abs() < 0 Ԍ 13gԌ LCD_LOAD( )9 * $i LCD_LOAD( ),Ԍ 9 ] Pi~iSyntax:lcd_load (buffer_pointer, offset, length);Parameters:buffer_pointer points to the user data to send to the LCD, offset is the offset into the LCD segment memory to write the data, length is the number of bytes to transfer.Returns:undefinedFunction:Will load length bytes from buffer_pointer into the 923/924 LCD segment data area beginning at offset (0-15). lcd_symbol provides an easier way to write data to the segment memory.  2 23Pi~iAvailability:This function is only available on devices with LCD drive hardware.Requires:Constants are defined in the devices .h file.Example9  s:E9 U ) "8iilcd_load(buffer, 0, 16);K G ^Pi~i\6OExample Files:ex_92lcd.cAlso See:lcd_symbol(), setup_lcd() > U % 1c% ` LCD_SYMBOL( ); ` * $"i LCD_SYMBOL( )-% } Ȁ[Pi~iSyntax:lcd_symbol (symbol, b7_addr, b6_addr, b5_addr, b4_addr, b3_addr, b2_addr, b1_addr, b0_addr);Parameters:symbol is a 8 bit constant.bX_addr is a bit address representing the segment location to be used for bit X of symbol.Returns:undefinedFunction:Loads 8 bits into the segment data area for the LCD with each bit address specified. If bit 7 in symbol is set the segment at B7_addr is set, otherwise it is cleared. The same is true of all other bits in symbol. The B7_addr is a bit address into the LCD RAM. ` 2 23Pi~iAvailability:This function is only available on devices with LCD drive hardware.Requires:Constants are defined in the devices .h file.Examples:-  5 8iibyte CONST DIGIT_MAP[10]={0X90,0XB7,0X19,0X36,0X54,0X50,0XB5,0X24};#define DIGIT_1_CONFIG COM0+2,COM0+4,COM05,COM2+4,COM2+1, COM1+4,COM1+5for(i=1; i<=9; ++i) {LCD_SYMBOL(DIGIT_MAP[i],DIGIT_1_CONFIG);delay_ms(1000);} I G ^Pi~iO"&Example Files:ex_92lcd.cAlso See:setup_lcd(), lcd_load() 7 1g V LOG( )4 * $i LOG( )4 S tiPi~iSyntax:result = log (value)Parameters:value is a floatReturns:A floatFunction:Computes the natural logarithm of the float x. If the argument is less than or equal to zero or too large, the behavior is undefined. Availability:All devicesRequires:math.h must be included.Examples:: ) ""iilnx = log(x);E V S vPi~i}ㅞ|Example Files:NoneAlso See:log10(), exp(), pow() 9 1+ \ LOG10( )6 V * $i LOG10( ). F S t]Pi~iSyntax:result = log10 (value)Parameters:value is a floatReturns:A floatFunction:Computes the base-ten logarithm of the float x. If the argument is less than or equal to zero or too large, the behavior is undefined.Availability:Al devicesRequires:#include Examples:S* ) "Tiidb = log10( read_adc()*(5.0/255) )*10;CF / S vPi~iㅞ|Example Files:NoneAlso See:log(), exp(), pow() - \ * $Pi~i8/ 1 r MAKE8()1 \ ' i MAKE8()` b Pi~iSyntax: i8 = MAKE8(var,offset)Parameters:var is a 16 or 32 bit integer.offset is a byte offset of 0,1,2 or 3.Returns:An 8 bit integerFunction:Extracts the byte at offset from var. Same as: i8 = (((var >> (offset*8)) & 0xff) except it is done with a single byte move.Availability:All devicesRequires:NothingExamples:`5 + &jiiint32 x;int y;y = make8(x,3); // Gets MSB of x@ r K fPi~iO##Example Files:NoneAlso see:make16(), make32() 9 1 o  MAKE16()2 r ' i MAKE16()  Z +Pi~  r iSyntax: i16 = MAKE16(varhigh, varlow)Parameters:varhigh and varlow are 8 bit integers.Returns:A 16 bit integerFunction:Makes a 16 bit number out of two 8 bit numbers. If either parameter is 16 or 32 bits only the lsb is used. Same as: i16 = (int16)(varhigh&0xff)*0x100+(varlow&0xff) except it is done with two byte moves.Availability:All devicesRequires:NothingExamples:V+ . + &Viilong x;int hi,lo;x = make16(hi,lo); D  K fPi~ib<#Example Files:ltc1298.cAlso see:make8(), make32() 9.  1k % (  MAKE32()2  ( ' i MAKE32() = c ePi~iSyntax: i32 = MAKE32(var1, var2, var3, var4)Parameters:var1-4 are a 8 or 16 bit integers. var2-4 are optional. Returns:A 32 bit integerFunction:Makes a 32 bit number out of any combination of 8 and 16 bit numbers. Note that the number of parameters may be 1 to 4. The msb is first. If the total bits provided is less than 32 then zeros are added at the msb.Availability:All devicesRequires:Nothing:( w , (Pi~iExamples:= Z 5 8]iiint32 x;int y;long z;x = make32(1,2,3,4); // x is 0x01020304y=0x12;z=0x4321;x = make32(y,z); // x is 0x00124321 x = make32(y,y,z); // x is 0x12124321 Cw  G ^Pi~ib<O#Example Files:ex_freqc.cAlso see:make8(), make16() : Z  1 U MEMCPY( )7  U * $i MEMCPY( ) r c uPi~iSyntax:memcpy (destination, source, n)Parameters:destination is a pointer to the destination memory, source is a pointer to the source memory, n is the number of bytes to transferReturns:undefinedFunction:Copies n bytes from source to destination in RAM. Be aware that array names are pointers where other variable names and structure names are not (and therefore need a & before them).Availability:All devices.N U . ,@Pi~iRequires:NothingExamples:vr a + &iimemcpy(&structA,&structB,sizeof (structA));memcpy(arrayA,arrayB,sizeof (arrayA));memcpy(&structA, &databyte, 1);> G ^|Pi~i.:ѣExample Files:NoneAlso See:strcpy(), memset() : a 1{+  W  MEMSET( )7 W * $i MEMSET( )  ` m 9Pi~iSyntax:memset (destination, value, n)Parameters:destination is a pointer to memory, value is a 8 bit int, n is a 8 bit int.Returns:undefinedFunction:Sets n bytes of memory at destination with the value. Be aware that array names are pointers where other variable names and structure names are not (and therefore need a & before them).Availability:All devicesRequires:Nothing6 W * $Pi~iExamples:u` 6 + &iimemset(arrayA, 0, sizeof(arrayA));memset(arrayB, '?', sizeof(arrayB));memset(&structA, 0xFF, sizeof (structA));k0  ; F`Pi~i2Example Files:NoneAlso See:memcpy() > 6  1\  :D OUTPUT_BIT( );  * $"i OUTPUT_BIT( )- SA Q pPi~iSyntax:output_bit (pin, value)Parameters:Pins are defined in the devices .h file. The actual number is a bit address. For example, por SA  t a (byte 5) bit 3 would have a value of 5*8+3 or 43. This is defined as follows: #define PIN_A3 43. Value is a 1 or a 0.Returns:undefinedFunction:Outputs the specified value (0 or 1) to the specified I/O pin. The method of setting the direction register is determined by the last #USE *_IO directive. d A 1 2Pi~iAvailability:All devicesRequires:Pin constants are defined in the devices .h fileExamples:OSA 7C 8 >/iioutput_bit( PIN_B0, 0);// Same as output_low(pin_B0);output_bit( PIN_B0,input( PIN_B1 ) );// Make pin B0 the same as B1output_bit( PIN_B0,shift_left(&data,1,input(PIN_B1)));// Output the MSB of data to // B0 and at the same time // shift B1 into the LSB of dataA :D l /Pi~i}= 3I&Kx7ѳهNExample Files:ex_extee.c with 9356.cAlso See:input(), output_low(), output_high(), output_float(), output_x(), #use xxxx_io@7C zD 1 zD D H OUTPUT_FLOAT( )=:D D * $&i OUTPUT_FLOAT( )AzD F K dPi~iSyntax:output_float (pin)Parameters:Pins are defined in the devices .h file. The actual value is a bit address. For example, port a (byte 5) bit 3 would have a value of 5*8+3 or 43. This is defined as follows: #define PIN_A3 43Returns:undefinedFunction:Sets the specified pin to the input mode. This will allow the pin to float high to represent a high on an open collector type of connection.Availability:All devicesRequires:Pin constants are defined in the devices .h file8 D 0G + &Pi~iExamples:yKF G . ,iiif( (data & 0x80)==0 )output_low(pin_A0);elseoutput_float(pin_A0);0G H l Pi~i}= 3I&K93IهNExample Files:NoneAlso See:input(), output_low(), output_high(), output_bit(), output_x(), #use xxxx_io?G H 1H I L OUTPUT_HIGH( )<H I * $$i OUTPUT_HIGH( )/H BK N jPi~iSyntax:output_high (pin)Parameters:Pin to read. Pins are defined in the devices .h file. The actual value is a bit address. For example, port a (byte 5) bit 3 would have a value of 5*8+3 or 43. This is defined as follows: #define PIN_A3 43Returns:undefinedFunction:Sets a given pin to the high state. The method of I/O used is dependent on the last USE *_IO directive. Availability:All devicesRequires:Pin constants are defined in the devices .h file8 I zK + &Pi~iExamples:?BK K ( .iioutput_high(PIN_A0);zK L p Pi~i}= 3Ix7ѳ93IهNExample Files:ex_sqw.cAlso See:input(), output_low(), output_float(), output_bit(), output_x(), #use xxxx_io> K L 1 L ,M  OUTPUT_LOW( );L ,M * $"i OUTPUT_LOW( )&L RO Q pPi~iSyntax:output_low (pin)Parameters:Pins are defined in the devices .h file. The actual value is a bit address. For example, port a (byte 5) bit 3 would have a value of 5*8+3 or 43. This is defined as follows: #define PIN_A3 43Returns:undefinedFunction:Sets a given pin to the ground state. The method of I/O used is dependent on the last USE *_IO directive. Availability:All devicesRequires:Pin constants are defined in the devices .h file8 ,M O + &Pi~iExamples:>RO O ( ,iioutput_low(PIN_A0);-O * $Pi~iO L O  l Pi~i}=&Kx7ѳ93IهNExample Files:ex_sqw.cAlso See:input(), output_high(), output_float(), output_bit(), output_x(), #use xxxx_io< = 1j= OUTPUT_A( )q@ 1 2i  OUTPUT_A( )OUTPUT_B( )OUTPUT_C( )OUTPUT_D( )OUTPUT_E( )= m 1Pi~iSyntax:output_a (value)output_b (value)output_c (value)output_d (value)output_e (value)Parameters:value is a 8 bit intReturns:undefinedFunction:Output an entire byte to a port. The direction register is changed in accordance with the last specified #USE *_IO directive.Availability:All devices, however not all devices have all ports (A-E).Requires:NothingExamples:< ) "&iiOUTPUT_B(0xf0); l Pi~i}= 3I&Kx7ѳ93IExample Files:ex_patg.cAlso See:input(), output_low(), output_high(), output_float(), output_bit(), #use xxxx_ioB ) 1) h PORT_B_PULLUPS( )? h * $*i PORT_B_PULLUPS( )=) M h{Pi~iSyntax:port_b_pull-ups (value)Parameters:value is TRUE or FALSEReturns:undefinedFunction:Sets the port B input pullups. TRUE will activate, and a FALSE will deactivate.Availability:Only 14 and 16 bit devices (PCM and PCH). (Note: use SETUP_COUNTERS on PCB parts).Requires:NothingExamples:Ch 5 ) "4iiport_b_pullups(FALSE);c S vPi~i}=#ـx7ѳExample Files:ex_lcdkb.c with kbd.cAlso See:input(), input_x(), output_float() 45  1 S POW4 S * $iPOW( ) r Y Pi~iSyntax:f = pow (x,y)Parameters:x and y and of type floatReturns:A floatFunction:Calculates X to the Y power.Availability:All DevicesRequires:#include Examples:?S ) ",iiarea = (size,3.0);Y*r / .TPi~iExample files:NoneAlso See:Nothing: D 1 D { 6 PRINTF( )7 { * $i PRINTF( )-D  v [Pi~i!Syntax:printf (string)orprintf (cstring, values...)orprintf (fname, cstring, values...)Parameters:String is a constant string or an array of characters null terminated. Values is a list of variables separated by commas, fname is a function name to be used for outputting (default is putc is none is specified).Returns:undefinedFunction:Outputs a string of characters to either the standard RS-232 pins (first two forms) or to a specified function. Formatting is in accordance with the string argument. When variables are used this string must be a constant. The % character is used within the string to indicate a variable value is to be formatted and output. Longs in the printf may be 16 or 32 bit. A %% will output a single %. Formatting rules for the % follows.,{ J - (Pi~iFormat:The format takes the generic form %wt where w is optional and may be 1-9 to specify how many characters are to be outputted, or 01-09 to indicate leading zeros or 1.1 to 9.9 for floating point. t is the type and may be one of the following:? . ,"P:CCharacterIJ ҏ . ,6P:SString or characterB . ,(P:ҏ UUnsigned intQ#ҏ q . ,FP:xHex int (lower case output)Q# . ,FP:XHex int (upper case output)@q  . ,$P:DSigned intI K . ,6P:eFloat in exp format;  . ,P:fFloatP"K . ,DP:LxHex long int (lower case)P" & . ,DP:LXHex long int (upper case)L r . ,<P:Iuunsigned decimal longJ& . ,8P:Idsigned decimal long>r . , P:%Just a %i6 c 3 6lPi~iExample formats:SpeciferValue=0x12Value=0xfeb ! \ Pi~iAa%03u018254%u18254%2u18*%518254%d18-2%x12Fe%X12FE%4X001200FEc 6 <Pi~i* Result is undefined - Assume garbage.Availability:All devicesRequires:#use rs232 (unless fname is used)Examples:! . *iibyte x,y,z;printf("HiThere");printf("RTCCValue=>%2x\n\r",get_rtcc());printf("%2u %X %4X\n\r",x,y,z);printf(LCD_PUTC, "n=%u",n);W 6 S vPi~i11''Example Files:ex_admm.c, ex_lcdkb.cAlso See:atoi(), puts(), putc() B x 1zx PSP_OUTPUT_FULL()i:6 / .ti  PSP_OUTPUT_FULL()PSP_INPUT_FULL() PSP_OVERFLOW() {x E XPi~iSyntax:result = psp_output_full()result = psp_input_full() result = psp_overflow() Parameters:NoneReturns:A 0 (FALSE) or 1 (TRUE)Function:These functions check the Parallel Slave Port (PSP) for the indicated conditions and return TRUE or FALSE.Availability:This function is only available on devices with PSP hardware on chips.Requires:NothingExamples: ] 2 2iiwhile (psp_output_full()) ;psp_data = command;while(!psp_input_full()) ;if ( psp_overflow() )error = TRUE;elsedata = psp_data;r7 ; FnPi~i%OExample Files:ex_psp.cAlso See:setup_psp() 8]  1# M ? PUTC( )F M . ,0i  PUTC( )PUTCHAR( )  . U xPi~iSyntax:putc (cdata)putchar (cdata)Parameters:cdata is a 8 bit characterReturns:undefinedFunction:This function sends a character over the RS232 XMIT pin. A #USE RS232 must appear before this call to determine the baud rate and pin used. The #USE RS232 remains in effect until another is encountered in the file.Availability:All devicesRequires:#use rs232Examples:l@M , (iiputc('*');for(i=0; i<10; i++) putc(buffer[i]);putc(13);R. ? S vPi~i Vr䃮Example Files:ex_tgetc.cAlso See:getc(), printf(), #USE RS232 8 w 1z<w PUTS( )5 ? * $i PUTS( )w ~ O lPi~iSyntax:puts (string)Parameters:string is a constant string or a character array (null-terminated)Returns:undefinedFunction:Sends each character in the string out the RS232 pin using PUTC(). After the string is sent a RETURN (13) and LINE-FEED (10) are sent.In general printf() is more useful than puts().Availability:All devicesRequires:#use rs232Examples:yN + &iiputs( " ----------- " );puts( " | HI | " );puts( " ----------- " );~ ? <~ G ^xPi~i VrExample Files:NoneAlso See:printf(), gets() ; 1e  6 READ_ADC()8  * $i READ_ADC()  9 @Pi~iSyntax:value = read_adc()Parameters:NoneReturns:Either a 8 or 16 bit int depending on #DEVICE ADC= directive.Function:This function will read the digital value from the analog to digital converter. Calls to setup_adc(), setup_adc_ports() and set_adc_channel() should be made sometime before this function is called. The range of the return value depends on number of bits in the chips A/D converter and the setting in the #DEVICE ADC= directive as follows:)  #R ii"i2iBi#DEVCE8 bit10 bit11 bit16 bit$  #H iii,i:iADC=800-FF00-FF00-FF00-FF ! #2 iii&i,iADC=10x0-3FFxx  #2 iiii,iADC=11xx0-7FFx)! s #R ii"i2iBiADC=160-FF000-FFC00-FFEO0-FFFFK  . ,:Pi~iNote: x is not definedns ` 4 8Pi~iAvailability:This function is only available on devices with A/D hardware.Requires:NothingExamples: X 4 6iisetup_adc( ADC_CLOCK_INTERNAL );setup_adc_ports( ALL_ANALOG );set_adc_channel(1);while ( input(PIN_B0) ) {delay_ms( 5000 );value = read_adc();printf("A/D value = %2x\n\r", value);}` 6 _ Pi~iiifin = read_calibration(16);d6[A B . ,lPi~iExample Files:ex_14kad.c with 14kcal.cAlso See:?A FB 1: /FB B E READ_EEPROM( )<B B * $$i READ_EEPROM( )MFB "D S tPi~iSyntax:value = read_eeprom (address)Parameters:address is an 8 bit intReturns:An 8 bit intFunction:Reads a byte from the specified data EEPROM address. The address begins at 0 and the range depends on the part. Availability:This command is only for parts with built-in EEPROMS.Requires:NothingExamples:i?B D * $~ii#define LAST_VOLUME 10volume = read_EEPROM (LAST_VOLUME);w<"D E ; FxPi~ibtExample Files:ex_intee.cAlso See:write_eeprom() HD JE 1%UhJE E H READ_PROGRAM_EEPROM ( )EE E * $6i READ_PROGRAM_EEPROM ( )IJE .G V zPi~iSyntax:value = read_program_eeprom (address)Parameters:address is 16 bits on PCM parts and 32 bits on PCH parts,Returns:16 bits on PCM parts and 8 bits on PCH parts.Function:Reads data from the program memory.Availability:Only devices that allow reads from program memory.Requires:NothingExamples:pE G - *iichecksum = 0;for(i=0;i<8196;i++)checksum^=read_program_eeprom(i);printf("Checksum is %2X\r\n",checksum);e.G H S vPi~icڀbt7Example Files:NoneAlso See:write_program_eeprom(), write_eeprom(), read_eeprom() < G H 1B/H H K RESET_CPU()9H H * $i RESET_CPU()l+H dJ A PWPi~iSyntax:reset_cpu()Parameters:NoneReturns:This function never returnsFunction:This is a general purpose device reset. It will jump to location 0 on PCB and PCM parts and also reset the registers to power-up state on the PIC18.Availability:All devices.Requires:NothingExamples:L!H J + &Biiif(checksum!=0)reset_cpu();Y*dJ K / .TPi~iExample Files:NoneAlso See:Nothing@J IK 1hIK K O RESTART_CAUSE()= K K * $&i RESTART_CAUSE()"IK M ? LPi~iSyntax:value = restart_cause()Parameters:NoneReturns:A value indicating the cause of the last processor reset. The actual values are device dependent. See the device .h file for specific values for a specific device. Some example values are: WDT_FROM_SLEEP WDT_TIMEOUT, MCLR_FROM_SLEEP and NORMAL_POWER_UP.Function:This function will return the reason for the last processor reset.Availability:All devicesRequires:Constants are defined in the devices .h file.8 K M + &Pi~iExamples:^M oN 1 2iiswitch ( restart_cause() ) {case WDT_FROM_SLEEP: case WDT_TIMEOUT:handle_error();}JM O G ^Pi~i8[Example Files:ex_wdt.cAlso See:restart_wdt(), reset_cpu() > oN >O 1>O yO RESTART_WDT();O yO * $"i RESTART_WDT()>O ? LPi~iSyntax:restart_wdt()Parameters:NoneReturns:undefinedFunctionyO O :Restarts the watchdog timer. If the watchdog timer is enabled, this must be called periodically to prevent the processor from resetting. The watchdog timer is used to cause a hardware reset if the software appears to be stuck.The timer must be enabled, the timeout time set and software must periodically restart the timer. These are done differently on the PCB/PCM and PCH parts as follows:~yO  l#$ iiiPCB/PCMPCH& ^#L i"i2iEnable/Disable#fusessetup_wdt()$ $ ^#H ii8iTimeout timesetup_wdt()#fuses( ^#P ii2irestartrestart_wdt()restart_wdt()o;$  4 8vPi~iAvailability:All devicesRequires:#fusesExamples: 4 6yii#fuses WDT // PCB/PCM example // See setup_wdt for a PIC18 examplemain() { setup_wdt(WDT_2304MS); while (TRUE) { restart_wdt(); perform_activity(); }}C G ^Pi~iiǒv3KOExample Files:ex_wdt.cAlso See:#fuses, setup_wdt() ? ҅ 1H҅  % ROTATE_LEFT( )<  * $$i ROTATE_LEFT( ) ҅  Y ePi~iSyntax:rotate_left (address, bytes)Parameters:address is a pointer to memory, bytes is a count of the number of bytes to work with.Returns:undefinedFunction:Rotates a bit through an array or structure. The address may be an array identifier or an address to a byte or structure (such as &data). Bit 0 of the lowest BYTE in RAM is considered the LSB.Availability:All devices.Requires:NothingExamples:^3 w + &fiix = 0x86;rotate_left( &x, 1);// x is now 0x0d[ % S vPi~izD* ^FExample Files:NoneAlso See:rotate_right(), shift_left(), shift_right() @w e 1e o ROTATE_RIGHT( )=% * $&i ROTATE_RIGHT( ) e Y ePi~iSyntax:rotate_right (address, bytes)Parameters:address is a pointer to memory, bytes is a count of the number of bytes to work with.Returns:undefinedFunction:Rotates a bit through an array or structure. The address may be an array identifier or an address to a byte or structure (such as &data). Bit 0 of the lowest BYTE in RAM is considered the LSB.Availability:All devicesRequires:NothingExamples: 3 4iistruct { int cell_1 : 4;int cell_2 : 4;int cell_3 : 4;int cell_4 : 4; } cells;rotate_right( &cells, 2);rotate_right( &cells, 2);rotate_right( &cells, 2);rotate_right( &cells, 2);// cell_1->4, 2->1, 3->2 and 4-> 3[ o S vPi~izD* ^FExample Files:NoneAlso See:rotate_right(), shift_left(), shift_right() C 1t  SET_ADC_CHANNEL( )@o * $,i SET_ADC_CHANNEL( )k& i E XMPi~iSyntax:set_adc_channel (chan)Parameters:chan is the channel number to select. Channel numbers start at 0 and are labeled in the data sheet AN0, AN1...Returns:undefinedFunction:Specifies the channel to use for the next READ_ADC call. Be aware that you must wait a short time after changing the channel before you can get a valid read. The time varies depending on the impedance of the input source. In general 10us is good for most appli i o cations. You need not change the channel before every read if the channel does not change.m  1 2Pi~iAvailability:This function is only available on devices with A/D hardware.Requires:NothingExamples:d9i k + &riiset_adc_channel(2);delay_us(10);value = read_adc();_  S vPi~i1I # 1qS r  SET_TRIS_A( )N r 1 2i  SET_TRIS_A( )SET_TRIS_B( ) SET_TRIS_C( ) SET_TRIS_D( ) SET_TRIS_E( )   e APi~iSyntax:set_tris_a (value)set_tris_b (value)set_tris_c (value)set_tris_d (value)set_tris_e (value)Parameters:value is a 8 bit int with each bit representing a bit of the I/O port.Returns:undefinedFunction:These functions allow the I/O port direction (TRI-State) registers to be set. This must be used with FAST_IO and when I/O ports are accessed as memory such as when a #BYTE directive is used to access an I/O port. Using the default standard I/O the built in functions set the I/O direction automatically.r r  8 >Pi~iEach bit in the value represents one pin. A 1 indicates the pin is input and a 0 indicates it is output.Availability:All devices (however not all devices have all I/O ports)Requires:NothingExamples:{N  - *iiSET_TRIS_B( 0x0F );// B7,B6,B5,B4 are outputs// B3,B2,B1,B0 are inputs_0  / .`Pi~iExample Files:lcd.cAlso See:#USE xxxx_IOA 4 14 r  SET_UART_SPEED()> r * $(i SET_UART_SPEED()_4 $ S tPi~iSyntax:set_uart_speed (baud)Parameters:baud is a constant 100-115200 representing the number of bits per second.Returns:undefinedFunction:Changes the baud rate of the built-in hardware RS232 serial port at run-time. Availability:This function is only available on devices with a built in UART.Requires:#use rs232Examples:1r U 6 :ii// Set baud rate based on setting// of pins B0 and B1switch( input_b() & 3 ) {case 0 : set_uart_speed(2400); break;case 1 : set_uart_speed(4800); break;case 2 : set_uart_speed(9600); break;case 3 : set_uart_speed(19200); break;}N$  S vPi~i䃮'Example Files:loader.cAlso See:#USE RS232, putc(), getc() @U 6 1SH6 s SETUP_ADC(mode)= s * $&i SETUP_ADC(mode)6 z ? LPi~iSyntax:setup_adc (mode);Parameters:mode- Analog to digital mode. The valid options varies depending on the device. See the devices .h file for all options. Some typical options includem@s  - *P:ANALOG_RA3_REF - All analog and RA3 is the referencej=z Q - *zP:RA0_RA1_RA3_ANALOG - Just RA0, RA1 and RA3 are analog k < FPi~iReturns:undefinedFunction:Configures the analog to digital converter.Availability:Only the devices with built in analog to digital converter.Requires:Constants are defined in the devices .h file.Examples:Q  . *iisetup_adc_ports( ALL_ANALOG );setup_adc(ADC_CLOCK_INTERNAL );set_adc_channel( 0 );value = read_adc();setup_adc( ADC_OFF );k ` Pi~ij\# Yʀ1I:ՀExample Files:ex_admm.cSee Also:setup_adc_ports, set_adc_channel, read_adc, #device. The device .h file.C ? 1h_?  @ SETUP_ADC_PORTS( )@  * $,i SETUP_ADC_PORTS( )? K dPi~iSyntax:setup_adc_ports (value)Parameters:value - a constant defined in the devices .h fileReturns:undefinedFunction:Sets up the ADC pins to be analog, digital or a combination. The allowed combinations vary depending on the chip. The constants used are different for each chip as well. Check the device include file for a complete list. The constants ALL_ANALOG and NO_ANALOGS are valid for all chips. Some other example constants: W 2 2'Pi~iAvailability:This function is only available on devices with A/D hardware.Requires:Constants are defined in the devices .h file.Examples:i @ 5 8ii// All pins analog (that can be)setup_adc_ports( ALL_ANALOG );// Pins A0, A1 and A3 are analog and all others // are digital. The +5v is used as a reference.setup_adc_ports( RA0_RA1_RA3_ANALOG );// Pins A0 and A1 are analog. Pin RA3 is used // for the reference voltage and all other pins // are digital.setup_adc_ports( A0_RA1_ANALOGRA3_REF );W @ _W @ S vPi~i @ @ 1E H$@ KA _J SETUP_CCP1( )O!@ KA . ,Bi  SETUP_CCP1( )SETUP_CCP2( ) @ FB O lYPi~iSyntax:setup_ccp1 (mode)setup_ccp2 (mode)Parameters:mode is a constant. Valid constants are in the devices .h file and are as follows:Disable the CCP:: KA B - *P:CCP_OFFMFB B / .<Pi~iSet CCP to capture mode:\.B )C . ,\P:CCP_CAPTURE_FE, Capture on falling edgeZ,B C . ,XP:CCP_CAPTURE_RE,Capture on rising edge^0)C C . ,`P:CCP_CAPTURE_DIV_4, Capture after 4 pulses_1C @D . ,bP:CCP_CAPTURE_DIV_16,Capture after 16 pulsesLC D / .:PՁiSet CCP to compare mode:d6@D D . ,lP:CCP_COMPARE_SET_ON_MATCH,Output high on comparec5D SE . ,jP:CCP_COMPARE_CLR_ON_MATCH,Output low on compare[-D E . ,ZP:CCP_COMPARE_INT, Interrupt on compared6SE F . ,lP:CCP_COMPARE_RESET_TIMER, Reset timer on compareIE [F / .4Pi~iSet CCP to PWM mode:Y+F F . ,VP:CCP_PWM Enable Pulse Width Modulator[F H 3 4Pi~iReturns:undefinedFunction:Initialize the CCP. The CCP counters may be accessed using the long variables CCP_1 and CCP_2. The CCP operates in 3 modes. In capture mode it will copy the timer 1 count value to CCP_x when the input pin event occurs. In compare mode it will trigger an action when timer 1 and CCP_x are equal. In PWM mode it will generate a square wave. The PCW wizard will help to set the correct mode and timer settings for a particular application.F I 2 2'Pi~iAvailability:This function is only available on devices with CCP hardware.Requires:Constants are defined in the devices .h file.Examples:HH I ) ">iisetup_ccp1(CCP_CAPTURE_RE);SI _J ; FPi~iK{Example Files:ex_pwm.c, ex_ccpmp.c, ex_ccp1s.cAlso See:set_pwmX_duty() DI J 1_,J J g SETUP_COMPARATOR( )A_J J * $.i SETUP_COMPARATOR( )J K ? LPi~iSyntax:setup_comparator (mode)Parameters:mode is a constant. Valid constants are in the devices .h file and are as follows:>J K - *"P:A0_A3_A1_A2>K (L - *"P:A0_A2_A1_A2>K fL - *"P:NC_NC_A1_A2>(L L - *"P:NC_NC_NC_NC>fL L - *"P:A0_VR_A1_VR>L M - *"P:A3_VR_A2_VRKL kM - *<P:A0_A2_A1_A2_OUT_ON_A3_A4> M M - *"P:A3_A2_A1_A2k0kM O ; DaPi~iReturns:undefinedFunction:Sets the analog comparator module. The above constants have four parts representing the inputs: C1-, C1+, C2-, C2+Availability:This function is only available on devices with an analog comparator.Requires:Constants are defined in the devices .h file.Examples:M - (Kii// Sets up two independent comparators (C1 and C2), // C1 uses A0 and A3 as inputs (- and +), and C2 // uses A1 and A2 as inputssetup_comparator(A0_A3_A1_A2);O _J [,O g / .XPi~iExample Files:ex_comp.cAlso See:NoneB 1$u I SETUP_COUNTERS( )?g * $*i SETUP_COUNTERS( )9 ! V zPi~iSyntax:setup_counters (rtcc_state, ps_state)Parameters:rtcc_state may be one of the constants defined in the devices .h file. For example: RTCC_INTERNAL, RTCC_EXT_L_TO_H or RTCC_EXT_H_TO_Lps_state may be one of the constants defined in the devices .h file.For example: RTCC_DIV_2, RTCC_DIV_4, RTCC_DIV_8, RTCC_DIV_16, RTCC_DIV_32, RTCC_DIV_64, RTCC_DIV_128, RTCC_DIV_256, WDT_18MS, WDT_36MS, WDT_72MS, WDT_144MS, WDT_288MS, WDT_576MS, WDT_1152MS, WDT_2304MSi 6 :Pi~iReturns:undefinedFunction:Sets up the RTCC or WDT. The rtcc_state determines what drives the RTCC. The PS state sets a prescaler for either the RTCC or WDT. The prescaler will lengthen the cycle of the indicated counter. If the RTCC prescaler is set the WDT will be set to WDT_18MS. If the WDT prescaler is set the RTCC is set to RTCC_DIV_1. This function is provided for compatibility with older versions. setup_timer_0 and setup_WDT are the recommended replacements when possible. For PCB devices if an external RTCC clock is used and a WDT prescaler is used then this function must be used.a! R 1 2Pi~iAvailability:All devicesRequires:Constants are defined in the devices .h file.Examples:X/ ) "^iisetup_counters (RTCC_INTERNAL, WDT_2304MS);XR I G ^Pi~i3KOt5Example Files:NoneAlso See:setup_wdt(), setup_timer_0(), devices .h file= 1r,  SETUP_LCD( ):I * $ i SETUP_LCD( )/ ^ Pi~iSyntax:setup_lcd (mode, prescale, segments);Parameters:Mode may be one of these constants from the devices .h file:LCD_DISABLED, LCD_STATIC, LCD_MUX12,LCD_MUX13, LCD_MUX14The following may be or'ed (via |) with any of the above:STOP_ON_SLEEP, USE_TIMER_1Prescale may be 0-15 for the LCD clock segments may be any of the following constants or'ed together: SEGO_4, SEG5_8, SEG9_11, SEG12_15, SEG16_19, SEGO_28, SEG29_31, ALL_LCD_PINS 9 @Pi~iReturns:undefinedFunction:This function is used to initialize the 923/924 LCD controller. Availability:Only devices with built in LCD drive hardware.Requires:Constants are defined in the devices .h file.Examples:c8 p + &piisetup_lcd(LCD_MUX14|STOP_ON_SLEEP,2,ALL_LCD_PINS);J  G ^Pi~i\6"&Example Files:ex_92lcd.cAlso See:lcd_symbol(), lcd_load() = p > 1u> x SETUP_PSP( ): x * $ i SETUP_PSP( )y;> > LvPi~iSyntax:setup_psp (mode)Parameters:mode may be:>x / - *"P:PSP_ENABLED? n - *$P:PSP_DISABLEDi/  < FPi~iReturns:undefinedFunction:Initializes the Parallel Slave Port (PSP). The SET_TRIS_E(value) function may be used to set the data direction. The data may be read and written to using the variable PSP_DATA.Availability:This function is only available on devices with PSP hardware.Requires:Constants are defined in the devices .h file.Examples:Hn [ , (8ii setup_psp(PSP_ENABLED);y: ? NtPi~i61Example Files:ex_psp.cAlso See:set_tris_e() [  = [ I 1I : SETUP_SPI( ): * $ i SETUP_SPI( )z<I > LxPi~iSyntax:setup_spi (mode)Parameters:modes may be:Y, V - *XP:SPI_MASTER, SPI_SLAVE, SPI_SS_DISABLEDI - *8P:SPI_L_TO_H, SPI_H_TO_LQ$V - *HP:SPI_CLK_DIV_4, SPI_CLK_DIV_16,M = - *@P:SPI_CLK_DIV_64, SPI_CLK_T2j= - *zP:Constants from each group may be or'ed together with |.<= & C TyPi~iReturns:undefinedFunction:Initializes the Serial Port Interface (SPI). This is used for 2 or 3 wire serial devices that follow a common clock/data protocol.Availability:This function is only available on devices with SPI hardware.Requires:Constants are defined in the devices .h file.Examples:d9 + &riisetup_spi(spi_master |spi_l_to_h |spi_clk_div_16 );]& : S vPi~iWxC"Example Files:ex_spi.cAlso See:spi_write(), spi_read(), spi_data_is_in() B | 1| s SETUP_TIMER_0 ( )?: * $*i SETUP_TIMER_0 ( )| P nPi~iSyntax:setup_timer_0 (mode)Parameters:mode may be one or two of the constants defined in the devices .h file. RTCC_INTERNAL, RTCC_EXT_L_TO_H or RTCC_EXT_H_TO_L RTCC_DIV_2, RTCC_DIV_4, RTCC_DIV_8, RTCC_DIV_16, RTCC_DIV_32, RTCC_DIV_64, RTCC_DIV_128, RTCC_DIV_256PIC18 only: RTCC_OFF, RTCC_8_BITOne constant may be used from each group or'ed together with the | operator.Returns:undefinedFunction:Sets up the timer 0 (aka RTCC).b g 1 2Pi~iAvailability:All devices.Requires:Constants are defined in the devices .h file.Examples:X/ ) "^iisetup_timer_0 (RTCC_DIV_2|RTCC_EXT_L_TO_H);ag s S vPi~i.8O6Example Files:ex_stwt.cAlso See:get_timer0(), set_timer0(), setup_counters() A 136 SETUP_TIMER_1( )>s * $(i SETUP_TIMER_1( )F v > LPi~iSyntax:setup_timer_1 (mode)Parameters:mode values may be:k= . ,zP:T1_DISABLED,T1_INTERNAL, T1_EXTERNAL, T1_EXTERNAL_SYNC=v  - * P:T1_CLK_OUTe8 - *pP:T1_DIV_BY_1, T1_DIV_BY_2, T1_DIV_BY_4, T1_DIV_BY_8pC - *P:constants from different groups may be or'ed together with |. > JQPi~iReturns:undefinedFunction:Initializes timer 1. The timer value may be read and written to using SET_TIMER1() and GET_TIMER1(). Timer 1 is a 16 bit timer. With an internal clock at 20mhz, the timer will increment every 1.6us. It will overflow every 104.8576ms.Availability:This function is only available on devices with timer 1 hardware.Requires:Constants are defined in the devices .h file.Examples:| + &iisetup_timer_1 ( T1_DISABLED );setup_timer_1 ( T1_INTERNAL | T1_DIV_BY_4 );setup_timer_1 ( T1_INTERVAL | T1_DIV_BY_8 );t9 ; FrPi~i.Example Files:ex_patg.cAlso See:get_timer1(),A 5 1t~5 s  SETUP_TIMER_2( )> s * $(i SETUP_TIMER_2( )]5 & J dPi~iSyntax:setup_timer_2 (mode, period, postscale)Parameters & s:mode may be one of:f9s - *rP:T2_DISABLED, T2_DIV_BY_1, T2_DIV_BY_4, T2_DIV_BY_16&  K dPi~iperiod is a int 0-255 that determines when the clock value is reset, postscale is a number 1-16 that determines how many timer resets before an interrupt: (1 means one reset, 2 means 2, and so on).Returns:undefinedFunction:Initializes timer 2. The mode specifies the clock divisor (from the oscillator clock). The timer value may be read and written to using GET_TIMER2() and SET_TIMER2(). Timer 2 is a 8 bit counter/timer. d 2 2/Pi~iAvailability:This function is only available on devices with timer 2 hardware.Requires:Constants are defined in the devices .h file.Examples: 1 - (Aiisetup_timer_2 ( T2_DIV_BY_4, 0xc0, 2);// At 20mhz, the timer will include every 800ns,// will overflow every 153.6us,// and will interrupt every 460.3us.Jd  G ^Pi~i.t5Example Files:ex_pwm.cAlso See:get_timer2(), set_timer2() A1  1.6x A > SETUP_TIMER_3( )> A * $(i SETUP_TIMER_3( )  ? L Pi~iSyntax:setup_timer_3 (mode)Parameters:Mode may be one of the following constants from each group or'ed (via |) together:tA  - *P:T3_DISABLED, T3_INTERNAL, T3_EXTERNAL, T3_EXTERNAL_SYNC, T3_DIV_BY_1, T3_DIV_BY_2, T3_DIV_BY_4, T3_DIV_BY_8 y Z ; DPi~iReturns:undefinedFunction:Initializes timer 3. The mode specifies the clock divisor (from the oscillator clock). The timer value may be read and written to using GET_TIMER3() and SET_TIMER3(). Timer 3 is a 16 bit counter/timer.Availability:This function is only available on PIC18 devices.Requires:Constants are defined in the devices .h file.Examples:W.  ) "\iisetup_timer_3 (T3_INTERNAL | T3_DIV_BY_2);FZ > G ^Pi~i.t5Example Files:NoneAlso See:get_timer3(), set_timer3() >  | 1X~ | SETUP_VREF( );> * $"i SETUP_VREF( )e| ` D XPi~iSyntax:setup_vref (mode | value)Parameters:mode may be one of the following constants:A / .$P:FALSE(off)N ` . ,@P:VREF_LOW for VDD*VALUE/24V( E . ,PP:VREF_HIGHfor VDD*VALUE/32 + VDD/4Q$ - *HP:any may be or'ed with VREF_A2.AE  A PPi~ivalue is an int 0-15.Returns:undefinedFunction:Establishes the voltage of the internal reference that may be used for analog compares and/or for output on pin A2.Availability:This function is only available on devices with VREF hardware.Requires:Constants are defined in the devices .h file.Examples:kA * $iisetup_vref (VREF_HIGH | 6);// At VDD=5, the voltage is 2.19V[, / .XPi~iExample Files:ex_comp.cAlso See:None>  1x W D SETUP_WDT ( ); W * $"i SETUP_WDT ( )Q @ T vPi~iSyntax:setup_wdt (mode)Parameters:For PCB/PCM parts: WDT_18MS, WDT_36MS, WDT_72MS, WDT_144MS,WDT_288MS, WDT_576MS, WDT_1152MS, WDT_2304MSFor PIC18 parts: WDT_ON, WDT_OFFReturns:undefinedFunction:Sets up the watchdog timer. The watchdog timer is used to cause a hardware reset if the software appears to be stuck.W @ The timer must be enabled, the timeout time set and software must periodically restart the timer. These are done differently on the PCB/PCM and PCH parts as follows:~W 2A l#$ iiiPCB/PCMPCH&@ A ^#L i"i2iEnable/Disable#fusessetup_wdt()$2A 8B ^#H ii8iTimeout timesetup_wdt()#fuses(A B ^#P ii2irestartrestart_wdt()restart_wdt()j8B \C 4 8Pi~iAvailability:All devicesRequires:#fuses, Constants are defined in the devices .h file.Examples:B ND 4 6}ii#fuses WDT_18MS // PIC18 example, See // restart_wdt for a PIC18 examplemain() { setup_wdt(WDT_ON); while (TRUE) { restart_wdt(); perform_activity(); }}E\C D G ^Pi~iiǒv8Example Files:ex_wdt.cAlso See:#fuses, restart_wdt() > ND E 1 _E SE I SHIFT_LEFT( );D SE * $"i SHIFT_LEFT( ) E ^G ] ]Pi~iSyntax:shift_left (address, bytes, value)Parameters:address is a pointer to memory, bytes is a count of the number of bytes to work with, value is a 0 to 1 to be shifted in.Returns:0 or 1 for the bit shifted outFunction:Shifts a bit into an array or structure. The address may be an array identifier or an address to a structure (such as &data). Bit 0 of the lowest byte in RAM is treated as the LSB.p<SE G 4 8xPi~iAvailability:All devicesRequires:NothingExamples:6^G I 8 >iibyte buffer[3];for(i=0; i<=24; ++i){// Wait for clock highwhile (!input(PIN_A2));shift_left(buffer,3,input(PIN_A3));// Wait for clock lowwhile (input(PIN_A2));}// reads 24 bits from pin A3,each bit is read // on a low to high on pin A2 uG I S vPi~iFzD㍤=Example Files:ex_extee.c with 9356.cAlso See:shift_right(), rotate_right(), rotate_left(), <<, >>?I J 1< J GJ 4O SHIFT_RIGHT( )<I GJ * $$i SHIFT_RIGHT( ) J VL _ aPi~iSyntax:shift_right (address, bytes, value)Parameters:address is a pointer to memory, bytes is a count of the numberof bytes to work with, value is a 0 to 1 to be shifted in.Returns:0 or 1 for the bit shifted outFunction:Shifts a bit into an array or structure. The address may be an array identifier or an address to a structure (such as &data). Bit 0 of the lowest byte in RAM is treated as the LSB.l;GJ L 1 2vPi~iAvailability:All devicesRequires:NothingExamples:lVL mN ? Lii// reads 16 bits from pin A1, each bit is read // on a low to high on pin A2 struct {byte time;byte command : 4;byte source : 4;} msg;for(i=0; i<=16; ++i) {while(!input(PIN_A2));shift_right(&msg,3,input(PIN_A1));while (input(PIN_A2)) ;}// This shifts 8 bits out PIN_A0, LSB first.for(i=0;i<8;++i)output_bit(PIN_A0,shift_right(&data,1,0));tL 4O S vPi~i* ^zD㍤=Example Files:ex_extee.c with 9356.cAlso See:shift_left(), rotate_right(), rotate_left(), <<, >>8mN lO 1_'lO O SIN ( )_-4O O 2 4Zi  SIN ( )COS()TAN()ASIN()ACOS()ATAN()"lO u [Pi~iO 4O Syntax:val = sin (rad)val = cos (rad)val = tan (rad)rad = asin (val)rad = acos (val)rad = atan (val)Parameters:rad is a float representing an angle in Radians -2pi to 2pi. val is a float with the range -1.0 to 1.0Returns:rad is a float representing an angle in Radians -pi/2 to pi/2val is a float with the range -1.0 to 1.0Function:These functions perform basic Triga metric functions.~MO w 1 2Pi~iAvailability:All devices.Requires:math.h must be included.Examples:y  - *iifloat phase;// Output one sine wavefor(phase=0; phase<2*3.141596; phase+=0.01)set_analog_voltage( sin(phase)+1 );aw k Pi~i}ㅞ|Lj+Example Files:ex_tank.cAlso See:log(), log10(), exp(), pow(), sqrt() 8 ! 1<H! V  SLEEP()5 V * $i SLEEP()! h A PPi~iSyntax:sleep()Parameters:NoneReturns:undefinedFunction:Issues a SLEEP instruction. Details are device dependent however in general the part will enter low power mode and halt program execution until woken by specific external events. Depending on the cause of the wake up execution may continue after the sleep instruction. The compiler inserts a sleep() after the last statement in main().Availability:All devicesRequires:NothingExamples:5 V ) "iiSLEEP();t9h  ; FrPi~i[Example Files:ex_wakup.cAlso See:reset_cpu() A R 1'R SPI_DATA_IS_IN()> * $(i SPI_DATA_IS_IN()ER Ո A P Pi~iSyntax:result = spi_data_is_in()Parameters:None Returns:0 (FALSE) or 1 (TRUE)Function:Returns TRUE if data has been received over the SPI.Availability:This function is only available on devices with SPI hardware.Requires:NothingExamples:\ ] , (iiwhile( !spi_data_is_in() && input(PIN_B2) ) ;if( spi_data_is_in() )data = spi_read();CՈ G ^Pi~iWxExample Files:NoneAlso See:spi_read(), spi_write() ; ] " 1H" Z  SPI_READ()8 Z * $i SPI_READ()?" N jPi~iSyntax:value = spi_read (data)Parameters:data is optional and if included is an 8 bit int.Returns:An 8 bit intFunction:Return a value read by the SPI. If a value is passed to SPI_READ the data will be clocked out and the data received will be returned. If no data is ready, SPI_READ will wait for the data. If this device supplies the clock then either do a SPI_WRITE(data) followed by a SPI_READ() or do a SPI_READ(data). These both do the same thing and will generate a clock. If there is no data to send just do a SPI_READ(0) to get the clock.FZ - 8 >Pi~iIf this the other device supplies the clock then either call SPI_READ() to wait for the clock and data or use SPI_DATA_IS_IN() to determine if data is ready.Availability:This function is only available on devices with SPI hardware.Requires:NothingExamples:P# } - *Fii in_data = spi_read(out_data);M-  G ^Pi~iC"WxExample Files:ex_spi.cAlso See:spi_data_is_in(), spi_write() = } N 1}N ( SPI_WRITE( ): * $ i SPI_WRITE( )SN : S tPi~iSyntax:SPI_WRITE (value)Param :  eters:value is an 8 bit intReturns:NothingFunction:Sends a byte out the SPI interface. This will cause 8 clocks to be generated. This function will write the value out to the SPI. Availability:This function is only available on devices with SPI hardware.Requires:NothingExamples:[1 * $biispi_write( data_out ); data_in = spi_read();L: ( G ^Pi~iC"Example Files:ex_spi.cAlso See:spi_read(), spi_data_is_in() 8 ` 1I` SQRT( )5 ( * $i SQRT( )j` T v-Pi~iSyntax:result = sqrt (value)Parameters:value is a floatReturns:A floatFunction:Computes the non-negative square root of the float x. If the argument is negative, the behavior is undefined.Availability:All devicesRequires:#include Examples:X/ W ) "^iidistance = sqrt( sqr(x1-x2) + sqr(y1-y2) );V' / .NPi~iExample Files:NoneAlso See:NoneJW 1A}M STANDARD STRING FUNCTIONS ; D3i  STANDARD STRING FUNCTIONSSTRCAT()STRCHR()STRRCHR()STRCMP()STRNCMP()STRICMP()STRNCPY()STRCSPN()STRSPN()STRLEN()STRLWR()STRPBRK()STRSTR()/ , (Pi~i, & Pi~iSyntax:ptr=strcat (s1, s2)Concatenate s2 onto s1ptr=strchr (s1, c)Find c in s1 and return &s1[i]ptr=strrchr (s1, c)Same but search in reversecresult=strcmp (s1, s2)Compare s1 to s2iresult=strncmp (s1, s2, n)Compare s1 to s2 (n bytes)iresult=stricmp (s1, s2)Compare and ignore caseptr=strncpy (s1, s2, n)Copy up to n characters s2->s1] z €Pi~iiresult=strcspn (s1, s2)Count of initial chars in s1 not in s2iresult=strspn (s1, s2)Count of initial chars in s1 also in s2iresult=strlen (s1)Number of characters in s1ptr=strlwr (s1)Convert string to lower caseptr=strpbrk (s1, s2)Search s1 for first char also in s2ptr=strstr (s1, s2)Search for s2 in s1&  a uPi~iParameters:s1 and s2 are pointers to an array of characters (or the name of an array). Note that s1 and s2 MAY NOT BE A CONSTANT (like "hi").n is a count of the maximum number of character to operate on.c is a 8 bit characterReturns:ptr is a copy of the s1 pointeriresult is an 8 bit intresult is -1 (less than), 0 (equal) or 1 (greater than)Function:Functions are identified above.Availability:All devicesZ, r . ,XPi~iRequires:#include Examples: R 3 4[iichar string1[10], string2[10];strcpy(string1,"hi ");strcpy(string2,"there");strcat(string1,string2);printf("Length is %u\r\n", strlen(string1) );// Will print 8Br G ^Pi~i.:OD/:Example Files:ex_str.cAlso See:strcpy(), strtok() 9R  1\ J 6STRTOK()6 J * $i STRTOK()? T vPi~iSyntax:ptr = strtok(s1, s2)Parameters:s1 and s2 are pointers to an array of characters (or the name of an array). Note that s1 and s2 MAY NOT BE A CONSTANT (like "hi"). s1 may be 0 to indicate a continue operation.Returns:ptr points to a character in s1 or is 0Function:Finds next token in s1 delimited by a character from separatorJ  string s2 (which can be different from call to call), and returns pointer to it.First call starts at beginning of s1 searching for the first character NOT contained in s2 and returns null if there is none are found.1J 6 :Pi~iIf none are found, it is the start of first token (return value). Function then searches from there for a character contained in s2.If none are found, current token extends to the end of s1, and subsequent searches for a token will return null. If one is found, it is overwritten by '\0', which terminates current token. Function saves pointer to following character from which next search will start.Each subsequent call, with 0 as first argument, starts searching from the saved pointer.xG1 2Pi~iAvailability:All devicesRequires:#include Examples:C Tiichar string[30], term[3], *ptr;strcpy(string,"one,two,three;");strcpy(term,",;");ptr = strtok(string, term);while(ptr!=0) {puts(ptr);ptr = strtok(0, term);}// Prints: one two threeC6G ^Pi~i?4 .:Example Files:ex_str.cAlso See:strxxxx(), strcpy() : p1MfpiSTRCPY( )7 6* $i STRCPY( )kpm[ Pi~iSyntax:strcpy (dest, src)Parameters:dest is a pointer to a RAM array of characters.src may be either a pointer to a RAM array of characters or it may be a constant string. Returns:undefinedFunction:Copies a constant or RAM string to a RAM string. Strings are terminated with a 0.Availability:All devices.Requires:NothingExamples:]/ .iichar string[10], string2[10];...strcpy (string, "Hi There");strcpy(string2,string);p5mi; FjPi~i?4 Example Files:ex_str.cAlso See:strxxxx() 81 \3 SWAP( )5 i* $i SWAP( )@ K dPi~iSyntax:swap (lvalue)Parameters:lvalue is a byte variable Returns:undefined - WARNING: this function does not return the resultFunction:Swaps the upper nibble with the lower nibble of the specified byte. This is the same as:L$b ( Hiibyte = (byte << 4) | (byte >> 4);p<  4 8xPi~iAvailability:All devicesRequires:NothingExamples:O$b ! + &Hiix=0x45;swap(x);//x now is 0x54I  G ^Pi~izD㍤=Example Files:NoneAlso See:rotate_right(), rotate_left() 7!  1fR  m TAN( )4  * $i TAN( )Q m < H*Pi~iSee:sin() ;   13+  f@TOLOWER( )Im  . ,6i  TOLOWER( )TOUPPER( )  \ mPi~iSyntax:result = tolower (cvalue)result = toupper (cvalue)Parameters:cvalue is a characterReturns:A 8 bit characterFunction:These functions change the case of letters in the alphabet.TOLOWER(X) will return 'a'..'z' for X in 'A'..'Z' and all other characters are unchanged. TOUPPER(X) will return 'A'..'Z' for X in 'a'..'z' and all other characters are unchanged.Availability:All devices.Requires:Nothing8 ;+ &Pi~iExamples: @1 0iiswitch( toupper(getc()) ) {case 'R' : read_cmd(); break;case 'W' : write_cmd(); break;case 'Q' : done=TRUE; break;}; @m Z+;f@/ .VPi~iExample Files:ex_str.cAlso See:None> @@1{R@@)FWRITE_BANK( );f@@* $"i WRITE_BANK( )V@5D] Pi~iSyntax:write_bank (bank, offset, value)Parameters:bank is the physical RAM bank 1-3 (depending on the device), offset is the offset into user RAM for that bank (starts at 0), value is the 8 bit data to writeReturns:undefinedFunction:Write a data byte to the user RAM area of the specified memory bank. This function may be used on some devices where full RAM access by auto variables is not efficient. For example on the PIC16C57 chip setting the pointer size to 5 bits will generate the most efficient ROM code however auto variables can not be above 1Fh. Instead of going to 8 bit pointers you can save ROM by using this function to write to the hard to reach banks. In this case the bank may be 1-3 and the offset may be 0-15. @D2 2%Pi~iAvailability:All devices but only useful on PCB parts with memory over 1Fh and PCM parts with memory over FFh. Requires:NothingExamples:g5DE/ .iii=0; // Uses bank 1 as a RS232 bufferdo {c=getc();write_bank(1,i++,c);} while (c!=0x13);kD)F/ .Pi~iExample Files:ex_psp.cAlso See:See the "Common Questions and Answers" section for more information.@EiF1+"iFF#KWRITE_EEPROM( )=)FF* $&i WRITE_EEPROM( )MiFHT vPi~iSyntax:write_eeprom (address, value)Parameters:address is a 8 bit int, the range is device dependent, value is an 8 bit intReturns:undefinedFunction:Write a byte to the specified data EEPROM address. This function may take several milliseconds to execute. This works only on devices with EEPROM built into the core of the device. For devices with external EEPROM or with a separate EEPROM in the same package (line the 12CE671) see EX_EXTEE.c with CE51X.c, CE61X.c or CE67X.c.|FI1 2Pi~iAvailability:This function is only available on devices with supporting hardware on chip.Requires:NothingExamples:aH-J, (ii#define LAST_VOLUME 10 // Location in EEPROMvolume++;write_eeprom(LAST_VOLUME,volume);I#KV zAPi~i7cڀ|Example Files:ex_intee.cAlso See:read_eeprom(), write_program_eeprom(), read_program_eeprom(),EX_EXTEE.c with CE51X.c, CE61X.c or CE67X.c.I-JlK1KlKKNWRITE_PROGRAM_EEPROM ( )F#KK* $8i WRITE_PROGRAM_EEPROM ( )blKoM[ Pi~iSyntax:write_program_eeprom (address, data)Parameters:address is 16 bits on PCM parts and 32 bits on PCH parts,data is 16 bits on PCM parts and 8 bits on PCH parts.Returns:undefinedFunction:Writes to the specified program EEPROM area.Availability:Only devices that allow writes to program memory.Requires:NothingExamples:`6KM* $liiwrite_program_eeprom(0,0x2800);//disables programuoMNW ~Pi~i|7btExample Files:ex_load.c, loader.cAlso See:read_program_eeprom(), read_eeprom(), write_eeprom() HMN1"eN'OCompiler Error MessagesDN'O* $4Pi~iCOMPILER ERROR MESSAGESHNoO1VKoOObCompiler Error MessagesE'OO* $6i Compiler Error Messages,oOO) "@~i FO2> JO2'Oi#ENDIF with no corresponding #IFA numeric expression must appear here. The indicated item must evaluate to a number.A #DEVICE required before this lineThe compiler requires a #device before it encounters any statement or compiler directive that may cause it to generate code. In general #defines may appear before a #device but not much more.A numeric expression must appear hereSome C expression (like 123, A or B+C) must appear at this spot in the code. Some expression that will evaluate to a value.OB RiArray dimensions must be specifiedThe [] notation is not permitted in the compiler. Specific dimensions must be used. For example A[5].Arrays of bits are not permittedArrays may not be of SHORT INT. Arrays of Records are permitted but the record size is always rounded up to the next byte boundary.Attempt to create a pointer to a constantConstant tables are implemented as functions. Pointers cannot be created to functions. For example CHAR CONST MSG[9]={"HI THERE"}; is permitted, however you cannot use &MSG. You can only reference MSG with subscripts such as MSG[i] and in some function calls such as Printf and STRCPY.2ŇB RiAttributes used may only be applied to a function (INLINE or SEPARATE)An attempt was made to apply #INLINE or #SEPARATE to something other than a function. Bad expression syntaxThis is a generic error message. It covers all incorrect syntax.Baud rate out of rangeThe compiler could not create code for the specified baud rate. If the internal UART is being used the combination of the clock and the UART capabilities could not get a baud rate within 3% of the requested value. If the built in UART is not being used then the clock will not permit the indicated baud rate. For fast baud rates, a faster clock will be required.8EH ^qi#BIT variable not permitted hereAddresses cannot be created to bits. For example &X is not permitted if X is a SHORT INT.Cant change device type this far into the codeThe #DEVICE is not permitted after code is generated that is device specific. Move the #DEVICE to an area before code is generated.Character constant constructed incorrectlyGenerally this is due to too many characters within the single quotes. For example 'ab' is an error as is '\nr'. The backslash is permitted provided the result is a single character such as '\010' or '\n'. ŇPB RiConstant out of the valid rangeThis will usually occur in inline assembly where a constant must be within a particular range and it is not. For example BTFSC 3,9 would cause this error since the second operand must be from 0-8.Constant too large, must be < 65536As it says the constant is too big.Define expansion is too largeA fully expanded DEFINE must be less than 255 characters. Check to be sure the DEFINE is not recursively defined.EiK diDefine syntax errorThis is usually caused by a missing or mis-placed (or) within a define.Different levels of indirectionThis is caused by a INLINE function with a reference parameter being called with a parameter that is not a variable. Usually calling with a constant causes this.Divide by zeroAn attempt was made to divide by zero at compile time using constants.Duplicate case value Two cases in a switch statement have the same value.P29 @ iDuplicate DEFAULT statementsThe DEFAULT statement within a SWITCH may only appear once in each SWITCH. This error indicates a second DEFAULT was encountered.Duplicate #defineThe identifier in the #define has already been used in a previous #define. The redefine an identifier use #UNDEF first. To prevent defines that may be included froi2'Om multiple source do something like:m0i= J`P JiDuplicate functionA function has already been defined with this name. Remember that the compiler is not case sensitive unless a #CASE is used.Duplicate Interrupt ProcedureOnly one function may be attached to each interrupt level. For example the #INT_RB may only appear once in each program.Duplicate USESome USE libraries may only be invoked once since they apply to the entire program such as #USE DELAY. These may not be changed throughout the program.fHK d7iElement is not a memberA field of a record identified by the compiler is not actually in the record. Check the identifier spelling.ELSE with no corresponding IF Check that the {and} match up correctly.End of file while within define definitionThe end of the source file was encountered while still expanding a define. Check for a missing ).End of source file reached without closing comment */ symbolThe end of the source file has been reached and a comment (started with /*) is still in effect. The */ is missing.F+ &6iError in define syntax-H* $Pi~i= HiError text not in fileThe error is a new error not in the error file on your disk. Check to be sure that the errors.txt file you are using came on the same disk as the version of software you are executing. Call CCS with the error number if this does not solve the problem.Expect ;Expect commaExpect WHILEExpect }Expecting :Expecting =Expecting a (Expecting a , or )Expecting a , or }Expecting a .Expecting a ; or ,Expecting a ; or {Expecting a close parenC TiExpecting a declarationExpecting a structure/unionExpecting a variableExpecting a ]Expecting a {Expecting an =Expecting an arrayExpecting an expressionExpecting an identifierExpecting an opcode mnemonicThis must be a Microchip mnemonic such as MOVLW or BTFSC.Expecting LVALUE such as a variable name or * expressionThis error will occur when a constant is used where a variable should be. For example 4=5; will give this error.Expecting a basic typeS> JiExamples of a basic type are INT and CHAR.Expecting procedure nameExpression must be a constant or simple variableThe indicated expression must evaluate to a constant at compile time. For example 5*3+1 is permitted but 5*x+1 where X is a INT is not permitted. If X were a DEFINE that had a constant value then it is permitted.Expression must evaluate to a constantThe indicated expression must evaluate to a constant at compile time. For example 5*3+1 is permitted but 5*x+1 where X is a INT is not permitted. If X were a DEFINE that had a constant value then it is permitted.{@; DiExpression too complexThis expression has generated too much code for the compiler to handle for a single expression. This is very rare but if it happens, break the expression up into smaller parts.Too many assembly lines are being generated for a single C statement. Contact CCS to increase the internal limits.Extra characters on preprocessor command lineCharacters are appearing after a preprocessor directive that do not apply to that directive. Preprocessor commands own the entire line unlike the normal C syntax. For example the following is an error: D Vi#PRAGMA DEVICE main() { int x; x=1;}File in #INCLUDE can not be openedCheck the filename and the current path. The file could not be opened.Filename must start with " o'Or <Filename must terminate with " or >Floating-point numbers not supportedA floating-point number is not permitted in the operation near the error. For example, ++F where F is a float is not allowed.Function definition different from previous definition(: BiThis is a mis-match between a function prototype and a function definition. Be sure that if a #INLINE or #SEPARATE are used that they appear for both the prototype and definition. These directives are treated much like a type specifier.Function used but not definedThe indicated function had a prototype but was never defined in the program.Identifier is already used in this scopeAn attempt was made to define a new identifier that has already been defined./D ViIllegal C character in input fileA bad character is in the source file. Try deleting the line and re-typing it.Improper use of a function identifierFunction identifiers may only be used to call a function. An attempt was made to otherwise reference a function. A function identifier should have a ( after it.Incorrectly constructed labelThis may be an improperly terminated expression followed by a label. For example:x=5+MPLAB:(FB RiInitialization of unions is not permittedStructures can be initialized with an initial value but UNIONS cannot be.Internal compiler limit reachedThe program is using too much of something. An internal compiler limit was reached. Contact CCS and the limit may be able to be expanded.Invalid conversion from LONG INT to INTIn this case, a LONG INT cannot be converted to an INT. You can type cast the LONG INT to perform a truncation. For example: /" 3 4SiI = INT(LI);Internal Error - Contact CCSThis error indicates the compiler detected an internal inconsistency. This is not an error with the source code; although, something in the source code has triggered the internal error. This problem can usually be quickly corrected by sending the source files to CCS so the problem can be re-created and corrected. In the meantime if the error was on a particular line, look for another way to perform the same operation. The error was probably caused by the syntax of the identified statement. If the error was the last line of the code, the problem was in linking. Look at the call tree for something out of the ordinary. F; > JiInvalid parameters to shift functionBuilt-in shift and rotate functions (such as SHIFT_LEFT) require an expression that evaluates to a constant to specify the number of bytes.Invalid ORG rangeThe end address must be greater than or equal to the start address. The range may not overlap another range. The range may not include locations 0-3. If only one address is specified it must match the start address of a previous #org.Invalid Pre-Processor directived" E X?iThe compiler does not know the preprocessor directive. This is the identifier in one of the following two places:#xxxxx#PRAGMA xxxxxLibrary in USE not foundThe identifier after the USE is not one of the pre-defined libraries for the compiler. Check the spelling.LVALUE requiredThis error will occur when a constant is used where a variable should be. For example 4=5; will give this error.Macro identifier requires parametersA #DEFINE identifier is being used but no parameters were specified ,as required. For example:y=; $A< F{i#define min(x,y) ((x may only be used after a pointer to a structure. It cannot be used on a structure itself or other kind of variable.wKOG \iPrintf format type is invalidAn unknown character is after the % in a printf. Check the printf reference for valid formats.Printf format (%) invalidA bad format combination was used. For example, %lc.Printf variable count (%) does not match actual countThe number of % format indicators in the printf does not match the actual number of variables that follow. Remember in order to print a single %, you must use %%.Recursion not permittedMH ^iO'OThe linker will not allow recursive function calls. A function may not call itself and it may not call any other function that will eventually re-call it.Recursively defined structures not permittedA structure may not contain an instance of itself.Reference arrays are not permittedA reference parameter may not refer to an array.Return not allowed in void functionA return statement may not have a value if the function is void.String too long\OEB R5iStructure field name requiredA structure is being used in a place where a field of the structure must appear. Change to the form s.f where s is the structure name and f is a field name.Structures and UNIONS cannot be parameters (use * or &)A structure may not be passed by value. Pass a pointer to the structure using &.Subscript out of rangeA subscript to a RAM array must be at least 1 and not more than 128 elements. Note that large arrays might not fit in a bank. ROM arrays may not occupy more than 256 locations.$iH ^iThis expression cannot evaluate to a numberA numeric result is required here and the expression used will not evaluate to a number.This type cannot be qualified with this qualifierCheck the qualifiers. Be sure to look on previous lines. An example of this error is:VOID X;Too many #DEFINE statementsThe internal compiler limit for the permitted number of defines has been reached. Call CCS to find out if this can be increased.Too many array subscripts?E: B iArrays are limited to 5 dimensions.Too many constant structures to fit into available spaceAvailable space depends on the chip. Some chips only allow constant structures in certain places. Look at the last calling tree to evaluate space usage. Constant structures will appear as functions with a @CONST at the beginning of the name.Too many identifiers have been definedThe internal compiler limit for the permitted number of variables has been reached. Call CCS to find out if this can be increased.iN jiToo many identifiers in programThe internal compiler limit for the permitted number of identifiers has been reached. Call CCS to find out if this can be increased.Too many nested #INCLUDEsNo more than 10 include files may be open at a time.Too many parametersMore parameters have been given to a function than the function was defined with.Too many subscriptsMore subscripts have been given to an array than the array was defined with.AK diType is not definedThe specified type is used but not defined in the program. Check the spelling.Type specification not valid for a functionThis function has a type specifier that is not meaningful to a function.Undefined identifierThe specified identifier is being used but has never been defined. Check the spelling.Undefined label that was used in a GOTOThere was a GOTO LABEL but LABEL was never encountered within the required scope. A GOTO cannot jump outside a function.')B RiUnknown device typeA #DEVICE contained an unknown device. The center letters of a device are always C regardless of the actual part in use. For example, use PIC16C74 not PIC16RC74. Be sure the correct compiler is being used for the indicated device. See #DEVICE for more information.Unknown keyword in #FUSESCheck the keyword spelling against the description under #FUSES. Unknown typeThe specified type is used but not defined in the program. Check the spelling.-b: BiUSE parameter invalidOne of the parameters to a USE library is not valid for the current environment.USE parameter value is out of rangeOne of the )b'Ovalues for a parameter to the USE library is not valid for the current environment.M)1 eJCommon Questions and AnswersIb* $>Pi~iCOMMON QUESTIONS AND ANSWERS,$) "@~iO sB#TiQuestionsb.$4#8\iHow does one map a variable to an I/O port?j6s?4#8liHow do I directly read/write to internal registers?wC4#8iWhy does a program work with standard I/O but not with fast I/O?xD?.4#8iWhy does the generated code that uses BIT variables look so ugly?['4#8NiWhy is the RS-232 not working right?i5.4#8jiHow can I use two or more RS-232 ports on one PIC?Y%K4#8JiHow does the PIC connect to a PC? m94#8riHow do I get getc() to timeout after a specified time?X$K4#8HiHow do I do a printf to a string?xD4#8iWhy do I get an OUT OF ROM error when there seems to be ROM left?b.4#8\iWhat can be done about an OUT OF RAM error?`,J4#8XiWhy does the .LST file look out of order?yE4#8iHow is the TIMER0 interrupt used to perform an event at some rate?wCJ:4#8iHow does the compiler handle converting between bytes and words?uA4#8iHow does the compiler determine TRUE and FALSE on expressions?~J:-4#8iWhat are the restrictions on function calls from an interrupt function?c/4#8^iWhy does the compiler use the obsolete TRIS?a--4#8ZiHow does the PIC connect to an I2C device?b.S4#8\iInstead of 800, the compiler calls 0. Why?n:4#8tiInstead of A0, the compiler is using register 20. Why?f2S'4#8diHow can a constant data table be placed in ROM?f24#8diHow can a constant data table be placed in ROM?d0'4#8`iWhat is the format of floating point numbers?p<a4#8xiWhy does the compiler show less RAM than there really is?o;4#8viWhat is an easy way for two or more PICs to communicate?n:a>4#8tiHow do I write variables to EEPROM that are not a byte?d04#8`iHow do I put a NOP at location 0 for the ICD?])>4#8RiHow do I make a pointer to a function?q=p4#8ziHow can I pass a variable to functions like OUTPUT_HIGH()?(& i\+p1f MHow does one map a variable to an I/O port?Y/M* $^i How does one map a variable to an I/O port?N . ,@Pi~iTwo methods are as follows:e$M A PI:#byte PORTB = 6#define ALL_OUT 0#define ALL_IN 0xffmain() {int i;set_tris_b(ALL_OUT);PORTB = 0;// Set all pins lowfor(i=0;i<=127;++i)// Quickly count from 0 to 127PORTB=i;// on the I/O port pinset_tris_b(ALL_IN);i = PORTB; // i now contains the portb value.} (4%   C( iRemember when using the #BYTE, the created variable is treated like memory. You must maintain the tri-state control registers yourself via the SET_TRIS_X function. Following is an example of placing a structure on an I/O port:(4k%  CI `:structport_b_layout{int data : 4;int rw : 1;int cd : 1;int enable : 1;int reset : 1; };structport_b_layout port_b;#byte port_b = 6struct port_b_layout const INIT_1 = {0, 1,1,1,1};struct port_b_layout const INIT_2 = {3, 1,1,1,0};struct port_b_layout const INIT_3 = {0, 0,0,0,0};struct port_b_layout const FOR_SEND = {0,0,0,0,0};// All outputsstructport_b_layout const FOR_READ = {15,0,0,0,0};// Data is an inputok.< H:main() {int x;set_tris_b((int)FOR_SEND);// The constant // structure is// treated likeTB TPւ:// a byte and // is used to// set the data// directiony.Q p:port_b = INIT_1;delay_us(25);port_b = INIT_2;// These constant structures delay_us(25);// are used to set all fields port_b = INIT_3;// on the port with a single // commandset_tris_b((int)FOR_READ);port_b.rw=0;// Here the individual port_b.cd=1;// fields are accessedport_b.enable=0;// independently.x = port_b.data;port_b.enable=0}q@1J m6Why does a program work with standard I/O but not with fast I/O?nDm* $i Why does a program work with standard I/O but not with fast I/O? ) iFirst remember that the fast I/O mode does nothing except the I/O. The programmer must set the tri-state registers to establish the direction via SET_TRIS_X(). The SET_TRIS_X() function will set the direction for the entire port (8 bits). A bit set to 1 indicates input and 0 is an output. For example, to set all pins of port B to outputs except the B7 pin, use the following:(m? %  < { & ,:set_tris_b( 0x80 );-?  * $Pi~izS{ " ' iSecondly, be aware that fast I/O can be very fast. Consider the following code:( J %  V/"  ' ^:output_high( PIN_B0 );output_low( PIN_B1 );-J  * $Pi~i  ( iThis will be implemented with two assembly instructions (BSF 6,0 and BCF 6,1). The microprocessor implements the BSF and BCF as a read of the entire port, a modify of the bit and a write back of the port. In this example, at the time that the BCF is executed, the B0 pin may not have yet stabilized. The previous state of pin B0 will be seen and written to the port with the B1 change. In effect, it will appear as if the high to B0 never happened. With standard and fixed I/O, this is not usually a problem since enough extra instructions are inserted to avoid a problem. The time it takes for a pin to stabilize depends on the load placed on the pin. The following is an example of a fix to the above problem:(  %  b x( :output_high( PIN_B0 );delay_cycles(1); //Delay one instruction timeoutput_high( PIN_B1 ); - * $Pi~ijx6' iThe delay_cycles(1) will simply insert one NOP between the two I/O commands. At 20mhz a NOP is 0.2 us.rA1 A #@HWhy does the generated code that uses BIT variables look so ugly?oE6#@* $i Why does the generated code that uses BIT var#@6iables look so ugly?@) iBit variables (SHORT INT) are great for both saving RAM and for speed but only when used correctly. Consider the following:(#@@%  O@sA0 0:int x,y;short int bx, by;x=5;y=10;bx=0;by=1;x = (x+by)-bx*by+(y-by);O'@B( OiWhen used with arithmetic operators (+ and - above), the BX and BY will be first converted to a byte internally: this is ugly. If this must be done, you can save space and time by first converting the bit to byte only once and saving the compiler from doing it again and again. For example:(sAB%  EB/C' <:z=by;x = (x+z)-bx*z+(y-z);-B\C* $Pi~ivN/CD( iBetter, would be to avoid using bits in these kinds of expressions. Almost always, they can be rewritten more efficiently using IF statements to test the bit variables. You can make assignments to bits, use them in IFs and use the &&, || and ! operators very efficiently. The following will be implemented with great efficiency:(\CD%  K$DEE' H:if (by || (bx && bz) || !bw)z=0;-DrE* $Pi~iEEGF( [iRemember to use ! not ~, && not & and || not | with bits. Note that the INPUT(...) function and some other built-in functions that return a bit follow the same rules. -rEtF* $Pi~iG GFF' @iFor example do the following:(tFF%  @F#G& 4:if ( !input( PIN_B0 ) ).FQG' iNOT:B#GG& 8:if( input( PIN_B0 ) == 0)-QGG* $Pi~iGH( 3iBoth will work but the first one is implemented with one bit test instruction and the second one does a conversion to a byte and a comparison to zero.U$GH1  !H(IWhy is the RS-232 not working right?R(H(I* $Pi Why is the RS-232 not working right?O HwK/ ,Ai1. The PIC is Sending Garbage Characters.A. Check the clock on the target for accuracy. Crystals are usually not a problem but RC oscillators can cause trouble with RS-232. Make sure the #USE DELAY matches the actual clock frequency.B. Make sure the PC (or other host) has the correct baud and parity setting.C. Check the level conversion. When using a driver/receiver chip, such as the MAX 232, do not use INVERT when making direct connections with resistors and/or diodes. You probably need the INVERT option in the #USE RS232.((IM3 4iD. Remember that PUTC(6) will send an ASCII 6 to the PC and this may not be a visible character. PUTC('A') will output a visible character A.2. The PIC is Receiving Garbage Characters.A. Check all of the above.3. Nothing is Being Sent.A. Make sure that the tri-state registers are correct. The mode (standard, fast, fixed) used will be whatever the mode is when the #USE RS232 is encountered. Staying with the default STANDARD mode is safest.B. Use the following main() for testing:(wKM%  V,MN* $X:main() { while(TRUE) putc('U'); }-MJN* $Pi~i_3NO, &giCheck the XMIT pin for activity with a logic probe, scope or whatever you can. If you can look at it with a scope, check the bit time (it should be 1/BAUD). Check again after the level converter.4. Nothing is being received.First be sure the PIC can send data. Use the following main() for testing:(JNO%  uHOR- *:mORHain() {printf("start"); while(TRUE) putc( getc()+1 ); }-O* $Pi~ibR- (iWhen connected to a PC typing A should show B echoed back.If nothing is seen coming back (except the initial "Start"), check the RCV pin on the PIC with a logic probe. You should see a HIGH state and when a key is pressed at the PC, a pulse to low. Trace back to find out where it is lost.5. The PIC is always receiving data via RS-232 even when none is being sent.A. Check that the INVERT option in the USE RS232 is right for your level converter. If the RCV pin is HIGH when no data is being sent, you should NOT use INVERT. If the pin is low when no data is being sent, you need to use INVERT.sD/ ,iB. Check that the pin is stable at HIGH or LOW in accordance with A above when no data is being sent.C. When using PORT A with a device that supports the SETUP_PORT_A function make sure the port is set to digital inputs. This is not the default. The same is true for devices with a comparator on PORT A.6. Compiler reports INVALID BAUD RATE.A. When using a software RS232 (no built-in UART), the clock cannot be really slow when fast baud rates are used and cannot be really fast with slow baud rates. Experiment with the clock/baud rate values to find your limits.<) 'iB. When using the built-in UART, the requested baud rate must be within 3% of a rate that can be achieved for no error to occur. Some parts have internal bugs with BRGH set to 1 and the compiler will not use this unless you specify BRGH1OK in the #USE RS232 directive. c2 1A y ! GHow can I use two or more RS-232 ports on one PIC?`6* $li How can I use two or more RS-232 ports on one PIC?u "- (iThe #USE RS232 (and I2C for that matter) is in effect for GETC, PUTC, PRINTF and KBHIT functions encountered until another #USE RS232 is found.The #USE RS232 is not an executable line. It works much like a #DEFINE.The following is an example program to read from one RS-232 port (A) and echo the data to both the first RS-232 port (A) and a second RS-232 port (B).(J%  m"> J:#USE RS232(BAUD=9600, XMIT=PIN_B0, RCV=PIN_B1)void put_to_a( char c ) { put(c);}char get_from_a( ) {return(getc()); }#USE RS232(BAUD=9600, XMIT=PIN_B2,RCV=PIN_B3)void put_to_b( char b ) { putc(c);}main() { char c; put_to_a("Online\n\r"); put_to_b("Online\n\r"); while(TRUE) { c=get_from_a(); put_to_b(c); put_to_a(c); }}-J"* $Pi~id=' ziThe following will do the same thing but is less readable:("%  _G: B:main() {char c;#USE RS232(BAUD=9600, XMIT=PIN_B0, RCV=PIN_B1)printf("Online\n\r");#USE RS232(BAUD=9600, #useXMIT=PIN_B2,RCV=PIN_B3)printf("Online\n\r");while(TRUE) {#USE RS232(BAUD=9600, XMIT=PIN_B0, RCV=PIN_B1)c=getc();#USE RS232(BAUD=9600, XMIT=PIN_B2,RCV=PIN_B3)putc(c);#USE RS232(BAUD=9600, XMIT=PIN_B0, RCV=PIN_B1)putc(c);}R!1T! ! How does the PIC connect to a PC?O%G* $Ji How does the PIC connect to a PC?# 6 :i"A level converter should be used to convert the TTL (0-5V_ levels that the PIC operates with to the RS-232 voltages (+/- 3-12V) used by the PIC. The following is a popular configuration using the MAX232 chip as a level converter.rA}1y !!} JWhy do I get an OUT OF ROM error when there seems to be ROM left?oE  * $i Why do I get an OUT OF ROM error when there seems to be ROM left?}  }) _iThe OUT OF ROM error can occur when a function will not fit into a segment. A function and all of its inline functions must fit into one hardware page. Sometimes decisions are made automatically by the linker. This will cause too many functions to be INLINE for a function to fit into a segment. To correct the problem, the user may need to use #SEPARATE to force a function to be separate. Consider the following example:9 4 8 Pi~i". *i This example shows a main program with several INLINE functions that it calls. The resulting size of MAIN() is 614 locations and this will not fit into a 512 location page in the 56 device. The linker will put a ? in for the segment number since it would not fit in any segment. Note that the x/y notation is the page number (x) and number of locations (y). As a general rule, the linker will INLINE functions called only once to save stack space and in this program caused the function to get too large. The solution in this example will be to put a #SEPARATE before the declaration for PROCESS_DATA or maybe one of the other big functions called by MAIN(). The result might look like the following:8J3 6 i"\+1 !>!What can be done about an OUT OF RAM error?Y/J* $^i What can be done about an OUT OF RAM error?W+ $ iThe compiler makes every effort to optimize usage of RAM. Understanding the RAM allocation can be a help in designing the program structure. The best re-use of RAM is accomplished when local variables are used with lots of functions. RAM is re-used between functions not active at the same time. See the NOT ENOUGH RAM error message in this manual for a more detailed example.RAM is also used for expression evaluation when the expression is complex. The more complex the expression, the more scratch RAM locations the compiler will need to allocate to that expression. The RAM allocated is reserved during the execution of the entire function but may be re-used between expressions within the function. The total RAM required for a function is the sum of the parameters, the local variables and the largest number of scratch locations required for any expression within the function. The RAM required for a function is shown in the call tree after the RAM=. The RAM stays used when the function calls another function and new RAM is allocated for the new function. However when a function RETURNS the RAM may be re-used by another function called by the parent. Sequential calls to functions each with their own local variables is very efficient use of RAM as opposed to a large function with local variables declared for the entire process at once.a6+ $miBe sure to use SHORT INT (1 bit) variables whenever possible for flags and other boolean variables. The compiler can pack eight such variables into one byte location. This is done automatically by the compiler whenever you use SHORT INT. The code size and ROM size will be smaller.Finally, consider an external memory device to hold data not required frequently. An external 8 pin EEPROM or SRAM can be connected to the PIC with just 2 wires and provide a great deal of additional storage capability. The compiler package includes example drivers for these devices. The primary drawback is a slower access time to read and write the data. The SRAM will have fast read and write with memory being lost when power fails. The EEPROM will have a very long write cycle, but can retain the data when power is lost.Z)<1b !y"<PWhy does the .LST file look out of order?W-* $Zi Why does the .LST file look out of order?1<1 0i The list file is produced to show the assembly code created for the C source code. Each C source line has the corresponding assembly lines under it to show the compilers work. The following three special cases make the .LST file look strange to the first time viewer. Understanding how the compiler is working in these special cases will make the .LST file appear quite normal and very useful.1. Stray code near the top of the program is sometimes under what looks like a non-executable source line.j=:- ({iSome of the code generated by the compiler does not correspond to any particular source line. The compiler will put this code either near the top of the program or sometimes under a #USE that caused subroutines to be generated.2. The addresses are out of order.The compiler will create the .LST file in the order of the C source code. The linker has re-arranged the code to properly fit the functions into the best code pages and the best half of a code page. The resulting code is not in source order. Whenever the compiler has a discontinuity in the .LST file, it will put a * line in the file. This is most often seen between functions and in places where INLINE functions are called. In the case of a INLINE function, the addresses will continue in order up where the source for the INLINE function is located.f. ,i3. The compiler has gone insane and generated the same instruction over and over.For example:(:%  Kv5 ::...........A=0;03F:CLRF15*46:CLRF15*051:CLRF15*113:CLRF15-* $Pi~ivP(  iThis effect is seen when the function is an INLINE function and is called from more than one place. In the above case, the A=0 line is in a INLINE function called in four places. Each place it is called from gets a new copy of the code. Each instance of the code is shown along with the original source line, and the result may look unusual until the addresses and the * are noticed.sB1>!& "3 How is the TIMER0 interrupt used to perform an event at some rate?pFP3 * $i How is the TIMER0 interrupt used to perform an event at some rate?vN ( iThe following is generic code used to issue a quick pulse at a fixed rate:(3  %    ; DY:#include <16Cxx.H>#use Delay(clock=15000000)#define HIGH_START 114byte seconds, high_count;#INT_RTCCclock_isr() { if(--high_count==0) { output_high(PIN_B0); delay_us(5); output_low(PIN_B0); high_count=HIGH_START; }}main() { high_count=HIGH_START; set_rtcc(0); setup_counters(RTCC_INTERNAL, RTCC_DIV_128); enable_interrupts(RTCC_ZERO); enable_interrupts(GLOBAL); while(TRUE);}  8 >iIn this program, the pulse will happen about once a second. The math is as follows:The timer is incremented at (CLOCK/4)/RTCC_DIV.In this example, the timer is incremented (15000000/4)/128 or 29297 times a second (34us).The interrupt happens every 256 increments.In this example, the interrupt happens 29297/256 or 114 times a second.The interrupt function decrements a counter (HIGH_START times) until it is zero, then issues the pulse and resets the counter. + $iIn this example, HIGH_START is 114 so the pulse happens once a second. If HIGH_START were 57, the pulse would be about twice a second.q@ 1*y""diFHow does the compiler handle converting between bytes and words?nDd* $i How does the compiler handle converting between bytes and words?E( :iIn an assignment such as:(d%  ;@& *:bytevar @= wordvar;(@@%  kD@@' iThe most significant BYTE is lost. This is the same result as: (@@@%  B@A& 8:bytevar = wordvar & 0xff;-@BA* $Pi~ib;AA' viThe following will yield just the most significant BYTE:(BAA%  @A B& 4:bytevar = wordvar >> 8;-A9B* $Pi~i BC( OiAny arithmetic or relational expression involving both bytes and words will perform word operations, and treat the bytes as words with the top byte 0. For example:(9B0C%  pGCC) ":wordvar= 0x1234;bytevar= 0x34;if(wordvar==bytevar)//will be FALSE-0CC* $Pi~ikC_D' iAny arithmetic operations that only involve bytes will yield a byte result even when assigned to word. -CD* $Pi~i6_DD' iFor example:(DD%  WDjE) ":bytevar1 = 0x80;bytevar2 = 0x04;wordvar = bytevar1 * bytevar2;//wordvar will be 0-DE* $Pi~id=jEE' ziHowever, typecasting may be used to force word arithmetic:nGEiF' :wordvar = (long) bytevar1 * (long) bytevar2;//wordvar will be 0x200o>EF1& "}"FDGLHow does the compiler determine TRUE and FALSE on expressions?lBiFDG* $i How does the compiler determine TRUE and FALSE on expressions?fFG- *iWhen relational expressions are assigned to variables, the result is always 0 or 1.For example:(DGG%  wPGvH' :bytevar = 5>0; //bytevar will be 1bytevar = 0>5; //bytevar will be 0(GH%  rGvHI+ &Pi~iThe same is true when relation operators are used in expressions. 6HFI' iFor example:(InI%  ;FII& *:bytevar = (x>y)*4;BnII. ,(Pi~iis the same as:(IJ%  T+IgJ) "V:if( x>y ) bytevar=4;else bytevar=0;(JJ%  QgJK2 2?iSHORT INTs (bit variables) are treated the same as relational expressions. They evaluate to 0 or 1.When expressions are converted to relational expressions or SHORT INTs, the result will be FALSE (or 0) when the expression is 0, otherwise the result is TRUE (or 1).For example:(JL%  KL0 .):bytevar = 54;bitvar = bytevar;//bitvar will be 1 (bytevar ! = O)if(bytevar)//will be TRUEbytevar = 0;bitvar = bytevar;//bitvar will be 0xGLDM1 "+#DMMWhat are the restrictions on function calls from an interrupt function?uKLM* $i What are the restrictions on function calls from an interrupt function?<DM+ $#iWhenever interrupts are used, the programmer MUST ensure there will be enough stack space. Ensure the size of the stack required by the interrupt plus the size of the stack already used by main() wherever interrupts are enabled is less than 9. This can be seen at the top of the list file.The compiler does not permit recursive calls to functions because the RISC instruction set does not provide an efficient means to implement a traditional C stack. All RAM locations required for a given function are allocated to a specific addreMLss at link time in such a way that RAM is re-used between functions not active at the same time. This prohibits recursion. For example, the main() function may call a function A() and A() may call B() but B() may NOT call main(), A() or B().rM+ $iAn interrupt may come in at any time, which poses a special problem. Consider the interrupt function called ISR() that calls the function A() just like main() calls A(). If the function A() is executing because main() called it and then the ISR() activates, recursion will have happened. In order to prevent the above problem, the compiler will "protect" the function call to A() from main() by disabling all interrupts before the call to A() and restoring the interrupt state after A() returns. In doing so, the compiler can allow complete sharing of functions between the main program and the interrupt functions.f9- (siThe programmer must take the following special considerations into account:1. In the above example, interrupts will be disabled for the entire execution of A(). This will increase the interrupt latency depending on the execution time of A().2. If the function A() changes the interrupts using ENABLE/DISABLE _INTERRUPTS then the effect may be lost upon the return from A(), since the entire INTCON register is saved before A() is called and restored afterwards. Furthermore, if the global interrupt flag is enabled in A(), the program may execute incorrectly.+ $i3. A program should not depend on the interrupts being disabled in the above situation. The compiler may NOT disable interrupts when the function or any function it calls requires no local RAM.4. The interrupts may be disabled, as described above for internal compiler functions called by the same manor. For example, multiplication invoked by a simple * may have this effect.], 1}" # fWhy does the compiler use the obsolete TRIS?Z0f* $`i Why does the compiler use the obsolete TRIS?^5 Ċ) kiThe use of TRIS causes concern for some users. The Microchip data sheets recommend not using TRIS instructions for upward compatibility. If you had existing ASM code and it used TRIS then it would be more difficult to port to a new Microchip part without TRIS. C does not have this problem, however; the compiler has a device database that indicates specific characteristics for every part. This includes information on whether the part has a TRIS and a list of known problems with the part. The latter question is answered by looking at the device errata.9f+ $iCCS makes every attempt to add new devices and device revisions as the data and errata sheets become available.PCW users can edit the device database. If the use of TRIS is a concern, simply change the database entry for your part and the compiler will not use it.[*ĊX1+# #XHow does the PIC connect to an I2C device?X.* $\i How does the PIC connect to an I2C device?4X- (iTwo I/O lines are required for I2C. Both lines must have pullup registers. Often the I2C device will have a H/W selectable address. The address set must match the address in S/W. The example programs all assume the selectable address lines are grounded.73 6 Pi~i"\+w1 #v#wЎInstead of 800, the compiler calls 0. Why?Y/Ў* $^i Instead of 800, the compiler calls 0. Why?w ) iThe PIC ROM address field in opcodes is 8-10 Bits depending on the chip and specific opcode. The rest of the address bits come from other sources. For example, on the 174 chip to call address 800 from code in the first page you will see:Ў <ЎH) "&:BSF0A,3 CALL0c ( iThe call 0 is actually 800H since Bit 11 of the address (Bit 3 of PCLATH, Reg 0A) has been set.h7H;16 ##;Instead of A0, the compiler is using register 20. Why?e;* $vi Instead of A0, the compiler is using register 20. Why?;* "iThe PIC RAM address field in opcodes is 5-7 bits long, depending on the chip. The rest of the address field comes from the status register. For example, on the 74 chip to load A0 into W you will see:>) "*:BSF 3,5MOVFW 20-* $Pi~i{' iNote that the BSF may not be immediately before the access since the compiler optimizes out the redundant bank switches.d3 1v## jQHow do I directly read/write to internal registers?a7j* $ni How do I directly read/write to internal registers? ;) QiA hardware register may be mapped to a C variable to allow direct read and write capability to the register. The following is an example using the TIMER0 register:oj( :#BYTE timer0 = 0x01timer0= 128; //set timer0 to 128while (timer0 ! = 200); // wait for timer0 to reach 200(;%  ]3W* $fPi~iBits in registers may also be mapped as follows:pF* $:#BIT T0IF = 0x0B.2...while (!T0IF); //wait for timer0 interrupt(W%  rKa' iRegisters may be indirectly addressed as shown in the following example:zR( :printf ("enter address:");a = gethex ();printf ("\r\n value is %x\r\n", *a);(a%  N&Q( MiThe compiler has a large set of built-in functions that will allow one to perform the most common tasks with C function calls. When possible, it is best to use the built-in functions rather than directly write to registers. Register locations change between chips and some register operations require a specific algorithm to be performed when a register value is changed. The compiler also takes into account known chip errata in the implementation of the built-in functions. For example, it is better to do set_tris_A(0); rather than *0x85=0;`/1#щ#How can a constant data table be placed in ROM?]3Q* $fi How can a constant data table be placed in ROM?CQ) 5iThe compiler has support for placing any data structure into the device ROM as a constant read-only element. Since the ROM and RAM data paths are separate in the PIC, there are restrictions on how the data is accessed. For example, to place a 10 element BYTE array in ROM use:V0& `:BYTE CONST TABLE [10]= {9,8,7,6,5,4,3,2,1,0};(Q%  F' >iand to access the table use:K#`( F:x = TABLE [i];ORx = TABLE [5];(%  4 `* $Pi~iBUT NOT:& (:ptr = &TABLE [i];-#* $Pi~irF, &iIn this case, a pointer to the table cannot be constructed.Similar constructs using CONST may be used with any data type including structures, longs and floats.Note that in the implementation of the above table, a function call is made when a table is accessed with a subscript that cannot be evaluated at compile time.k:# 1+#,$ tnHow can the RB interrupt be used to detect a button press? h>t* $|i How can the RB interrupt be used to detect a button press? M) aiThe RB interrupt will happen when there is any change (input or output) on pins B4-B7. There is only one interrupt and the PIC does not tell you which pin changed. The programmer must determine the change based on the previously known value of the port. Furthermore, a single button press may cause several interrupts due to bounce in the switch. A debounce algorithm will need to be used. The following is a simple example:t2 29:#int_rbrb_isr ( ) {byte changes; changes = last_b ^ port_b;last_b = port_b;if (bit_test(changes,4 )&& !bit_test(last_b,4)){ //b4 went low +MF' Pւ:}x2 4:if (bit_test(changes,5)&& !bit_test (last_b,5)){ //b5 went low }...delay-ms (100); //debounce}-F* $Pi~iQ#n. *Gi The delay=ms (100) is a quick and dirty debounce. In general, you will not want to sit in an ISR for 100 MS to allow the switch to debounce. A more elegant solution is to set a timer on the first interrupt and wait until the timer overflows. Dont process further changes on the pin.^-1щ#j$' What is the format of floating point numbers?[1n'* $bi What is the format of floating point numbers?~J4 6i"CCS uses the same format Microchip uses in the 14000 calibration constants. PCW users have a utility PCONVERT that will provide easy conversion to/from decimal, hex and float in a small window in Windows. See EX_FLOAT.C for a good example of using floats or float types variables. The format is as follows:Example Number'P#*F F = = = i iii"i000000000#(F F = = = iiii i17F000000P #*F F = = = i iii"i-17F800000& #*F F = = = i iii"i1082200000  #,F F = = = i iii$i10085470000& e #2F F = = = iii"i*i123.458548E666  #8F F = = = ii i(i0i123.45E20C8274E53e  #<F F = = = ii$i,i4i123.45 E-2043362E178  3 6 i"j9 Q 1,$$Q  LCWhy does the compiler show less RAM than there really is?g=  * $zi Why does the compiler show less RAM than there really is?Q / ,iSome devices make part of the RAM much more ineffective to access than the standard RAM. In particular, the 509, 57, 66, 67,76 and 77 devices have this problem.By default, the compiler will not automatically allocate variables to the problem RAM and, therefore, the RAM available will show a number smaller than expected.There are three ways to use this RAM:1. Use #BYTE or #BIT to allocate a variable in this RAM. Do NOT create a pointer to these variables.:  @, (iExample: @ ;G@& *:#BYTE counter=0x30- @t@* $Pi~iG@.A- (i2. Use Read_Bank and Write_Bank to access the RAM like an array. This works well if you need to allocate an array in this RAM.Example:[t@A) ":For(i=0;i<15;i++) Write_Bank(1,i,getc());For(i=0;i<=15;i++) PUTC(Read_Bank(1,i));-.AA* $Pi~iAB- (Ai3. You can switch to larger pointers for full RAM access (this takes more ROM). In PCB add *=8 to the #device and in PCM add *=16 to the #device.Example:mALC3 6Pi~i#DEVICE PIC16C77 *=16 or #include <16C77.h> #device *=16i8BC1[j$$CDEFWhat is an easy way for two or more PICs to communicate?f<LCD* $xi What is an easy way for two or more PICs to communicate?CF9 @i"There are two example programs (EX_PBUSM.C and EX_PBUSR.C) that show how to use a simple one-wire interface to transfer data between PICs. Slower data can use pin B0 and the EXT interrupt. The built-in UART may be used for high speed transfers. An RS232 driver chip may be used for long distance operations. The RS485 as well as the high speed UART require 2 pins and minor software changes. The following are some hardware configurations.-DEF* $Pi~ih7FF1$݆$FGJHow do I write variables to EEPROM that are not a byte?e;EFG* $vi How do I write variables to EEPROM that are not a byte?FG* "SiThe following is an example of how to read and write a floating point number from/to EEPROM. The same concept may be used for structures, arrays or any other type.R'G7H+ &NP:Hn is an offset into the eeprom. Y.GH+ &\P:HFor floats you must increment it by 4. c87HH+ &pP:HFor example if the first float is at 0 the second W,HJI+ &XP:Hone should be at 4 and the third at 8.*HtI' i_)JIJ6 :S:WRITE_FLOAT_EXT_EEPROM(long int n, float data) { int i; for (i = 0; i < 4; i++) write_ext_eeprom(i + n, *(&data + i) ) ;}float READ_FLOAT_EXT_EEPROM(long int n) { int i; float data; for (i = 0; i < 4; i++) *(&data + i) = read_ext_eeprom(i + n); return(data);}g6tI:K1$$:KK0OHow do I get getc() to timeout after a specified time?d:JK* $ti How do I get getc() to timeout after a specified time?(:KM- (iGETC will always wait for the character to become available. The trick is to not call getc() until a character is ready. This can be determined with kbhit().The following is an example of how to time out of waiting for an RS232 character.Note that without a hardware UART the delay_us should be less than a tenth of a bit time (10 us at 9600 baud). With hardware you can make it up to 10 times the bit time. (1000 us at 9600 baud). Use two counters if you need a timeout value larger than 65535.*KM' i@ M0O6 ::short timeout_error;char timed_getc() { long timeout; timeout_error=FALSE; timeout=0; while(!kbhit&&(++timeout<50000)) // 1/2 second delay_us(10); if(kbhit()) return(getc()); else { timeout_error=TRUE; return(0); }}k:MO1!݆$%OHow can I pass a variable to functions like OUTPUT_HIGH()?h>0O* $|i How can I pass a variable to functions like OUTPUT_HIGH()?O0O/O>0 .iThe pin argument for built in functions like OUTPUT_HIGH need to be known atcompile time so the compiler knows the port and bit to generate the correct code.If your application needs to use a few different pins not known at compile time consider:@ N:switch(pin_to_use) {case PIN_B3 : output_high(PIN_B3); break;case PIN_B4 : output_high(PIN_B4); break;case PIN_B5 : output_high(PIN_B5); break;case PIN_A1 : output_high(PIN_A1); break;}If you need to use any pin on a port use:#byte portb = 6#byte portb_tris = 0x86 // **portb_tris &= ~(1<&%  U.{' \iIf you need to use any pin on any port use:-&* $Pi~i`{0( :*(pin_to_use/8|0x80) &= ~(1<<(pin_to_use&7)); // ** *(pin_to_use/8) |= (1<<(pin_to_use&7));-]* $P֛~Vi0* "%iIn all cases pin_to_use is the normal PIN_A0... defines.** These lines are only required if you need to change the direction register (TRIS).^-]w1$%w҅eHow do I put a NOP at location 0 for the ICD?[1҅* $bi How do I put a NOP at location 0 for the ICD?w, &iThe CCS compilers are fully compatible with Microchips ICD debugger using MPLAB. In order to prepare a program for ICD debugging (NOP at location 0 and so on) you need to add a #DEVICE ICD=TRUE after your normal #DEIVCE.For example:O(҅=' P:#INCLUDE <16F877.h>#DEVICE ICD=TRUE(e%  R!=1J%%How do I do a printf to a string?O%e* $Ji How do I do a printf to a string?/ ,iThe following is an example of how to direct the output of a printf to a string. We used the \f to indicate the start of the string.This example shows how to put a floating point number in a string.9 @:char string[20];byte stringptr=0;tostring(char c) { if(c=='\f') stringptr=0; else string[stringptr++]=c; string[stringptr]=0;}main() { float f; f=12.345; printf(tostring,"\f%6.3f",f);}W&v1X%&vʊHow do I make a pointer to a function?T*ʊ* $Ti How do I make a pointer to a function?v) IiThe compiler does not permit pointers to functions so that the compiler can know at compile time the complete call tree. This is used to allocate memory for full RAM re-use. Functions that could not be in execution at the same time will use the same RAM locations. In addition since there is no data stack in the PIC, function parameters are passed in a special way that requires knowledge at compile time of what function is being called. Calling a function via a pointer will prevent knowing both of these things at compile time. Users sometimes will want function pointers to create a state machine. The following is an example of how to do this without pointers:*ʊ' iĎ6 ::enum tasks {taskA, taskB, taskC};run_task(tasks task_to_run) {switch(task_to_run) {case taskA : taskA_main(); break;case taskB : taskB_main(); break;case taskC : taskC_main(); break;}}-* $Pi~i$W&ĎH1" oA%H*How much time do math operations take?R+' Vi How much time does math operations take?-HǏ* $Pi~i) kiUnsigned 8 bit Ǐoperations are quite fast and floating point is very slow. If possible consider fixed point instead of floating point. For example instead of "float cost_in_dollars;" do "long cost_in_cents;". For trig formulas consider a lookup table instead of real time calculations (see EX_SINE.C for an example). The following are some rough times on a 20 mhz, 14 bit PIC. Note times will vary depending on memory banks used.XǏ E#Z&8 8 bit add<1 us\eE#Z.8 "8 bit multiply9 us[ E#Z,8 8 bit divide20 usXeE#Z&8 16 bit add2 us^vE#Z28 $16 bit multiply48 us\E#Z.8  16 bit divide65 usXv*E#Z&8 32 bit add5 us_E#Z48 $32 bit multiply138 us]*E#Z08  32 bit divide162 usX>E#Z&8 float add32 us^E#Z28 "float multiply147 us\>E#Z.8 float divide274 usVNE#Z"8 exp()1653 usUE#Z 8 ln()2676 usZNH#`$8 sin()3535 us-** $Pi~iR!|1 k %|How are type conversions handled?N$** $HPi~i How are type conversions handled?b5|,- (kiThe compiler provides automatic type conversions when an assignment is performed. Some information may be lost if the destination can not properly represent the source. For example: int8var = int16var; Causes the top byte of int16var to be lostAssigning a smaller signed expression to a larger signed variable will result in the sign being maintained. For example a signed 8 bit int that is -1 when assigned to a 16 bit signed variable is still -1.Signed numbers that are negative when assigned to a unsigned number will cause the 2's complement value to be assigned. For example assigning -1 to a int8 will result in the int8 being 255. In this case the sign bit is not extended (conversion to unsigned is done before conversion to more bits). This means the -1 assigned to a 16 bit unsigned is still 255. - (iiLikewise assigning a large unsigned number to a signed variable of the same size or smaller will result in the value being distorted. For example assigning 255 to a signed int8 will result in -1.The above assignment rules also apply to parameters passed to functions.When a binary operator has operands of differing types then the lower order operand is converted (using the above rules) to the higher. The order is as follows:6 ,C+ &P:HFloat> + &&P:HSigned 32 bit@C+ &*P:HUnsigned 32 bit>+ &&P:HSigned 16 bit@?+ &*P:HUnsigned 16 bit=|+ &$P:HSigned 8 bit??+ &(P:HUnsigned 8 bit6 |+ &P:H1 bit{) "iThe result is then the same as the operands. Each operator in an expression is evaluated independently. For example:>& 0:i32 = i16 - (i8 + i8), &i*The + operator is 8 bit, the result is converted to 16 bit after the addition and the - is 16 bit, that result is converted to 32 bit and the assignment is done. Note that if i8 is 200 and i16 is 400 then the result in i32 is 256. (200 plus 200 is 144 with a 8 bit +)Explicit conversion may be done at any point with (type) inserted before the expression to be converted. For example in the above the perhaps desired effect may be achieved by doing:D& <:i32 = i16 - ((long)i8 + i8), &ciIn this case the first i8 is converted to 16 bit, then the add is a 16 bit add and the second i8 is forced to 16 bit.A common C programming error is to do something like:8/& $:i16 = i8 * 100;@o( 0iWhen the intent was:?/& 2:i16 = (long) i8 * 100;o* "iRemember that with unsigned ints (the default for this compiler) the values are never negative. For example 2-4 is 254 (in 8 bit). This means the following is an endless loop since i is never less than 0:G ' @:int i;for( i=100; i>=0; i--)*' iA]1[%&]Example Programs=* $&Pi~i EXAMPLE PROGRAMS*]' iA1#&V'C}Example Programs>C* $(i Example Programse<) yiA large number of example programs are included on the disk. The following is a list of many of the programs and some of the key programs are re-printed on the following pages. Most programs will work with any chip by just changing the #INCLUDE line that includes the device information. All of the following programs have wiring instructions at the beginning of the code in a comment header. The SIO.EXE program included in the program directory may be used to demonstrate the example programs. This program will use a PC COM port to communicate with the target.C * "iGeneric header files are included for the standard PIC parts. These files are in the DEVICES directory. The pins of the chip are defined in these files in the form PIN_B2. It is recommended that for a given project, the file is copied to a project header file and the PIN_xx defines be changed to match the actual hardware. For example; LCDRW (matching the mnemonic on the schematic). Use the generic include files by placing the following in your main .C file:#include <16C74.H>A e iLIST OF COMPLETE EXAMPLE PROGRAMS (in the EXAMPLES directory)EX_14KADAn analog to digital program with calibration for the PIC14000EX_1920Uses a Dallas DS1920 button to read temperatureEX_8PINDemonstrates the use of 8 pin PICs with their special I/O requirementsEX_92LCDUses a PIC16C92x chip to directly drive LCD glassEX_AD12Shows how to use an external 12 bit A/D converterEX_ADMMA/D Conversion example showing min and max analog readings  b SiEX_CCP1SGenerates a precision pulse using the PIC CCP moduleEX_CCPMPUses the PIC CCP module to measure a pulse widthEX_COMPUses the analog comparator and voltage reference available on some PICsEX_CRCCalculates CRC on a message showing the fast and powerful bit operationsEX_CUSTChange the nature of the compiler using special preprocessor directivesEX_FIXEDShows fixed point numbersEX_DPOT -Ag eiControls an external digital POTEX_DTMFGenerates DTMF tonesEX_ENCODInterfaces to an optical encoder to determine direction and speed-AEX_EXPIOUses simple logic chips to add I/O ports to the PICEX_EXTEEReads and writes to an external EEPROMEX_FLOATShows how to use basic floating pointEX_FREQCA 50 mhz frequency counterEX_GLINTShows how to define a custom global interrupt hander for fast interrupts4Cg AiEX_INTEEReads and writes to the PIC internal EEPROMEX_LCDKBDisplays data to an LCD module and reads data fro keypadEX_LCDTHShows current, min and max temperature on an LCDEX_LEDDrives a two digit 7 segment LEDEX_LOADSerial boot loader program for chips like the 16F877EX_MACROShows how powerful advanced macros can be in CEX_PATGGenerates 8 square waves of different frequencies-A;EY ]iEX_PBUSMGeneric PIC to PIC message transfer program over one wireEX_PBUSRImplements a PIC to PIC shared RAM over one wireEX_PBUTTShows how to use the B port change interrupt to detect pushbuttonsEX_PGENGenerates pulses with period and duty switch selectableEX_PLLInterfaces to an external frequency synthesizer to tune a radioEX_PSPUses the PIC PSP to implement a printer parallel to serial converter,4CgGf iEX_PULSEMeasures a pulse width using timer0EX_PWMUses the PIC CCP module to generate a pulse streamEX_REACTTimes the reaction time of a relay closing using the CCP moduleEX_RMSDBCalculates the RMS voltage and dB level of an AC signalEX_RTCSets and reads an external Real Time Clock using RS232EX_RTCLKSets and reads an external Real Time Clock using an LCD and keypadEX_SINEGenerates a sine wave using a D/A converter;E{If ]iEX_SISRShows how to do RS232 serial interruptsEX_SLAVESimulates an I2C serial EEPROM showing the PIC slave modeEX_SPEEDCalculates the speed of an external object like a model carEX_SPICommunicates with a serial EEPROM using the H/W SPI moduleEX_SQWSimple Square wave generatorEX_SRAMReads and writes to an external serial RAMEX_STEPDrives a stepper motor via RS232 commands and an analog inputgGKb YiEX_STRShows how to use basic C string handling functionsEX_STWTA stop Watch program that shows how to user a timer interruptEX_TANKUses trig functions to calculate the liquid in an odd shaped tankEX_TEMPDisplays (via RS232) the temperature from a digital sensorEX_TGETCDemonstrates how to timeout of waiting for RS232 dataEX_TONESShows how to generate tones by playing "Happy Birthday"EX_TOUCH{IMf ciReads the serial number from a Dallas touch deviceEX_USBImplements a USB device on the PIC16C765EX_VOICESelf learning text to voice programEX_WDTShows how to use the PIC watch dog timerEX_X10Communicates with a TW523 unit to read and send power line X10 codesLIST OF INCLUDE FILES (in the DRIVERS directory)14KCAL.CCalibration functions for the PIC14000 A/D converter2401.CSerial EEPROM functions|KO i2402.CSerial EEPROM functions2404.CSerial EEPROM functions2408.CSerial EEPROM functions4128.CSerial EEPROM functions2416.CSerial EEPROM functions24256.CSerial EEPROM functions2432.CSerial EEPROM functions2465.CSerial EEPROM functions25160.CSerial EEPROM functions25320.CSerial EEPROM functions25640.CSerial EEPROM functionsMс +iOс25C080.CSerial EEPROM functions68HC68R1.CSerial RAM functions68HC68R2.CSerial RAM functions74165.CExpanded input functions74595.CExpanded output functions9346.CSerial EEPROM functions9356.CSerial EEPROM functions9356SPI.CSerial EEPROM functions (uses H/W SPI)9366.CSerial EEPROM functionsAD7715.CA/D Converter functionsAD8400.CDigital POT functionsOx AiAT25256.CSerial EEPROM functionsCE51X.CFunctions to access the 12CE51x EEPROMCE62X.CFunctions to access the 12CE62x EEPROMCE67X.CFunctions to access the 12CE67x EEPROMCTYPE.HDefinitions for various character handling functionsDS1302.CReal time clock functionsDS1621.CTemperature functionsDS1868.CDigital POT functionsFLOATEE.CFunctions to read/write floats to an EEPROMс Ѐ#iINPUT.CFunctions to read strings and numbers via RS232KBD.CFunctions to read a keypadLCD.CLCD module functionsLOADER.CA simple RS232 program loaderLTC1298.C12 Bit A/D converter functionsMATH.HVarious standard trig functionsMAX517.CD/A converter functionsMCP3208.CA/D converter functionsNJU6355.CReal time clock functionsPCF8570.CSerial RAM functions%}] KiSTDIO.HNot much here - Provided for standard C compatibilitySTDLIB.HString to number functionsSTRING.HVarious standard string functionsTONES.CFunctions to generate tonesTOUCH.CFunctions to read/write to Dallas touch devicesX10.CFunctions to read/write X10 codes> 1&(jCode Examples;}* $"i Code Examples!@ N///////////////////////////////////////////////////////////EX_SQW.C//////This program displays a message over the RS-232 and////// waits for any keypress to continue. The program //////will then begin a 1khz square wave over I/O pin B0.////// Change both delay_us to delay_ms to make the////// frequency 1 hz. This will be more visible on ////// a LED. Configure the CCS prototype card as////// follows: insert jumpers from 11 to 17, 12 to 18,///)@9 @/// and 42 to 47.///////////////////////////////////////////////////////////#ifdef __PCB__#include <16C56.H>#else#include <16C84.H>#endif#use delay(clock=20000000)#use rs232(baud=9600, xmit=PIN_A3, rcv=PIN_A2)main() {09 @oH printf("Press any key to begin\n\r");getc();printf("1 khz signal activated\n\r");while (TRUE) {output_high (PIN_B0);delay_us(500);output_low(PIN_B0);delay_us(500);@ND V }}///////////////////////////////////////////////////////////EX_STWT.C////// This program uses the RTCC (timer0) and////// interrupts to keep a real time seconds counter.////// A simple stop watch function is then implemented.//////Configure the CCS prototype card as follows, insert////// jumpers from: 11 to 17 and 12 to 18.///////////////////////////////////////////////////////////#include <16C84.H>#use delay (clock=20000000)0ti c  #use rs232(baud=9600, xmit=PIN_A3, rcv=PIN_A2_#define INTS_PER_SECOND 76//(20000000/(4*256*256))byte seconds;//Number of interrupts left//before a second has elapsed#int_rtcc//This function is calledclock_isr() {//every time the RTCC (timer0)//overflows (255->0)//For this program thisNt} is apx//76 times per second.if(--int_count==0) {++seconds;int_count=INTS_PER_SECOND;#NZ }}main() {byte start;int_count=INTS_PER_SECOND;set_rtcc(0);setup_counters (RTCC_INTERNAL, RTCC_DIV_256);enable_interrupts (INT_RTCC);enable_interrupts(GLOBAL)do {printf ("Press any key to begin. \n\r");getc();start=seconds;printf("Press any key to stop. \n\r");getc();printf ("%u seconds. \n\r", seconds-start);} while (TRUE);}//////////////////////////////////////////////////////////// EX_INTEE.C///+tU x///This program will read and write to the 83 or 84 ////// internal EEPROM. Configure the CCS prototype//////card as follows: insert jumpers from 11 to 17 and ////// 12 to 18.///////////////////////////////////////////////////////////#include <16C84.H>#use delay(clock-100000000)#use rs232 (baud=9600, xmit=PIN_A3, rv+PIN_A2)#include main () {byte i,j,address, value;do {printf("\r\n\nEEPROM: \r\n")//Displays contents[ Wfor(i=0; i<3; ++i) {//entire EEPROMfor (j=0; j<=15; ++j) {//in hexprintf("%2x", read_eeprom(i+16+j));}printf("\n\r");}printf ("\r\nlocation to change: ");address= gethex();printf ("\r\nNew value: ");value=gethex();write_eeprom (address, value);} while (TRUE)}///////////////////////////////////////////////////////////Library for a Microchip 93C56 configured for a x8 ///l I///////// org init_ext_eeprom(); Call before the other//////functions are used//////////// write_ext_eeprom(a,d); Write the byte d to //////the address a //////////// d=read_ext_eeprom (a); Read the byte d from //////the address a. ////// The main program may define eeprom_select, ////// eeprom_di, eeprom_do and eeprom_clk to override ///U xw/// the defaults below.///////////////////////////////////////////////////////////#ifndef EEPROM_SELECT#define EEPROM_SELECTPIN_B7#define EEPROM_CLKPIN_B6#define EEPROM_DIPIN_B5#define EEPROM_DOPIN_B4#endif#define EEPROM_ADDRESS byte#define EEPROM_SIZE256void init_ext_eeprom () {byte cmd[2];byte i;output_low(EEPROM_DI);output_low(EEPROM_CLK);output_low(EEPROM_SELECT);cmd[0]=0x80;cmd[1]=0x9;8 >for (i=1; i<=4; ++i)shift_left(cmd, 2,0);output_high (EEPROM_SELECT);for (i=1; i<=12; ++i) {output_bit(EEPROM_DI, shift_left(cmd, 2,0));output_high (EEPROM_CLK);output_low(EEPROM_CLK);+' @ }*V zw output_low(EEPROM_DI);output_low(EEPROM_SELECT);}void write_ext_eeprom (EEPROM_ADDRESS address, byte data) {byte cmd[3];byte i;cmd[0]=data;cmd[1]=address;cmd[2]=0xa;for(i=1;i<=4;++i)shift_left(cmd,3,0);output_high(EEPROM_SELECT);for(i=1;i<=20;++i) {output_bit (EEPROM_DI, shift_left (cmd,3,0));output_high (EEPROM_CLK);output_low(EEPROM_CLK);}output_low (EEPROM_DI);output_low (EEPROM_SELECT); AU xmdelay_ms(11);}byte read_ext_eeprom(EEPROM_ADDRESS address) {byte cmd[3];byte i, data;cmd[0]=0;cmd[1]=address;cmd[2]=0xc;for(i=1;i<=4;++i)shift_left(cmd,3,0);output_high(EEPROM_SELECT);for(i=1;i<=20;++i) {output_bit (EEPROM_DI, shift_left (cmd,3,0));output_high (EEPROM_CLK);output_low(EEPROM_CLK);if (i>12)shift_left (&data, 1, input (EEPROM_D*A}O));}output_low (EEPROM_SELECT);return(data);)*j% }KA1'V'Software License AgreementGj* $:Pi~iSOFTWARE LICENSE AGREEMENT,() "@~ipD, &iBy opening the software diskette package, you agree to abide by the following provisions. If you choose not to agree with these provisions promptly return the unopened package for a refund.1. License- Custom Computer Services ("CCS") grants you a license to use the software program ("Licensed Materials") on a single-user computer. Use of the Licensed Materials on a network requires payment of additional fees.2. Applications Software- Derivative programs you create using the Licensed Materials identified as Applications Software, are not subject to this agreement.lA(+ $i3. Warranty- CCS warrants the media to be free from defects in material and workmanship and that the software will substantially conform to the related documentation for a period of thirty (30) days after the date of your purchase. CCS does not warrant that the Licensed Materials will be free from error or will meet your specific requirements.4. Limitations- CCS makes no warranty or condition, either expressed or implied, including but not limited to any implied warranties of merchantability and fitness for a particular purpose, regarding the Licensed Materials.1 0{iNeither CCS nor any applicable licensor will be liable for an incidental or consequential damages, including but not limited to lost profits.5. Transfers- Licensee agrees not to transfer or export the Licensed Materials to any country other than it was originally shipped to by CCS.The Licensed Materials are copyrighted 1994, 2001 Custom Computer Services IncorporatedAll Rights Reserved WorldwideP.O. Box 2452Brookfield, WI 5300811 %Times New RomanArialCourier NewSymbolTimesHelveticaCourierGenevaTms RmnHelvMS SerifMS Sans SerifNew YorkSystemWingdingsMinchoBatangSimSunPMingLiUGothicDotumSimHeiMingLiUMS MinchoGulimMS GothicCenturyTahomaArrows1MarlettLucida ConsoleArial BlackComic Sans MSImpactTrebuchet MSVerdanaWebdingsArial NarrowBook AntiquaBookman Old StyleCentury GothicGaramondHaettenschweilerMonotype CorsivaMS OutlookWingdings 2Wingdings 3AlaskaAlaska ExtraboldAntique OaklandPC BrusselsCleveland CondensedConnecticutGuatemalaLetter GothicMarylandOklahomaPC TennesseeUtahUtah CondensedArial Rounded MT BoldBrush Script MTCentury SchoolbookGeorgiaBeesknees ITCBradley Hand ITCCalisto MTCurlz MTElephantEras Bold ITCEras Demi ITCEras Light ITCEras Medium ITCEras Ultra ITCJuice ITCMatisse ITCRockwellRockwell Extra BoldSnap ITCTempus Sans ITCViner Hand ITCWide LatinAllegro BTCommercialScript BTBelwe Bd BTAmerType Md BTAvantGarde Bk BTAvantGarde Md BTBenguiat Bk BTBernhardFashion BTBernhardMod BTBankGothic Md BTBremen Bd BTCharlesworthCommonBulletsCopprplGoth Bd BTDauphinFutura Md BTFuturaBlack BTFutura Lt BTFutura XBlk BTGoudyHandtooled BTGoudyOlSt BTHumanst521 BTKabel Bk BTKabel Ult BTOCR-B 10 BTTechnicalPapyrus LETLithographKidsHumanst521 Cn BTFrnkGothITC Hv BTFlamencoDEngrvrsOldEng BTDomCasual BTCopprplGoth BTLithographLightOzHandicraft BTPosterBodoni BTSerifa BTSerifa Th BTEnglish111 Vivace BTSouvenir Lt BTStaccato222 BTSwiss911 XCm BTTypoUpright BTZapfEllipt BTZurich Ex BTZurich BlkEx BTMT ExtraFutura Bk BTNewBskvll BTKorinna BTFutura BdCn BTFrnkGothITC HvIt BTDomBold BTDF Diversions LETCosmicTwoCopprplGoth Hv BTCopprplGoth BdCn BTCharter BTDF Calligraphic Ornaments LETBauhaus Md BTBalloon Bd BTChartChartingFlowchartManagementCG TimesUniversOCR-AOCR B MTQuickTypeQuickType CondensedQuickType MonoQuickType PiArrows2AwardsBorders1Borders2BoxesBuildingsBusiness&GovernmentClocksComputersElectronicsFurnitureGeographicSymbolsHomePlanningHomePlanning2HouseholdLandscapePlanningOfficePlanningAnimals 1ScienceShapes1Shapes2SignsStars1Stars2SymbolProp BTTechnologyToolsZapfDingbats BTAgateAshleyBenjamin GothicBLADESBluePrintDearTeacher-NormalFormalScript421BT-RegularFoxTrotMediumFreehand575Geometrix BlackGeoPlainGrande OldstyleInformalObliqueJottFLF-Bold.98LibbyScript2LilithMurielParadox-LightPCEirePixieFontPostCryptRansomNoteRechtmanRevive 565RiversideStudioSydneyCharles AntiqueEmpire RegularKalahariPierre LightRevereSienna ThinSnootySourdoughSt. MaartenUltimaUS PlainACBoboCocoaFrancaisGiftHamburgLeighLiffoNevada LightNorseRickRollerRuthTatumTomVarsityWest End@MS MinchoTimes New Roman CETimes New Roman CyrTimes New Roman GreekTimes New Roman TurTimes New Roman (Hebrew)Times New Roman (Arabic)Times New Roman Baltic((! Y-5 & 6^Jk . H<3W XYZ[\q]P^Vׅc de fgh` M NhOIPQq RjSTUL |z )9ŒS, sMNĆ0_ | A  . n#Ną4/)Y !=" #Q% &'(b)7 *+,3-O$/023u4]5 67.9;<#=>?@ A8CDDǀG܆HIJbK B9x1I)   E. U lTmtn<BR ~X/5 3z}E f x+ N/ D9 = +D8M y"', }"(ͅ* #R j$gK #Ga] хYH'>!C [Ja #eV'2 !V%6~, <PU$\M[1Y v#$%QÇo WS%OR; $\   < 3,Xu >y Pd&i_x^A +#= W$F7 $  4 S݆$[ T_!`y !Z&& "(ރ #ge0V"LU  T : Aہ ԄH. IK ! +c$) S`@F < %u":Â? Uo M/ # Nh_ b,$ Cp .Nu.^^^^DWWWWWWWWWWWWWWWWWWWWWWWWWWх U o ރ [      V ,  <Tt<< <  <V' ÇeK P<   Ԅ5 &&R y a=    ......XXX/ A%#$!$#%݆$%%$J"& "y ! #y"k %`& D #v#xxxxxxxM 3go+F T [SU zz<: U/ h SH__$,u6~x _<'(H}p ہ \MfY 3<CR Rͅ}"!$,$ ! >!j$+# A +"#u+/(&(;)F247 u#ASM#BIT#BYTE#CASE #DEFINE#DEVICE#ELIF#ELSE #ENDASM(#ENDIF,#ERROR4#FUSES8#ID Checksum<#ID Filename@#ID numberD#ID number: #ID number, number, numberH#IF exprL#IFDEFP#IFNDEFT#INCLUDEX#INLINE\#INT_AD`#INT_ADOFd#INT_BUSCOLh#INT_BUTTONl#INT_CCP1p#INT_CCP2t#INT_COMPx#INT_DEFAULT|#INT_EEPROM#INT_EXT#INT_EXT1#INT_EXT2#INT_GLOBAL#INT_I2C#INT_LCD#INT_LOWVOLT#INT_PSP#INT_RB#INT_RC#INT_RDA#INT_RTCC#INT_SSP#INT_TBE#INT_TIMER0#INT_TIMER1#INT_TIMER2#INT_TIMER3#INT_xxxx#LIST#LOCATE#NOLIST#OPT#ORG#PRAGMA#PRIORITY#RESERVE#ROM#SEPARATE#TYPE#UNDEF#USE I2C#USE RS232#USE DELAY#USE FAST_IO #USE FIXED_IO#USE STANDARD_IO#ZERO_RAM_ _ DATE_ __ _ PCH _ _ _ _DEVICE_ _$_ _PCB_ _(_ _PCM_ _,ABS0ACOS4ASIN<ATANDATOFLATOI ATOLPBIT_CLEARTBIT_SETXBIT_TEST\Break`Built-In Function List By CategorydBuilt-In FunctionshC Compiler Reference ManuallC Statements and ExpressionspCEILtCode ExamplesxComment|Common Questions and AnswersCompile OptionsCompiler Error MessagesContinueCopyright 1994 2001 Custom Computer Services Inc.COSData DefinitionData DefinitionsDELAY_CYCLESDELAY_MSDELAY_USDevice Calibration DataDirect Device ProgrammingDirectoriesDISABLE_INTERRUPTSDoENABLE_INTERRUPTSExample ProgramsEXPExprExpressionsEXT_INT_EDGEFile FormatsFile MenuFLOORForFunction DefinitionPGET_RTCCGET_TIMER0GET_TIMER1GET_TIMER2 GET_TIMER3GET_TIMERxGETCGETCHGETCHAR GETS$Goto(Help Menu,How are type conversions handled?0How can a constant data table be placed in ROM?4How can I pass a variable to functions like OUTPUT_HIGH ?8How can I use two or more RS-232 ports on one PIC?<How can the RB interrupt be used to detect a button press?@How do I directly read/write to internal registers?DHow do I do a printf to a string?HHow do I get getc to timeout after a specified time?LHow do I make a pointer to a function?PHow do I put a NOP at location 0 for the ICD?THow do I write variables to EEPROM that are not a byte?XHow does one map a variable to an I/O port?\How does the compiler determine TRUE and FALSE on expressions?`How does the compiler handle converting between bytes and words?dHow does the PIC connect to a PC?hHow does the PIC connect to an I2C device?lHow is the TIMER0 interrupt used to perform an event at some rate?pHow much time do math operations take?tI2C_POLLxI2C_READ|I2C_STARTI2C_STOPI2C_WRITEIF StatementINPUTINPUT_AINPUT_BINPUT_CINPUT_DINPUT_EINPUT_xInstallationInstead of 800 the compiler calls 0. Why?Instead of A0 the compiler is using register 20. Why?Invoking the Command Line CompilerISALNUM charISALPHAISAMOUNGISDIGITISLOWERISSPACEISUPPERISXDIGITKBHITLabelLABSLCD_LOADLCD_SYMBOLLOGLOG10MAKE16MAKE32MAKE8MEMCPYMEMSETMPLAB Integration OperatorsOptions MenuOUTPUT_AOUTPUT_BOUTPUT_BIT OUTPUT_C$OUTPUT_D(OUTPUT_E,OUTPUT_FLOAT0OUTPUT_HIGH4OUTPUT_LOW8Overview< fPCB PCM and PCH Overview@PCB PCM and PCH Overview:PCBDPCB PCM and PCH Overview:PCHHPCB PCM and PCH Overview:PCMLPCW Editor C FeaturesPPCW Editor KeysTPCW IDEXPCW Overview\PORT_B_PULLUPS`POWdPre-ProcessorhPre-Processor Command SummarylPre-Processor DirectivespPRINTFtProgram SyntaxxProject Menu|Project WizardPSP_INPUT_FULLPSP_OUTPUT_FULLPSP_OVERFLOWPUTCPUTCHARPUTSREAD_ADCREAD_BANKREAD_CALIBRATIONREAD_EEPROMREAD_PROGRAM_EEPROMReference ParametersRESET_CPURESTART_CAUSERESTART_WDTReturnROTATE_LEFTROTATE_RIGHTSET_ADC_CHANNELSET_PWM1_DUTYSET_PWM2_DUTYSET_RTCCSET_TIMER0SET_TIMER1SET_TIMER2SET_TIMER3SET_TRIS_ASET_TRIS_BSET_TRIS_CSET_TRIS_DSET_TRIS_ESET_UART_SPEEDSETUP_ADC modeSETUP_ADC_PORTSSETUP_CCP1 SETUP_CCP2SETUP_COMPARATORSETUP_COUNTERSSETUP_LCDSETUP_PSP SETUP_SPI$SETUP_TIMER_0(SETUP_TIMER_1,SETUP_TIMER_20SETUP_TIMER_34SETUP_VREF8SETUP_WDT<SHIFT_LEFT@SHIFT_RIGHTDSINHSLEEPLSoftware License AgreementPSPI_DATA_IS_INTSPI_READXSPI_WRITE\SQRT`STANDARD STRING FUNCTIONSdStatementshStmtpSTRCATtSTRCHRxSTRCMP|STRCPYSTRICMPSTRLENSTRLWRSTRNCMPSTRNCPYSTRPBRKSTRRCHRSTRSPNSTRSTRSTRTOKSWAPSwitchTANTechnical SupportTOLOWERTools MenuTOUPPERUtility ProgramsView MenuWhat are the restrictions on function calls from an interrupt function?What can be done about an OUT OF RAM error?What is an easy way for two or more PICs to communicate?Overview< What is the format of floating point numbers?WhileWhy do I get an OUT OF ROM error when there seems to be ROM left?Why does a program work with standard I/O but not with fast I/O?Why does the .LST file look out of order?Why does the compiler show less RAM than there really is?Why does the compiler use the obsolete TRIS?Why does the generated code that uses BIT variables look so ugly?Why is the RS-232 not working right?WRITE_BANKWRITE_EEPROMWRITE_PROGRAM_EEPROM _CALIBRATIONREAD_EEPROMREAD_PROGRAM_EEPROMReference ParametersRESET_CPURESTART_CAUSERESTART_WDTReturnROTATE_LEFTROTATE_RIGHTSET_ADC_CHANNELSET_PWM1_DUTYSET_PWM2_DUTYSET_RTCCSET_TIMER0SET_TIMER1SET_TIMER2SET_TIMER3SET_TRIS_ASET_TRIS_BSET_TRIS_CSET_TRIS_DSET_TRIS_ESET_UART_SPEEDSETUP_ADC modeSETUP_ADC_PORTSSETUP_CCP1 SETUP_CCP2SETUP_COMPARATORSETUP_COUNTERSSETUP_LCDSETUP_PSP SETUP_SPI$SETUP_TIMER_0(SETUP_TIMER_1,SETUP_TIMER_20SETUP_TIMER_34SETUP_VREF8SETUP_WDT<SHIFT_LEFT@SHIFT_RIGHTDSINHSLEEPLSoftware License AgreementPSPI_DATA_IS_INTSPI_READXSPI_WRITE\SQRT`STANDARD STRING FUNCTIONSdStatementshStmtpSTRCATtSTRCHRxSTRCMP|STRCPYSTRICMPSTRLENSTRLWRSTRNCMPSTRNCPYSTRPBRKSTRRCHRSTRSPNSTRSTRSTRTOKSWAPSwitchTANTechnical SupportTOLOWERTools MenuTOUPPERUtility ProgramsView MenuWhat are the restrictions on function calls from an interrupt function?What can be done about an OUT OF RAM error?What is an easy way for two or more PICs to communicate?Overview<GET_RTCCPCB PCM and PCH OverviewWhat is the format of floating point numbers?..WWWWWWWWWWWWWWWWWWWWWWWWWͅͅ/&;)F24  #ASM#ENDASM#INT_AD#INT_ADOF #INT_BUSCOL#INT_BUTTON#INT_CCP1#INT_CCP2#INT_COMP #INT_EEPROM$#INT_EXT(#INT_EXT1,#INT_EXT20#INT_I2C4#INT_LCD8#INT_LOWVOLT<#INT_PSP@#INT_RBD#INT_RCH#INT_RDAL#INT_RTCCP#INT_SSPT#INT_TBEX#INT_TIMER0\#INT_TIMER1`#INT_TIMER2d#INT_TIMER3hDEVEDITlPCBpPCHtPCMxSIOW|/ & ;)Lz}C Compiler Reference ManualPCopyright 1994, 2001 Custom Computer Services, Inc.OverviewPCB, PCM and PCH OverviewSPCW OverviewCTechnical SupportInstallationInvoking the Command Line CompilerMPLAB IntegrationDirectoriesFile FormatsDirect Device ProgrammingDevice Calibration DataͅUtility ProgramsPCW IDEFile MenuProject Menu[PCW Editor C FeaturesTOptions MenuÇCompile OptionsView Menu Tools MenuHelp MenuPCW Editor KeysProject WizardPre-ProcessorPre-Processor Command SummaryUPre-Processor Directives.#ASM#BITN#BYTE#CASEV_ _ DATE_ _u#DEFINE#DEVICE,_ _DEVICE_ _#ERROR#FUSES^#ID number#IF expr#IFDEF#INCLUDED#INLINEW#INT_xxxx#INT_DEFAULT#INT_GLOBAL#LISTх#LOCATE#NOLIST#OPTU #ORG _ _PCB_ _ _ _PCM_ _ _ _ PCH _ _o #PRAGMA #PRIORITYރ #RESERVE #ROM #SEPARATE #TYPE[ #UNDEF #USE DELAY #USE FAST_IO #USE FIXED_IO #USE I2C #USE RS232 #USE STANDARD_IO #ZERO_RAM Data Definitions Data Types Function Definition Function Definition Reference Parameters C Statements and Expressions Program Syntax Commentہ Statementsp Statements& IF While5 Do ForY Switch Return GotoM Label Break ContinueR Expr ; Stmty ExpressionsF OperatorsExpressions PrecedenceBuilt-In FunctionsÂBuilt-In Function List By CategoryABS( )TACOS( )tASIN( )ATAN( )ATOF() ATOI( ) ATOL( )BIT_CLEAR( )BIT_SET( )<BIT_TEST( )<CEIL( ) COS( )DELAY_CYCLES( )DELAY_MS( )ԄDELAY_US( )DISABLE_INTERRUPTS( )ENABLE_INTERRUPTS( )EXP( )aEXT_INT_EDGE( )= FLOOR( ).GET_TIMERx()XGETC()/GETS( )`I2C_POLL( )I2C_READ()I2C_START()I2C_STOP()I2C_WRITE( )DINPUT( )INPUT_x()"UISAMOUNG( )xISALNUM(char)KBHIT()3LABS( )LCD_LOAD( )gLCD_SYMBOL( )LOG( )LOG10( )MAKE8()MAKE16()oMAKE32()+MEMCPY( )MEMSET( ) OUTPUT_BIT( )OUTPUT_FLOAT( )OUTPUT_HIGH( )OUTPUT_LOW( )OUTPUT_A( )PORT_B_PULLUPS( )POWPRINTF( )PSP_OUTPUT_FULL()zPUTC( )PUTS( )<READ_ADC()READ_BANK( ): READ_CALIBRATION( )UREAD_EEPROM( )/READ_PROGRAM_EEPROM ( )hRESET_CPU()RESTART_CAUSE()RESTART_WDT()ROTATE_LEFT( )ROTATE_RIGHT( )SET_ADC_CHANNEL( )SET_PWM1_DUTY( )SET_RTCC( )SET_TRIS_A( )SSET_UART_SPEED()SETUP_ADC(mode)HSETUP_ADC_PORTS( )_SETUP_CCP1( )$SETUP_COMPARATOR( ),SETUP_COUNTERS( )uSETUP_LCD( )SETUP_PSP( )SETUP_SPI( )SETUP_TIMER_0 ( )SETUP_TIMER_1( )6SETUP_TIMER_2( )~SETUP_TIMER_3( )xSETUP_VREF( ) SETUP_WDT ( )SHIFT_LEFT( )_SHIFT_RIGHT( )<SIN ( )'SLEEP()HSPI_DATA_IS_IN()SPI_READ()SPI_WRITE( )}SQRT( )STANDARD STRING FUNCTIONSMSTRTOK()\STRCPY( )fSWAP( )3TAN( )RTOLOWER( )+WRITE_BANK( )WRITE_EEPROM( )"WRITE_PROGRAM_EEPROM ( )KCompiler Error MessageseCompiler Error MessagesCommon Questions and AnswersJHow does one map a variable to an I/O port? Why does a program work with standard I/O but not with fast I/O? Why does the generated code that uses BIT variables look so ugly?A Why is the RS-232 not working right?!How can I use two or more RS-232 ports on one PIC?y !How does the PIC connect to a PC? !Why do I get an OUT OF ROM error when there seems to be ROM left?!What can be done about an OUT OF RAM error?>!Why does the .LST file look out of order?y"How is the TIMER0 interrupt used to perform an event at some rate?& "How does the compiler handle converting between bytes and words?"How does the compiler determine TRUE and FALSE on expressions?( )DINPUT( )INPUT_x()}"What are the restrictions on function calls from an interrupt function?+#Why does the compiler use the obsolete TRIS? #How does the PIC connect to an I2C device? #Instead of 800, the compiler calls 0. Why?v#Instead of A0, the compiler is using register 20. Why?#How do I directly read/write to internal registers?#How can a constant data table be placed in ROM?щ#How can the RB interrupt be used to detect a button press?,$What is the format of floating point numbers?j$Why does the compiler show less RAM than there really is?$What is an easy way for two or more PICs to communicate?$How do I write variables to EEPROM that are not a byte?݆$How do I get getc() to timeout after a specified time?$How can I pass a variable to functions like OUTPUT_HIGH()?%How do I put a NOP at location 0 for the ICD?%How do I do a printf to a string?%How do I make a pointer to a function?k %How much time do math operations take?A%How are type conversions handled?&Example Programs&Example ProgramsV'Code Examples(Software License Agreementf(PY( )fSWAP( )3TAN( )RTOLOWER( )+WRITE_BANK( )WRITE_EEPROM( )"WRITE_PROGRAM_EEPROM ( )KCompiler Error MessageseCompiler Error MessagesCommon Questions and AnswersJHow does one map a variable to an I/O port? Why does a program work with standard I/O but not with fast I/O? Why does the generated code that uses BIT variables look so ugly?A Why is the RS-232 not working right?!How can I use two or more RS-232 ports on one PIC?y !How does the PIC connect to a PC? !Why do I get an OUT OF ROM error when there seems to be ROM left?!What can be done about an OUT OF RAM error?>!Why does the .LST file look out of order?y"How is the TIMER0 interrupt used to perform an event at some rate?& "How does the compiler handle converting between bytes and words?"How does the compiler determine TRUE and FALSE on expressions?( )DINPUT( )INPUT_x()}"/ & ;)L4`=&|& "wă("(ۭSރ TC9_oeVW듘v"7UV4OJONcOOK̎OOO!=Epl 첚 5T7G 09r: ̵ہ aGهNڇNۇN܇N݇NUzXzԄC"H....O..ϑWpK\Q N6 !䃮 u7x7ѳ| "&I59}$,Up [Ulj A7'K\Bz$qJnj&p Y&`5( )F ϓb@r ը%u:#ڄ####&#ٺc"ھPC _A%d57 U11  ގ|/dJ騇 륆#i [h6F_=V ,$&W8C6p  ?4  {5 I& ,b^.b} = |<3= =====q=P=>ׅ%> &>'> (>)>*>~~z ~)~9~ŒS$%,&(s)M*N+Ć,-0O_PQ|S.TVXnz{|#}~Ną4)Y= Q b7 3Ou] &()#*+,./QDRǀU܆VWXbZ9|}~x1I)   E>F.K +U [ V.Tߠt+  <> HmYN yR X/G 3 3' v"3"1 'z'Lj+} + Ò+f.X q O#0#oIxUg&wq2+ѣ/N>u ? u{DЄqӄqӄ  % S5{ 0 = CWaa+}=D=I =l tÈM }‰b<Iiy"? iD'J X {g }"L ͅ|   #Rn f]j$'_\6g#`Љ' #lMVag х Vr"-j\#HxL%%>!/% ݴ)J-* #:, }Q-V' `. j.e/2e/Be/R e/ X{/z(1!6161Ĉ61Ո61615=1%t5t56t5~t5O6,8d6 ^7<X7 7;8899$:ǁ 5.:`.:5.:..:\/:h /:qD=/:_=/:OD/:MI/: &m:[0:Y '.q;v#;$!<%=f:=(o$>Ç Ao SjCSLfDޓDzD@ĎE ~B}F$QH 93I  3IgIk %1I<fK&K8KW`4LlX`4LY`4L``4LGLFN,Z&1V\_2V\oͺ\x(^* ^vC``} aA rd+#pt'd Idti ju ^HjJjJj+>KjSsMjtMj=p]j/djWfYk$MkYq iTs't =ytbtUvsZviǒv{w:ewR*wSWxx݆$_]y[ K{w{!{y !d ,>#,> {? |?h}?I~??q ?j???? ~|~~~z ~)~9~ŒS$%,&' (s)M*N+Ć,-0O_PQ|RA S.TVWXnz{|#}~Ną4/)Y= Q b7 3Ou] &()#*+,- ./QDRǀU܆VWXbY Z9|}~x1I)   E>F.K +U [ V.Tߠt +  <> HmYN yR X/G 3 3' v"3"1 'z'Lj+} + Ò+f.X q O#AAlp&QA `>  2 >C 2 2 (2 0(F\F\((((((((((((((((((((((((((((((((((((+{*?z*z*z*z*z*z*z*;2+62+2???1,?$1,?#?1,1,>1,??1,0&?x?0"?~?0??0???0 ?0?01?>5?>5?~?~5?~5?|1????|?0?x0??~x?0?|??0?|??0?x?>0?8??0?8???0????~0>0???0??0???0??0?<??0?<0????0??~1`??1?????1???????1?????1?????1????1??1??2?????2??20?7??=??E?? E? E`EE%E? %E %E%E3%E3%E3%E3%E3%E3%E3%E3%F3%K3r3r3r3r((((((((((((((()})|)|(|(|(|({({(?{({)@:)69*%8*$?8*$?84s?82sG?82s?82s?82s??72j72i?72c??72c`?<?72c@??7 ????7`???7???7????7????71b???71b???71b???81b???81b???81b???81b???81vc???82g?>?8> ?9?09`?09x:5?cx:0b x?:0b 80b?80b?80b??80b??80b?x?80c???8???<8????8??8????80h????8/?b??8/b????8/b??9/b???9/b?:/b??/b??F/b???F/e????F3fF3f?F?f`?Ff Df? Df~Df@C?f?Cf?Df?Df??Df?Df?Dg@?H?g?Tg?Ug??g? ?g g  h  r r r ?r r r? r rrrr?rr?rrrr ?r r r ? r? ? r ? r  r  r  r  r  `  `  ?_ ? ?_ ? ?_?  ?_? ? _? ?? `  `  `  r r r _ _  _ %f_ #e_"e_? "e_?~ "e_ 8 "e_ ?"e><_ "gb  #M  $N y ^ ^ /@d^ .c^ ?.?c^ .?c^ .?c^ .?c^ .?c^ .?ca .K    ؀] ] .b] .a] .a] -a]? -?a]? -a]? ?-aa? .fa? ?-ka? ?a? a? a? ,fa?,ea,?da, ?da, ?da- ?da- da- ea,`ea-fa0?ha1?ha0?ha0?ha0?ha0?ha1?ha0?ha0?ha1?ha?0?ha?0?ha0?ha0?ha0?ha0?ha1?ha1?ha1?ha0?ha0?ha0?ha0ha0ha0ha0ha1ha1ha1?ha1?ha0?ha1?ha1?ha1ha1ha0ha0ha1ha1ha1ha1ha1ha1ha1?ha1?ha1ha0ha0h 0 G0hG0?gG1[ÀG1W+G1K@`/G1D9G1AAG1AAG1=EG1=7?} G1=+ G1=(L??G1=?G1?='G1?,G1?|  .G1? ? G1 G<? G''G$-G 0G5G ?x=G CG =G 5 ??G %>`??G ?!G +G -G  _ G ? G ! G ! G? ! G? !?G? !?? G? !? G? ! G ! G !? G !? G !? G !? G ! G !?G !?G !G !G !?G !G !G !???G !???G !?G !?G !?G !??G !??G !???G !??G  ??G  ???G ??G ??G ??G ?G ??G ?G ??G ??G? ?G ?G ?G ?G  ???G  ?`?G  ?? ?G  ??zG?  ??>?G? ? ??G ? *G  *?"G  *"G  *"G  *?"G  *?"G  *@?"G ? ?*??"G ? ?*???"G  *?"G  *"G +#G #G #G #G ?#G ??#G ?'G ?.G? ?y?.G?@?;G  CG CG  CG CG  CG? ?!?@CG?8 CG ~?CGE ~??CG ?< ??CG CG CG CG ?CG ?CG ??CG ?CG  N*CG ? *CG +CG  +CG  +CG  ?+CG  +CG  ,CG  ,CG  -CG ? 6CG  7CG  w7CG  DCG  DCG  DCG? ? DCG?  DCG? ;CG? DCG? DCG? DCG? DCG DCG DCG DCG DCG DCG DCG DCG DCG DCG DCG DCG DCG DCG DCG DCG DCG DCG DCG DCG DCG? DCG? DCG? DCG? DCG? DCG? DCG? DCG? DCG? DCG? DCG? DCG? DCG? DCG? DCG? DCG? DCG? DCG? DCG? DCG DCG DCG DCG DCG DCG DCG DCG DCG DCG DCG DCG DCG DCG DCG DCG DCG DCG DCG DCG DCG DCG DCG DCG DCG DCG DCG DCG DCG DCG DCG DCG DCG DCG D#G D#G D#G D#G D#G D"G D"G D?"G D"G D"G D"G D"G? D"G? D?"G? D?"G? D?"G? D "G? D  "G? D "G? D !G? D!G? D!G D??!G D?!G D?!G D?!G? D?!G? D!G? D!G? D!G? D!G D?!G D?!G? D?!G D?!G D!G? D?!G D!G? D!G? D?!G D!G? D!G D!G D!G D!G @?!G ;`8!G :!G  ?+?!G? +!G +!G +?!G +?!G +!G +!G +?!G +?!G +????!G + ???!G  +??!G ? +???!G  +!G  +?x!G  *?!G  *"G  *"G  *c"G ? *? "G  *?"G  *?p"G?  ?"G?  ????"G?  ??"G  ?"G ? ???"G  ????"G?  ?"G? ?  ??#G?  @?#G |>߀?#G  ?#G ?#G  ?#G ?!?.G ??.G ?3G ?CG??``?CG0  CGCGCG?CGCG CG )C6 )C6? )C6? )C6? )C6? *?CG? *C) *CG *CG *CG  +CG  +BG ? +BG ?? +CG ? +CG ? +BG ? +BG ? ,BG ?? 3BG ?? <BG ? <BG  DBG?  DBG?  DBG?  DBG  DBG  DBG  D?BG  DBG  DBG D?BG D?BG DBG D?BG D?BG? D?BG D?BG? D?BG?D?BGD?BGD?BGD?BGD?BGD?BGD?BGD?BGD?BG?D?BG?D?BG?D?BGD?BGD?BGD?BGD?BGD?BGD?BG?DBG?D?BGD?BGD?BGDBGD?BGD?BG DBG DBG? ?DBG DCG DBG DBG? DBG DBG DBG ?D?BG D?BG?D?BGD?BGD?BGD?BGDBGDBG?DBGD?BG D?BGD?BGD?BGDBGDBGDBGDBGDBGDBG DBG DBG ?DBG ??DBG ?DBG DBG DBG ?DBG DBG DBG DBG DBG DCG DBG DBG DCG DBG ?DBG DBG DBG DBG DBG ?DBG DBG DBG DBG ?DBG ?DBG DBG DBG ?DBG DBG DBG DCG DCG DBG ?DBG ?DBG ?DBG DBG DBG DBG DBG ?DBG DBG DBG ?DBG?DBG4DBG4DBG4DBG4DBG4DBG4DBG4DBG4DBG4DBG4DBG4DBG4D?BG4=?BG4<?BG4<?BG4<?BG4?;?BG4;BG4;BG4;BG4;?BG4;?BG4;?BG4;?BG4;?BG4;?BG4?;?BG4?:?BG4:BG4:BG4?:?BG4?:BG4?:BG4?:BG4?:BG4?:BG4?:B&'4?:?B&4?:?B&4?:?B&4?:?B&4?:?B&1o:B&-:B&* :B&) ?;BG( ;?BG( ;BG( ;B%( ;B%( ;?B%(;?B%(;?B%(? ?;B%( ;B%( <B%( <B%( >?BG( >?BG( >BG( >?BG( >?#$h( >?"$( >?"$( >?!$( >??!$( >??!$( ;??!$( ;??!%p( ;??!G( ;?!G( ;? G( ;???? G( *??? %( )??? #(  ? #( ? #( ?? #(  ? #(  @???? #( ?`?? #( p?? #?( ?? $( >?? '(  ?? '( ? ??? '( ? ?&'( |? ?&'( ??? ?&'( ? ?&'(  ?&'( ? ?&'(  ?&'(  ??&'( ? ?&'( ? ?&'(  &'( ? ?&'( ? ?&'( ??&'( ???&'( ??&'( ??&'( ??&'( ??&'( ??&'( ???!'( x??? '( x??? '( ?x???? '( ?x????? '( ?8<? '( ?8~??? '( ????'( ??'( ???'( ????&( ??&(  ?'(  ?'( ????'( ??'( ??'( ???'(  ?'( ?~'( >'( ?>'( ? '( ?9'( ?9?'( ?9 ( 9( ?9( 9( ?9( ? 9( 9??( 9??&9??&9?&+9~?&+?9<?&1?9?<&D9<&D9?8&D9@&D9&? C94C9? 4C94C984C9!4C9!' C7?!'C7!&C7.@&C*  ?&C'?? ?? &C ?C? &CA?? &C? &C? &C? &C?~ &C?  &C? & C??? ?( C? ?( C?? ?( C?? ( C?? ?( C ( C  ( C  ( C ( C ( C ( C ? ( C ?( C( C?( C?( C?( C?( C?( C?( C?( C??( C( C?( C?( C??( C?( C?( C??( C??( C( C( C?( C( C?( C?( C( C?( Cx?( C?( C??( ;?( ;?( ;( ;( ;??( ;??( ;???( ;???( ;????( ;?( ;?( ; ?( ;? ?( ; ?( ; ( ?:?? ( :??( :?&( :)?&( :.?&( :C?&( :C?&( :C?&( :C?&( ?:C&( ;C?&( ;C?&( ;C?&( ;C?&( ;C?&( ;B?( ;?B??( ;B?(;B?( ;B?( ;B?( ?;B( ;B?( ;C?( ;C?( ;C?(;B?(;B) ;B?4;B?4;B?4;B?4;B4;B?4;C?4;C?4;C?4;C4;C?4;C?4;B?4;B?4;C?4;C?4;C?4;C?4;C4?;C?4;C4??;C??4?<C?&4?CC?&4?CC?&4C?C?&4C?C?&4C?C?&4?CC?&4?CC?&4?CC?&4?CC?&4?CC?&4CC?&4C?C?'4C?C?4?C?C? 4?C?C? 4?CC? 4?C?C? 4?C?C? 4?C?C 4?C?C?4?C?C?4?C?C4?C?C4?C?C4?C?C4?C?C4?C?C4?C?C4?CC4?C?C4?C?C4?D??4?C???4?D???4?D?94?D?9?4?C?9?4?C?9?4?C?94?D?94?D?94?D?9?4?D?9??4?D?9?4?D9?4?D?94?D?94?D?94?D?94?D?94?D?9 4?D?9? 4?D9?? 4?D9? 4?D?9? 4?D?9 4?D?9 4?6 ?9 4?6 ?9? 4?6 ?9? 4?D9? ?4?D?9 ?5?D?9 ?4?D?9? ?4?D?9? ?4D9 ?4?D9 ??c`5?D?9 ~ 5?D?9? 5?D?9!5?D?9!5?D?9!4?D?9!5?D?9!5D?7?!#4D?7`?3?#4?D?7?#5?C??7<>#5?D??7p#4?D??7#4?D?7#4?D?7#5?D?h7?#5?D?7?#5?D?7?#5?D?7?#5D?8?#5D?8?#4D?8?#5D??9??#5D?9#5D?9$5D?9F5D??9?F5D?9F5D?9F5D?9F5D??:F5Dx?:F5D?CF4D?CF5D?CF5D?CF5DCF5?D?CF5?D?CF5D?CF5D?CF5D?CF5DCF5D?CF5DCF5D?CF5?D?CF5?DCF5D?CF5?D?CF5?DCF5?DCF5?D?CF5D?CF5DCF5D?CF5DCF5?DCF5?9 CF4?9??CF41?CF41?CF5??0?CF5?0CF5?0??CF5?0?CF5?/CF5?.CF5?.CF5.? CF5. CF5?. CF5?.CF5?.CF5?.CF5?.CF5?.CF5.CF5?.CF5?.CF4?.CF2.CF-?.CF) ?.CF( ?.CF( ?.CF( ?.CF( ?.CF( <?.CF(?.CF( ?.CF( ??.CF(? ?.CF(? /CF(? /?CF(? ?/?CF(? ?/?CF(? ?/?CF(? ?/?CF(? ?/?CF(? ?/?CF(? ?/ ?CF(? ?/ CF(? ?. CF( ?. ?CF( ?.CF(? ??.CF(? ??.CF(? ??.CF(? ??.CF(? ??.?CF(? ?.CF(? ?.CF(? ?.CF(? ?.CF( ?/CF( ?/CF(? ?0CF(? ?0?CF(? ?0CF(? ?0CF(? ?1CF(? ?1CF(? ?1@ CF(? ?=CF(? ?=CF(? ?=CF(? ?DCF(? ?DCF(? ?DCF(? DCF(? ?DCF(? ?DCF(? DCF(? ?DCF(? ?DCF(? ?DCF(? DCF(? DCF(? DCF(? ?DCF(? ?DCF( ?DCF( ?DCF( ?DCF( ?DCF( ?DCF( ?DCF( ?DCF( ?DCF( ?DCF( ?DCF( ?DCF( ?DCF( ?DCF( ?DCF( ?DCF( ?DCF( ?DCF( ?DCF( ?DCF( DCF( DCF( ?DCF( ?DCF( ?DCF( DCF( DCF( ?DCF( DCF( DCF( DCF( ?DCF( DCF( DCF( DCF( ?DCF( ?DCF( ?DCF( ?DCF( ?DCF( ?DCF( DCF( ?DCF&?? ?DCF& ?DCF& ?DCF% ?DCF% ?DCF% ?DCF& DCF& DCF5DCF5DCF5DCF5DCF5DCF5DCF5DCF' DCF& DCF& DCF& DCF% DCF% ?DCF% ?DCF% DCF% DBF& DCF&? DCF(? DCF(? DCF( DCF( DCF( DCF( DCF( DCF( DCF( DCF( DCF(? DCF(? DCF(? DCF(? DCF( DCF(? DCF(? DCF(? DCF(? DCF(? DCF(? DCF(? DCF(? DCF(? DCF(? DCF(? DCF(? DBF(? DBF(? DBF(? DBF(? DBF(? DCF( D)?F( D)F( D)F( D)F( D)F( DF( DF( DF( DF( DF( DF(? DF( DF( 8F( 7F( 7F( 7F( ??F( ?F( ??F( ?F( F( F( ?F(  F(  ?F(  F(  F(  F(  F(  F(  F(?  F(?  F(?  F(?  ?F(  F( ?F( F( F( F( ?F( F(?@F( F( F( F( ?F( F( |F( F( ??F(F( F5F5F5?F5??F5?F5?F5?F5F5?F5F5F5xF58F5?F5?,F5?,F5?,F5?BF5BF5?BF5BF5BF5|BF5??BF5?BF5?BF5??BF5??7 F5?2F5?,@F5???&F5 F5D2*F5D/F5D 2F5D?F5DBF5DDF5D>?G5D5@Q5D+0Z5D'x?[5D [5D[5>[57   [5-[5&.[5 .[5-.[5/.[54.[5 8.[5>8=?.[5@.[55~.[52-[5(!-[5% `"-[58'-[5 '-[5'-[5 '-[5'.[5'.[W'.[W'.[W'.[W'.[W'.[W'-[W'-[W'-[W'-[W'.[W'.[W'.[W'.[W'-[W'-[W'-[W'-[W'-[W!-[W-[W-[W?.[W?.[W?-[W-[W-[W-[W-[W-[W-[W-[W-[W-[W-[W-[W-[W8?>-[W -[W 6-[W|-[W!-[W!-[W!.[W!.[W3[W3[W| 3[W ?3[W?3?[W3[W3  [W3H [W3[W3[W3[W3[W3L\W?3?aW?3 yeW3X?|hW?4xhWchWchWchWchWchWchWchWchWchWchWchWchWchWchWchWchWchWchWchWchWchXch=h=h=h=h=h=h=h=h=h=h=h=h=h>h(((((>h>hXchXcgXbgW?bgW?bgW?bgW?bgWbgWbgWbgWbgW`fW`fW`?eW`?eW`eW?`eW_eU^eU^?eU^?eU^?gU`?gU`gU`gU`gU`gUagW?b?gW?bgW?bgW?bgWbhWchW?chW?MWMW?gdW?gdWfdW?gdWgdWMWNXN((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((J\J[((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((¾lp9(! 1} H&   &C   ( F\F\%㏁.,?,,,,,?,-.*,?+++++++?+ *q?5?n5?n5?n5?n5n5n?5o6'.,++4?m3 m3 l4 l6 m8 r?2 m2 k2 l2xl2p6p6p7q:0w5v5p5o 5o 5o 5o 5o w<p?{<s9s?9s?9s?9s?9t?9s?9s?9s?9s?9s?9s?9s?9s?9s?9s?9s?9s9t9t9t9t9s9s9s9s9s9s9s9s9s9s9s9s9s9s9s9s9s9s9s9s9s9s9s9s9s9s9sgPs9s9s9s9s9s9s9s9s9s9s9s9s9s9s9s9s9?W9  W/`W,0 !W&@-W1W:W<W<W<W<W<W5W(xxW# W@/8;W .W>1W9W:X:X:X:X:X:X:XXX?XXXXWWXXXX?X ?X ?X ?X ?X ?X XX|XXXXXXXXXXXY>XU>XQ?=XF@ =XC=XA8=X9=X5!=X2$=X0)?=X-,=X'0= ?Xp6?=:X:0@?=:Xp=?=:X? =:X7 =:X3?=:X0~?=:X,?=:X(?=:X"$=:X! &=:X+=:X,=:X;=:X <=9X ??=9X=E=9XG=9XG=9XG=9XG=9XG=9XG=9XG=9XG=9XG=9XG=9XG=9XG=9XG=9XG=9XG=9XG=9XG=9XG=9XG=9XG=9XG=9XG=9XG=9XG=9XG=9XG=9XG=9XG=9XG=9XG=9XG=9XG=?9XG=?9XG=9XG=9XG=?9XG=?9XG=?9XG=?9XG=?9XG=?9XG=?9XG=?9XG=?9XG=?9XG.?9XG.?9XG.?9XG.?9XG.9XG.?9XG~?.?9XG??.?9XG?.9XG?.?9XG.?9XG?.?9XG.?9XG.?9XG.?9XG?.?9XG?.?9XG?.?9XG.?#XG.? "XG.? ?"XG.? "XG/? "XG?/? "XG?/? "XG?/? ?"XG?/? "XG/? "XG /? "XG?/??"XG/??"XG/?"XG/?"XG/?"XG?/?!XG?/??!XG?/?!XG?/?!XG/??!XG?0???!XG?4??!XG5???!XG5???!XG:??!XG=?!XG=?<!XG=??!XG=??!XG=???!XG=??!XG=?!XG9?"XG3`?"XG1 ?"XG)"X@&??"X@ <???"X@`??"X?$?"X?)?"X?-?"X??-???"X?<:???"X?>?"X?? <?"X??7??"X??4??"XB?/p ??"XB?'?$X?9XA ?9XA p?9XA p?9XA p?9XA p??9XA `?9XA ?9XG ?9XG 9XG<9XG 7?9XG?9XG?9XG ?9XG??9XG?9XG?9XG9XG `9XG 9XG 9XG ??9XG??9XG9XG?9XG=?9XG=9XG=9XG=9XG!9XG!9XG?9XG9XG9XG9XG9WG?9WG9WG9XG9WG9WG?9WG9WG9WG9WG9WG 9XG9WG9WG9WG9WG9WG?9WG?9WG9WH9WG9WG@9W&9W?&x?9W&|9W&~9W?&9W?&9W'9WG9WG9XG9WH9WH9WH=9WH=9WH=9WH=9WH=9?WH=9?(.H=9(.G=9WG=9WH=9XH>9WH=9XH=9WH>9W H=9WH=9WH=9WH=9WH=9WH=9WH=9WH=9WH=9WH=9WH=9WH=9WH=9WH=9WH=9WH=9WH=9WH=9?WH=9?WH=9?WH>9WH /9WH/9WH/9WH.9WH-9WH-9WH.9WHc.9WH/9WH09?WH?09WH09?WH19WH19?WH19?WH09?WH19?WH?19?WH1!?WH0 ?!?WH0 !?WG0 !?WG?1 !?WG1 !?WG1 !?WG1 !?WG?1 ?!?WG1 !?WG1  !?WG1 !?WG1!?WG1!?WG1 ?WH1 ?WH?1? ?WH0?? ?WH0 ?WH?0? ?WG1 ?WG?1@? W@4 W??4 ?W?= ?W?=? ?W?:?? ?W>3 ? W>/  W>)?< W>$  W>?! W>? ? W>?(?? ?W>??-? ?W:?? .?8 ?W9??O 4? W9??{8/< W9?;`!?W9?5?p!W?9?- p!W?9(?p!W9'??p|!?W?9#!?W9 |!?W8?(?!W8O)?!W ?8-!W 8 0?-!W 9 ?-3$W9s ?-o(W9-9W9-9W9?-9W9-9W9?-9W?9?-9W?9-9W?9?-9W?:?-9W ?:-9W ?:-9W0 ?;-9W?B-9W??B-9W??B-9W?B-9W?B-9W?B-9W?B-9W?B-9W?B-9W?B9W?C9W??C 9W?G ?~9W?G >9WG <9W?G <9W?G 9W?G 9W??G 9W?G 9W?G 9W??G 9W??G9W??G9W??G9W??G9W??G9W??G9W?G8a9W?G9W??G 9W??G 9W??G 9W??G 09W?G`x?:W?G|:W?G |?:W?G :W?G :W??G 9W??G>9W??G>:W?G>:W?G>9W??G>9W?G#:W?G?:W?G?:W?G?:W?G:W?G:W?G9W?G9WG:W?G:W?G:W?G:W?G:W?G:W?G:W?G`:WG:W?G9WG9W?G:W?G:W??G?:W??G?9W??G9W??G9W??Gp9W??G9WG:WG:W?G?:W?G:W?G:W?G:W?G:W?G:W??G:W??G:W?G:W?G:W?G>:W?G>:W?G>W?G>WG>WG>WG>?WG>W?G>W?G>WG>W?G>W?G>W?G>W?G>?W?G>W?G=?W?G=W?G>W?G>W?G>W?G>W?G>W?G>W?G>W?G>W?G>??W?G>?W?G>?W?G>WG=WG=?WG=?WG>?WG>'??W?G>?W?G>W?G=W?G=W?G=W?G=W?G=WG=?W?G=?W?G=?WG=?WG=?WG=WG=WG=WG=pWG=WG=WG=?WG=WG=WG?=?WG?=WG=?WG=WG= WG=:WG=:WG=:WG?=:WG=:WG=:W(=:WG=:WG=:WG=:WG=:WG=:WG=:WG=:WG=:WG=:WG?=:WG?=:WG=:WG=:WG=:WG?=:WG=:WG=:WG?=:WG?=:W@=:W@=* W@=!? W@=? W@=? W@=?? W@=??x? W@=?x? W@?=?|? W@??=?| W@??=?| X@??=? W@??=?|? W@?=??| X@?=?| X@?=?x? W@?=?? W@?=?? W@?=?? W@?=?? X@?=??| W@?=??| W@?=??|? W@?=??| WA?=? WA?=? XA?= XA??= W9WH=9WG=9WG=9XH=9WH>9WH>9WH>9WH=9WG=9WG=9WG=9WH=9WH=9WH=9WH>9WH>9WH>9WH>9WH=9WH>9WH>9WH>9WH>9WH>9WH>9WH=9WH=9WH=9WH>9WH=9WH=9WH>9WH>9WH>9WH>9WH>9WH>9WH>9WH>9WH>9WH>9WH>9WH>9WH=9WH>9WH>9${1H>9#1H>9#0H>9?"0H>9?"0H>9"0H>9?"0H>9"1H>9"1H>9WH>9?WH>9?WH>9?"0H>9"0H>9"0H>9"0H>9?"0H>9?"0H>9?"0H>9?"0H>9?"c2H>9?WH>9?$/H>9?!/H>9!/H>9?!/H>9?!/H>9?!/H>9!/H>9!/H>9?!/H>9?!0H>9?WH>9?WH>9?WH>9?!N.H>9? .H>9? .H>9? .H(9? .H(9? .H'9? ?.H'9? /H'9? 1@(9?$1@(9?$?1@(9?$?1@'9?$?1? |'9?#?1??&9?#?1? ?&9?$?1?<?&9?$1???&9?#1??&9?#?1?:?&9?#?1:?&9$?1:?'9#?1:??'9#?1:'9#?1:(9$?1:(9?$?1: 8'9?$?1:'9?$1:'9$1:(9?$1:(9?$1:(9$1;(9?$1;>9?$?1;>9?$?1:?>9?$1:>9?$1:>9?$1:?>9?$1:?>9$1:?>9$1:?>9$?1:~>9$1:>9?$1`:>9?$?1:>9?$?1:>9?$?1;>9?$1;>9?$1;?>9?$1;>9?$2C>9?$?2C>9?2C>9?2C>92 C>92 C>92 C>9??BC>9??BH>2?BH>2?BH>1??BH>1?BH>1??BH>1BH>1~?BH>1?>?BH>1>?BH>1?<?BH>1?<| BH>1<|BH>1<88 ?BH>1?BH>1BH>1BH>1BH>1BH>1BH>1BH>1BH>1?BH>1BH>1  BG>1 x ??BG>1 |??BG>1 ?BG>1 <?BG>1<BG>1?@<BH>1|BH>1?@~BH>2@~?BH>2~BH>1BH>1?BG>1?BH>1BH>1BG>1BG>1BG>1BG>1BG>9BG>9?BG>9 BG>9 BG>9 BG>9 BG>9$BG>9$BG>9$BG>9$BG>9$BG>9$BG>9$BG>9$BG>9$BG>9$BG>9$B"$>9$BG>9 BG>9 BG>9 BG>9 BG>9 BG>9 BG>9 BG>9 BG>9 BG>9 BG>9 BG>9 BG>9 BG>9 BG>9 BG>9 BG>9BG>9$BG>9$BG>9$BG>9$BG>9$BG>9$BG>9$BG>9$BG>9$BG>9$B?G>9$B?G>9$B?G>9$B?G>9$B?G>9 B?G>9 B?G>9 BG>9 BG>9 BG>6 BG>2 B?G>2? BG>2?BG>1BG>1BG>1BG>1BG>1B?G>1?B?G>1$?G>1$?G>1B?G>1B?G>1B?G>1BG>2BG>2BG>2??B?G>2B?G>2 B?G>2@B?G>1B?G=1?B?G=1 B?G>2 B?G>2B?G=2B?G=2?B?G>2B?G=2=BG=2 ? IG=1 ?I?G=1I?G=1J?G=1J?G>1I?G>1I?G>1I?G=0I?G=9I?G=8I?G=9I?G=:I?G=:?I?B=9?I> =9I5=9I2=9J.=:J*=9h# =9h? #=9h?+=9h.=9h00>9h?9>9h? 53@:h8G9h;J9h6?R9h2U9h,[9h)c]:h%?a:h#e9h?h9hLj9hxr9h x9h ~9i9s:s9s9s9s9s9s9s9s9s?9s?9s9s9s9s9s9s9J(9s9s?9s?9s9s9s9s9s?9s?9s?9s?9s?9s?, s?, s?(? s?'? s??? s?? s? s s s s?  s?  s?  s   s  s ? s |? s ? s  s  s ? s ? s ? s |p? s |p? s <0 s  s ? s ? s ? s ? s?  s  s s s? s? s? s s s?s)s?)s9s9s5s- s!~|pssp's.s7s:s<s<s<s<s<s1lIy(z%  yQp ? ???????~  =p $/00/////////00000000000000000/DiDiDj00k?0000000000000000000000BlBl00-*)?)?)?)?)?))3*>0000000000 " " " "000000000000Wt1lCrsjBMjv(rs޽#""""""""#"""#"""""""""""""""""""""""1"##"""""""""""""$"""#2""""2"3"""""""2"2""""""#2""""#"#" "2""#"""""""""2$""2"#""!"2"""""2""""4""""""2$"2"!""!3"""#"2"2"""!""""$""""""""2""#""""1"22""2!"232#"#!22""""B""2""""""!""""!"""""2"""2"!"""""!###""2"2""!A""3""""2##!#""""""""""""2"""!!"!$"2!""""""2#"2"""!23"""3"""""23""""""""""""""2!""!#"""""22"""""2"!"$"""!#2"""""""""""""""""#2"""""#"""""#"2"2#""!"""""#"#""2!""""""2""""""""!2"#"""""!"""1!"""""""3""#"2!#2"""""""2#"""""""222""!""2#2"2"$$"""""1#""2#"2"""""#""$"""""""B"""2##"""""""""#"!13"""3"#"2$ !"""!""#2#"#2"#!"2"""""B!"""""!2"2"2""!""""#"2%$! R!"""""2""2"#"#"""1"##"""""""""!"#!""""""""!33""2##"""!"$"22""2!3""""2"2""#""2"!"#2""""""""""!#"!#"!#"!R""#""2"$"B"2#"2""""""""!"""#"2"""22#""2"2"""""""0""""B!"""#""""2""!"""2"2"2B"""""B"##""#""$""""2""$2#"B""!"2""R"22"!""#""""!""2""""!""""3C2""!!""""!B"!##!"!"#"""$!"#"""""""#"2""$""""""""#""32"""B"4"3$"#""222"""$2"2!""""1"""#"""""#2"!#B!"2!#""222##3#"""B"12"12""""3!"2""3#"#""""""""!$""2"#"222"2""""!!2" """"#"""#""""""""""!""!"2"""""22#""#!$"#1"""2"210 ""2$""!!B3!"""""21B"#@"""!""""""2"""2"##2$""#!!"#02 1""#"2!"2"!#!!"2"" S""2"!2"""""#""""# #"2"""#""""B"2!B""""!""#2""!#B""2"""""B"#"!2""C#R%2"#"""" A!#"###!"""!"!"" "2 2"$"#"""#$"#"3"""!$2"#"!#2"""3""2"3!#2""""""5"B"#""""#""""$2"2"!" 2""32"$#!"B"2!!$#RB1242"""""#2""!""""!""""""!2"""""""12$##"3!!"1"!1""#2"2!!"##"" """""!"!!"""""""!"$!""""""2!"#"""#"B"""3"""#2"2"!$#"###"3"""B2""2""!"2""""""""2""" "3#""""""0"#"B 3$2""!"""#""#2"2 $$#!"232"4A$!""B"#""!"!""""#!%""!2##"#"#$""1""!"2""#$" ""2!2!"#1$"!"2"""#""!3""!""2""B"#!!""2"$2""2"c"#"#"""""2!""2#"#P#"2D"!#"""""""""A1"""#" $"2"""!"C""2"#1!3"!""23" RA1""1$"""2#"2#"2"$"1""0R""#""12"""""#"2""B""""""B B""231"!$"""#"!#!"""""2"1""!!4""!2"""22"""2#"#"!$!"""""""""3!#""""1#"""#"##"1"""#2!$""#"#""!"""R""1""""""!"1"3""2""#""!"#""22"" ""2"#!#"0B2!"##""2"""2"""""""22"2#""##"""23"#""""!"3"##2"#"!""B#2""""!""2""#!2""#""""""2"2!"2#"""""$#@""5!0"""!!##""!A""#!#"3"222"""""""#"2#"""3""""#"2"@D""22""#!$#"22#2#""#""""12"B##"""4"!2#"#""""""#2""##%"22!12"!22#""0#!###"""""3!"!2"B"""#""""#22$""##"""""!"#2B"""3""Q"!2#1#"2"32A1$"1"2"3""""!""""#"""2212"""""!#3"22"!!#2"2"!22""22#"3B!"4""2"""#2#"##"#""!#!""2!"""""""" ""!""1#"""12"2!$""1"1R#"#"""#""#"""2"$ B""""R"!2#"#1""""""!""!#!"!2!2!"!"R"""""""!""2$""""#""$""#""2B"""""""#"""2"1""2"0#""2" ""!D3#""""12"""2""!"""B"2"""22" ""3""#"1#4""3#""""2B"2""2"#"""""B!Q#2"""#""2""#"!2"#"""""#BB"!"""1"""""""#"!!"3!# $!"""3""A"!""!#"!"2!"$#"2"""""""""22""""""B"2""""""2"A2""2"2""#!"2""#$"##"!$"2"""0"2""#"""""B2#2!2""2"!##B2"""#"""R2""2@"""""""2#"4!""2#"""#B02#B"21#""""2""#"2"##"2"#"#"""1#""2"d"!""#"!!""#"2""32!""#"""""""2!"""""2""#C2#!"B" "D2"""2$""#""0"$""$"#""!""""2"#""""!"1"""2"!#2#"""32B22"#!## #"2"1"""""""""!#B"!"2""""$"2$!2!2A2"!""#2"!%1@"2C$2""22"2#""""#"2!B""2"""#""$!"2"12"3!"""!#3$!2"#""32" "33""""!"""2 "! #""!"1#"B2"#2 C#"2"R "B#"""3" ""#!"""03"""!"""!2!"2""3"""""2!4"!1"##!1#2"!# R"""#2!"""2""2"#""""#""!#""!"1!"" 2"""3"2$B#!"""1"!22"#""""""4#!222"2B"#"!#"!#$"2$"2"""#!""2#22"""""#"""R""3"3"!2"""!"#22"2B#A""#""""3""2#"!"2!##B$!#!22"#!2"##3$2"3"2#"2#"#""$#"#02""$""!"""!4B"!#2""%""""""""""#"# "2"2#"""""""###""#""""2"""22""""#!""""##"!""""""""R!#!!#"""""!#2B#2"2B2##"2"""#"""3"22"""2"!1#"""""#2!#1""2"2""#""""!"!!20"!!2"2#"B""$""#"""#""#2#"!"1!$"#""!#"###""""#B"21$"""131"""R2B""!#!B2"""""#"2"""""""2"R2R"#!"!B$"#! ""2!"0"B"322""1""#2"""""!"$2!!"#2A"!!#A$""#!""!""04""""""#""3"#""""""22"B"""2"#224$"##!#B""1#!"#""$""!$"#"!"!"#"""2"#"#!""#""""""!!"""!2 """B""#""#""""B#2"!""1#$1""$##""2"!"""#"2"$B2"21"2#"$""""#""#""32%#"!"2R"#"!"""""2"""!##2"!""$1"!3"""2""#2"#"""B""0!%"!"2D""""""3"12""2#22#Q""B!"" $"1"2""""2#"03"2B"""2""2"#"""#A#!"!02"1""B""""13"2"2!$!12"""$"""""!B""!""2#"#"!#"#2!"!"2""" $#"""2"!$2""""!"#2""B""2Q2"""""#32#""""""$!"""1"!"""#%!!""#"2""1%!11""""$"#$!"""2"""!""B#""!Q!"""""##""#22!2""""S!#""2"2""!"#""!"#""3!""4!B22"""""2"""3"1!#3"#"""""#""$2"""#"""""#""24#"""""3"2# """"2""B""3"2"$"2222""""""3"2""4"""""3 #""""2"$2""#"2"!#"22"$2"#"!3!##2""3""""""1"2#"" 2!2"""#"""#D""""2D1$##"#""!"22#""##"""""4!0"""!#22"""##2 "#"B"2!"!%""""!"""22""#"""""##"1"#B"""#"!""##@"!!""3@1"!1"""!#"A"1#$2""""B""12"""22#""2"""C"#""" #"2" %""""0B""2"""R#$""""!1"!"#""2"""2"##2#"!C""!"!"#"""B$#"!2C!T$2"""""!"""2""""""!"!""!A#"" "B2""$"#3""2!" A!##!"1$b""""#2!""""""!"B"#!""2 """"!"#""A"""!2#"""%""3""#"""""""!2""""""!122"""""""!"2Q""!""0R#2"%""2"#B!!2""!#2#"#""#"""""#""#"22""!"""!B""2"1!2"!"#"""2"""""""2 2""""""#""""""""""!#""#%"2#"!""#"2""#""#B#"B""#"!"""""2!#"2#""2""2##"110""#"2#"##!$0"!""$"2!##"""2"1"2"2"1""##""""##"2"""#"b"4#2#"23""""""!"""B"B""22"#""##!""""""3""2B"""" 221"!##1""#2 2 "2!"#""!"!"""B"""""""!"#"! """2""B"B#"2"1$"2#"2"3!"""#""2"#"22"""2#""2"2""""#""22%#!!$#"02""!1"2""""""#"2"!B!"#"""""2""""""$""#""D"1"#"""#"""!""C"$""""""""2#"#"#""B!3""#"2"!"""""2"""#"""2D#!3"""##"2""D3""!"#$#"#A#"C"A"#""2""""""1"2""""#1"""""""""""""!"$"#"""##""1"$""""!"""""#"$#""""3""!"""B2"""$""2"#"2"""""B#"1!"22"!""3"""#!!22""#"!2"#!"2""1!#"""!#"##"""!#"2""""#"""2""#""2"""2"""#""C#!!"#"!!!!2""""2#"!1""""##"!"!"""""#"2""""""""""2!!!22##"#""""0""""""#" B""""""#""R"!"2""#""#""22"""""#""""""!""""""2""2" #"1"#2""#2"!!#""31""1""""2"22"""""""2"#"""""B"""""213!"""!2#""#""""""#""""22"!""""""B""!2""2""""2!%""""#!""""""!"#""0"3"""""2""!"""#""""""#3"""#""#"#"""""2"""B"#""#2"""2#1""#!""""2#""""#2"""""$""#2#"""""""""""""""#"""""""22""""""#2!2#""#!2"2"""!"""!""2!#""""#""""""""#"""2"2"""""#"P""""#"""3!"#""""2"2""""""""#"#"!"""#"!4"!#""#!""""""1#""""""""2""""1#!""""#"#2"#2"""#""#""#""02""""""""#""""""""""""""2""$"""!22$"!!"3""!""""2"#""""""""1"2!!""""#""""""#""""!"2"""2""B"""B!"""""""#!"""2"""!""2#"""""""""""1""""2""#""2"22#!22""!"#""""2!""#"""""""""#"""2""#""""3""""1"3""2""""#""""""""""""""""3#2"2"!""""#"$"