View previous topic :: View next topic |
Author |
Message |
Arizona Chris
Joined: 20 Dec 2014 Posts: 69 Location: Arizona
|
Cant get Tris command to be accepted on compile, Need help |
Posted: Sat Dec 27, 2014 10:35 am |
|
|
Hello,
I'm using the E3 book/board package to learn C, and all has gone well except for this morning when I tried to use the tris command to set the i/o directions separately. Every time I try to compile, it fails and gives me the error: expect declaration.
This is right out of the manual for an example, and won't work
it always highlights the (0x0F) and gives me the error code.
any ideas?
Here is the code:
Code: | /*I/O testing of ports and pins*/
#include <e3.h>
#use fast_io(C)
set_tris_c( 0x0F );
void main() {
} |
|
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9243 Location: Greensville,Ontario
|
|
Posted: Sat Dec 27, 2014 10:55 am |
|
|
and we're supposed to guess which PIC you're using ???
main has nothing in it, so I'll assume the PIC's going to sleep though without a compiler version, I'm guessing....
also no idea what's in the e3.h file, that could be causing all sorts of 'issues'. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19538
|
|
Posted: Sat Dec 27, 2014 11:21 am |
|
|
The answer is simple. set_tris_x, is a program command, not a preprocessor directive. It has to be in the code..... |
|
|
Arizona Chris
Joined: 20 Dec 2014 Posts: 69 Location: Arizona
|
it WORKED. thank you! |
Posted: Sat Dec 27, 2014 11:33 am |
|
|
Thank you "Ttelmah". That gives me no errors. Now I can try to send commands to the ports.
Temptronic - Ive gotten in the habit for 15 years of programming micros (obviously with other languages) to compile what I have so far ever so often so I can tell if I made a mistake. This is a base blank program to add to later. The E3 is a small board with an 18F14K50 that CCS sells with a book so you can learn C. Im on the chapter now dealing with ports and I/os.
Chris |
|
|
|