On 4/2/2012 7:08 PM, Sergey Dryga wrote: > eMyListsDDg gmail.com> writes: > >> >> new to using hi-tech c and would like to know which is preferred way to = define > a pin for use. >> >> one can use TRIS, PORT or LAT bits to define a pin to put a LED on, yes? >> >> does one use one of the above or is it as simple as this? >> >> #define LED1 RA0 >> >> i'm a bit unsure which of the SFRs such as listed above that one would u= se. > i'm using 16f88 >> > Yes, it is that simple. > Make sure that you set corresponding TRIS bit to output, in your case: > TRISA =3D 0bxxxxxxx0; > > where x - 0 or 1 > > for simple use no need to do anything else. You should #include = file, > it defines all different SFRs for the processor you use. > > Sergey Dryga > http://beaglerobotics.com So, it's not that simple, since you also need to set the tris bit to the=20 right state. Which could involve another macro statement, like: #define LED1_TRIS_BIT SomeTrisBitUnion.SomeTrisBit And maybe another=20 level of macro like #define ENABLE_LED (some code) It is good to know that rather than set the whole tris reg, in the case=20 where some other code has already set it up, you can just (re)set the=20 individual bit with a bit instruction or a bitwise AND or OR. Joe W --=20 http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .