|
|
View previous topic :: View next topic |
Author |
Message |
jrmymllr
Joined: 08 Oct 2012 Posts: 4
|
USE parameter value is out of range "1" |
Posted: Mon Oct 08, 2012 1:33 pm |
|
|
When using this line:
#USE RS232(STREAM = RS485, BAUD = 2400, XMIT = PIN_C6, RCV = PIN_C7, PARITY = N, BITS = 8, DISABLE_INTS, ENABLE = PIN_A5)
I get this error:
*** Error 100 "C:\Users\...\rs485.h" Line 4(5,122): USE parameter value is out of range "1"
If I delete ENABLE = PIN_A5, it compiles. If I try any other pin for ENABLE, it still fails in the same way. If I move the ENABLE statement anywhere else within the USE, it still fails. If I delete other parameters but leave ENABLE, it still fails.
In other words, it's the ENABLE it doesn't like. What am I doing wrong? I'm using V4.135 on a 18F8527.
Last edited by jrmymllr on Mon Oct 08, 2012 1:48 pm; edited 1 time in total |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Mon Oct 08, 2012 1:46 pm |
|
|
Always post your full PIC part number.
Preferably post a very short test program so we can try to compile it
ourselves and see if we get the same problem. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19505
|
|
Posted: Mon Oct 08, 2012 2:25 pm |
|
|
Remove the extra spaces.
#USE RS232 goes wrong in odd ways if you have spaces between the values and their names.
#USE RS232(STREAM=RS485, BAUD=2400, XMIT=PIN_C6, RCV=PIN_C7, PARITY=N, BITS=8, DISABLE_INTS, ENABLE=PIN_A5)
This has been mentioned before here.
Seems not to happen, till a certain number of statements is reached.
Best Wishes |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Mon Oct 08, 2012 2:33 pm |
|
|
You edited your post to add the PIC, but you still didn't post a test
program. So, I made one, but it works:
Quote: |
CCS PCH C Compiler, Version 4.135, xxxxx 08-Oct-12 13:31
0 Errors, 1 Warnings.
Build Successful.
Loaded C:\Program Files\PICC\Projects\PCH_Test\PCH_Test.cof.
BUILD SUCCEEDED: Mon Oct 08 13:31:04 2012 |
Test program:
Code: |
#include <18F8527.h>
#fuses INTRC_IO,NOWDT,PUT,BROWNOUT,NOLVP
#use delay(clock=4M)
#USE RS232(STREAM = RS485, BAUD = 2400, XMIT = PIN_C6, RCV = PIN_C7, PARITY = N, BITS = 8, DISABLE_INTS, ENABLE = PIN_A5)
#include "rs485.c"
//======================================
void main(void)
{
while(1);
} |
The spaces in the #use rs232 parameters didn't cause a problem for my test. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19505
|
|
Posted: Mon Oct 08, 2012 3:15 pm |
|
|
I stuck it onto a larger program, and it did, giving a syntax error a few hundred lines later. Removed the spaces and it functioned correctly. I think it causes a sort of 'translater overflow' in the compiler, which happens at an indeterminate point according to what other statements are present.
Best Wishes |
|
|
jrmymllr
Joined: 08 Oct 2012 Posts: 4
|
|
Posted: Tue Oct 09, 2012 7:40 am |
|
|
I was hopeful, but the suggestions didn't fix it. I tried the line in a new project, with the bare minimum to compile and it worked. Still doesn't work though in the place I really need it... |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19505
|
|
Posted: Tue Oct 09, 2012 9:17 am |
|
|
Probably suggests this is not the problem line, but one some distance above it.
CCS has a little 'habit', when it meets syntax errors, of ploughing on, attempting to interpret things, till eventually something goes so badly wrong that it gives up. Hence errors are often reported several lines _after_ the actual fault.
Best Wishes |
|
|
jrmymllr
Joined: 08 Oct 2012 Posts: 4
|
|
Posted: Wed Oct 10, 2012 10:47 am |
|
|
Ttelmah wrote: | Probably suggests this is not the problem line, but one some distance above it.
CCS has a little 'habit', when it meets syntax errors, of ploughing on, attempting to interpret things, till eventually something goes so badly wrong that it gives up. Hence errors are often reported several lines _after_ the actual fault.
Best Wishes |
I got it. I ended up calling CCS, and the guy asked a few questions and finally recommended I email him the code. Then he asked if I had ENABLE defined anywhere else. That was it. I #define'ed ENABLE as 1. |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|