View previous topic :: View next topic |
Author |
Message |
PravinP
Joined: 21 Jan 2006 Posts: 2
|
ERROR (drives crazy) ---> Expecting a close paren |
Posted: Sat Jan 21, 2006 12:37 pm |
|
|
Dear Members,
I am using PIC10F200
i have the following definition in my file
#define ENABLE PIN_B0
when i compile the code with
if(input(ENABLE))
{
output_high(ENABLE);
break;
}
i get error message "Expecting a close paren"
Its really driving me crazy because i cannot read my input port pin. I have even tried using if(input(PIN_B0)), but still the same error.
Please share ur views on whats going wrong
Pravin |
|
|
Guest
|
|
Posted: Sat Jan 21, 2006 12:56 pm |
|
|
Try to use another word in place of ENABLE. |
|
|
Humberto
Joined: 08 Sep 2003 Posts: 1215 Location: Buenos Aires, La Reina del Plata
|
|
Posted: Sat Jan 21, 2006 6:14 pm |
|
|
Do not know what do you try to do with:
Code: |
if(input(ENABLE))
{
output_high(ENABLE);
break;
}
|
but anyway, I tested the following code using the reserved(?) word ENABLE
selected as option in the preprocessor directive #use RS232(...) and then as an output
pin name.
Code: |
#include <10F200.h>
#FUSES NOWDT //No Watch Dog Timer
#FUSES MCLR //Master Clear pin enabled
#FUSES NOPROTECT //Code not protected from reading
#use delay(clock=4000000)
#use rs232(baud=9600,xmit=PIN_B1,rcv=PIN_B2,ENABLE=PIN_B3)
#use fast_io(B)
#define ENABLE PIN_B0
void main()
{
setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
do
{
if(input(ENABLE))
{
output_high(ENABLE);
break;
}
putc('A');
}while(1);
}
|
Code: |
................... if(input(ENABLE))
003F: BTFSS PORTB.0
0040: GOTO 043
.................... {
.................... output_high(ENABLE);
0041: BSF PORTB.0
.................... break;
0042: GOTO 047
.................... }
....................
.................... putc('A');
0043: MOVLW TMR0
0044: MOVWF ??65535
0045: GOTO @PUTCHAR_1_
....................
|
It compiled properly, no warning, no error.
Humberto |
|
|
PravinP
Joined: 21 Jan 2006 Posts: 2
|
ERROR (drives crazy) ---> Expecting a close paren |
Posted: Sun Jan 22, 2006 3:18 am |
|
|
Hi,
sorry made some errors while posting the code
The define file is
#define ENB PIN_B0
#define INP PIN_B3
while(1)
{
delay_ms(DELAY);
if(input(INP))
{
output_high(ENB);
break;
}
-----
--
--
}
while(1);
I am scanning the port pin PIN_B3 for high, if i sense a high on the pin, i exit the loop
But i get the same error "Expecting a close paren" after i compile the code.
Is there anyother method by which i can sense the port pin instead of using the build in function.
(eg. in 8051, i can simply write if (INP == 1))
Thanks,
Pravin |
|
|
Brian S
Joined: 06 Sep 2005 Posts: 13
|
|
Posted: Sun Jan 22, 2006 9:01 am |
|
|
if ( input(PIN_B4) == 1 ) /*Start Sequencing on B4 hi*/
{
.
.
.
}
Cheers! |
|
|
Guest
|
|
Posted: Sun Jan 28, 2007 3:09 pm |
|
|
if( input_state(pin_b4)) "== sequence" isnt necessary . its also boolean true |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sun Jan 28, 2007 3:54 pm |
|
|
You didn't post a full test program. It's really important to do that
when you're getting compiler errors. I took your code fragments
and made the test program below. It compiles with no errors with
PCB vs. 3.249.
Code: |
#include <10F200.h>
#fuses NOWDT, NOMCLR
#use delay(clock=4000000)
#define ENB PIN_B0
#define INP PIN_B3
#define DELAY 1
//==========================
void main()
{
while(1)
{
delay_ms(DELAY);
if(input(INP))
{
output_high(ENB);
break;
}
}
} |
|
|
|
|