Home  >  Support  >  Support Forum  >  When using the command WrPortI (SPCR,&SPCRShadow,0x088);it shows the following error:
Notice! We've recently migrated to using a new forum, we hope you enjoy it. If you are an existing member and this is your first time visiting our new forum, please reset your password to be able to sign in.
Welcome to Digi Forum, where you can ask questions and receive answers from other members of the community.

When using the command WrPortI (SPCR,&SPCRShadow,0x088);it shows the following error:

0 votes
line 7 : ERROR CODE -PARALLEL1.C : Return type (re)declared differently after use.
line 7 : ERROR CODE -PARALLEL1.C : Need function definition or declaration.
line 7 : ERROR CODE -PARALLEL1.C : Syntax error - or garbage at end of program.

Is there a need to define SPCR also in the code.If so,how can it be done?
asked Jun 23 in Rabbit Software by AISWARYA RAJ New to the Community (1 point)
edited Jun 23 by AISWARYA RAJ

Please log in or register to answer this question.

3 Answers

0 votes
It seems to me that, Those errors are not related to the above function WrPortI(), you do not need to define the SPCR in your application. If you provide the code here I will check what is the issue.
answered Jun 27 by cpigilam Veteran of the Digi Community (494 points)
0 votes
Not seeing any further from the OP, I'm getting similar these Error messages too without resolve. I was hoping more information would be forthcoming in this thread.

I'm writing an embedded application that receives TCP packets and then must do some gpio on Port A. I have both the TCP portion and the gpio portion working in separate files. The errors show up when I try to combine the two in a single executable.

In an effort to pare the problem down to it's essence, I've constructed the following test case:

#define TCPCONFIG 1
#define LOCAL_PORT 5551
#use "dcrtcp.lib"

tcp_Socket server_socket;

WrPortI(SPCR, &SPCRShadow, 0x84); // Initialize port A
WrPortI(PADR, &PADRShadow, 0x04); // set the bits

main(){
int i // Give main something to do even though unrelated
i=78 // to the issue
printf ("i = %d\n", i)

} // End main

I get the following compiler messages:

line 12 : ERROR UNTITLED1.C : Return type (re)declared differently after use.
line 12 : ERROR UNTITLED1.C : Need function definition or declaration.
line 12 : ERROR UNTITLED1.C : Syntax error - or garbage at end of program.
line 12 : ERROR UNTITLED1.C : Need function definition or declaration.
line 12 : ERROR UNTITLED1.C : Syntax error - or garbage at end of program.
line 12 : ERROR UNTITLED1.C : Need function definition or declaration.
line 12 : ERROR UNTITLED1.C : Syntax error - or garbage at end of program.
line 12 : ERROR UNTITLED1.C : Need function definition or declaration.
line 12 : ERROR UNTITLED1.C : Syntax error - or garbage at end of program.
line 12 : ERROR UNTITLED1.C : Need function definition or declaration.
10 errors reached; further errors suppressed.

I banged up against this 2 days ago and have been stuck since.

Any suggestions?
Bob
answered Jul 27 by raurand New to the Community (1 point)
0 votes
Bob,

The code snippet you used is incorrect as you are trying to call the WrPortI function outside of a function definition and the compiler thinks you are implementing a function named WrPortI. Also there are a few missing ;.

The following compiles ok:

#define TCPCONFIG 1
#define LOCAL_PORT 5551
#use "dcrtcp.lib"
tcp_Socket server_socket;


main(){
int i; // Give main something to do even though unrelated
i=78; // to the issue

WrPortI(SPCR, &SPCRShadow, 0x84); // Initialize port A
WrPortI(PADR, &PADRShadow, 0x04); // set the bits

printf ("i = %d\n", i);

} // End main

Regards,
Peter
answered Jul 28 by petermcs Veteran of the Digi Community (398 points)
Contact a Digi expert and get started today! CONTACT US
...