CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Expecting close paren error

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
anitha



Joined: 16 Aug 2013
Posts: 6

View user's profile Send private message

Expecting close paren error
PostPosted: Sat Mar 29, 2014 5:30 am     Reply with quote

#include <18F4550.h>
#device adc=10
#FUSES NOWDT, XT
#use delay(clock=12000000)
#use rs232(baud=9600,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=8)
#include <math.h>
#include <lcd.c>
#define switchautomatic PIN_B0
#define switchmanual PIN_B1
#define switchGEN PIN_B2
#define switchbus pin_b3
#define switch400 pin_b4
#define switch230 pin_b5
#define switch110 pin_b6
#define outputrelay pin_d3
//#define ledauto pin_eo
#define led400 pin_e1
#define led230 pin_e2
#define led110 pin_a2
#define ledready pin_a3
#define lednotready pin_a5

#define vh1 420;
#define vl1 380;
#define vh2 245;
#define vl2 215;
#define vh3 120;
#define vl3 100;

#define fh 51;
#define fl 49;

#define dl 0;
#define dh 20;

int16 data3;
int16 data4;

float V3;
float V4;
float f3;
float f4;
long rise3,rise4,pulse_width;
float realpulse,phase2;

void main()
{
lcd_init();
output_high(lednotready);
output_low(outputrelay);

setup_adc(ADC_CLOCK_INTERNAL); // initialize ADC with a sampling rate of Crystal/4 MHz
setup_adc_ports(ALL_ANALOG);

set_adc_channel(0); // point ADC to channel 0 for ADC reading
delay_ms(10);
data3 = read_adc(); // capture reading from sensor 1
delay_us(10); // 0.1ms delay for ADC stabilization

set_adc_channel(1); // point ADC to channel 0 for ADC reading
delay_ms(10);
data4 = read_adc(); // capture reading from sensor 2
delay_us(10); // 0.1ms delay for ADC stabilization


V3=data3*0.439453;
V4=data4*0.439453;

lcd_gotoxy(1,1);
printf(lcd_putc,"%f kv",v3);
lcd_gotoxy(1,2);
printf(lcd_putc,"%f kv",v4);

while(1)
{
if((input(switch400)==1) && (Vl1<V3)) ---->In this line indicating expecting close paren
{
//if(VL1<V3)
//{
output_high(led400);
output_low(lednotready);
output_high(ledready);
output_high(outputrelay);
lcd_gotoxy(10,2);
printf(lcd_putc,"400 R");
//}
}

if(input(switch230)==1)
{
//if(vl2<v3<vh2)
//{
output_high(led230);
output_low(lednotready);
output_high(ledready);
output_high(outputrelay);
lcd_gotoxy(10,2);
printf(lcd_putc,"230 R");

//}
}
if(input(switch110)==1)
{
//if(vl3<v3<vh3)
//{
output_high(led110);
output_low(lednotready);
output_high(ledready);
output_high(outputrelay);
lcd_gotoxy(10,2);
printf(lcd_putc,"110 R");
//}
}
delay_ms(100);
}
}
temtronic



Joined: 01 Jul 2010
Posts: 9245
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Sat Mar 29, 2014 5:54 am     Reply with quote

probable error is ...

#define vl1 380;

several lines above.

defines must not have ; (semicolons) at the end of the line.

It appears you added a few defines with semicolons, easy to do.

also these lines ..
delay_us(10); // 0.1ms delay for ADC stabilization

aren't needed as you've delayed for 10ms just before you read the ADC.

recode/recompile/retest/report back

hth
jay
Ttelmah



Joined: 11 Mar 2010
Posts: 19546

View user's profile Send private message

PostPosted: Sat Mar 29, 2014 5:55 am     Reply with quote

So many things.....

Use the code buttons.
What is the fastest clock rate the XT oscillator supports?.
Get into the habit of using case. You declare variables in lower case, then use them in upper case.
Then the one that causes the problem vl1 and v11 are not the same.
Is ADC_CLOCK_INTERNAL recommended at 12MHz?.
What is the delay for after the ADC reading?. The ADC is not 'stabilising' at this point.
Generally avoid doing comparisons on float values.
As a comment use 'TRUE', rather than '1' in logic comparisons.
Gave up at this point.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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