too many actual parameters error

General discussion on mikroC.
Post Reply
Author
Message
nadia awad
Posts: 5
Joined: 13 Jul 2014 22:07

too many actual parameters error

#1 Post by nadia awad » 13 Jul 2014 22:18

Hi there,

I'm trying to get the following code working, however, I'm getting this error (too many actual parameters).
Could you please help with this.
Thanks a lot. Nadia

void main()
{
unsigned long Vin, mV;
unsigned char op[12];
unsigned char i,j,lcd[5];
TRISC = 0; // PORTC are outputs (LCD)
TRISA = 0xFF; // PORTA is input
// Configure LCD
Lcd_Init(&PORTC); // LCD is connected to PORTC
Lcd_Cmd(_LCD_CLEAR);
Lcd_Out(1,1,"VOLTMETER");
Delay_ms(2000);
// Configure A/D converter. AN0 is used in this project
ADCON1 = 0x80; // Use AN0 and Vref=+5V
// Program loop
for(;;) // Endless loop
{
Lcd_Cmd(_LCD_CLEAR);
Vin = Adc_Read(0); // Read from channel 0 (AN0)
Lcd_Out(1,1,"mV = "); // Display "mV = "
mV = (Vin * 5000) >> 10; // mv = Vin x 5000 / 1024
LongToStr(mV,op); // Convert to string in "op"
// Remove leading blanks
j=0;
for(i=0;i<=11;i++)
{
if(op != ' ') // If a blank
{
lcd[j]=op;
j++;
}
}
// Display result on LCD
Lcd_Out(1,6,lcd); // Output to LCD
Delay_ms(1000); // Wait 1 second
}
}

User avatar
petar.timotijevic
mikroElektronika team
Posts: 1739
Joined: 19 Feb 2014 13:46
Location: Serbia
Contact:

Re: too many actual parameters error

#2 Post by petar.timotijevic » 14 Jul 2014 13:48

Hi,

Please update your compiler to latest Pro version.


In this line you have:

Code: Select all

Lcd_Init(&PORTC); // LCD is connected to PORTC
Here you should have this:

Code: Select all

Lcd_Init(); // LCD is connected to PORTC
LCD connections are defined as this example for PORTB:

Code: Select all

// Lcd module connections
sbit LCD_RS at LATB4_bit;
sbit LCD_EN at LATB5_bit;
sbit LCD_D4 at LATB0_bit;
sbit LCD_D5 at LATB1_bit;
sbit LCD_D6 at LATB2_bit;
sbit LCD_D7 at LATB3_bit;

sbit LCD_RS_Direction at TRISB4_bit;
sbit LCD_EN_Direction at TRISB5_bit;
sbit LCD_D4_Direction at TRISB0_bit;
sbit LCD_D5_Direction at TRISB1_bit;
sbit LCD_D6_Direction at TRISB2_bit;
sbit LCD_D7_Direction at TRISB3_bit;
// End Lcd module connections

Please see LCD Library explanation.

Please use code tags for posting your source code or zip and attach complete project files.


Best regards,
Peter
Attachments
Code Tags.gif
Code Tags.gif (104.12 KiB) Viewed 5489 times

huida_love
Posts: 1
Joined: 12 May 2019 16:09

Re: too many actual parameters error

#3 Post by huida_love » 07 Aug 2021 15:00

hi iam new in mikro c code having trouble:

void swap (int *,int *);

int main(void) {
//! show memory(start=65520)
int a=3;
int b=4;
swap(&a,&b);
printf("a=%d,b=%d\n",a,b);
return 0;
}
void swap (int *a,int *b){
int temp=*a;
*a=*b;
*b=temp;
}
thannk you adil

Post Reply

Return to “mikroC General”