Hi
I am using WINAVR compiler for ATMEGA32. While compiling c progam , I am getting the error
error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribu te__’ before '{' token
before evrey function.
code: -
#include <avr\io.h>
-
-
#include <stdio.h>
-
-
#include <avr\delay.h>
-
-
#include <math.h>
-
-
void initialize(void);
-
-
char val;
-
-
-
-
// current measurement state
-
-
enum {PULSE, GSR, BREATH} measure, nextmeasure;
-
-
-
-
// current signal voltages
-
-
char pulseV = 0;
-
-
char gsrV = 0;
-
-
char breathV = 0;
-
-
-
-
// enter every 100Hz
-
-
interrupt(TIM0_COM) void getAD(void)
-
-
{
-
-
// sample A/D and store
-
-
val = ADCH;
-
-
// start a/d converter
-
-
switch(measure)
-
-
{
-
-
case PULSE:
-
-
pulseV = val << 1;
-
-
nextmeasure = GSR;
-
-
break;
-
-
case GSR:
-
-
gsrV = val;
-
-
nextmeasure = BREATH;
-
-
break;
-
-
case BREATH:
-
-
breathV = val;
-
-
nextmeasure = PULSE;
-
-
break;
-
-
}
-
-
-
-
switch(nextmeasure)
-
-
{
-
-
case PULSE: ADMUX = 0b01100001; break;
-
-
case GSR: ADMUX = 0b01100010; break;
-
-
case BREATH: ADMUX = 0b01100011; break;
-
-
}
-
-
measure = nextmeasure;
-
-
-
-
ADCSR.6 = 1;
-
-
}
-
-
-
-
// send signals to MATLAB for drawing
-
-
void transmit()
-
-
{
-
-
printf("%d ", (int)pulseV);
-
-
printf("%d ", (int)gsrV);
-
-
printf("%d ", (int)breathV);
-
-
printf("\r"); // end packet
-
-
PORTD.7 = ~PORTD.7;
-
-
}
-
-
-
-
// read A/D converter and communicate with MATLAB
-
-
void main(void)
-
-
{
-
-
char inchar;
-
-
-
-
initialize();
-
-
-
-
while(1)
-
-
{
-
-
// when signaled by MATLAB, return current values
-
-
if (UCSRA.7)
-
-
{
-
-
inchar = UDR;
-
-
if (inchar=='s') {
-
-
transmit();
-
-
}
-
-
}
-
-
}
-
-
}
-
-
-
-
// setup
-
-
void initialize(void)
-
-
{
-
-
// comm indicator LED
-
-
DDRD.7 = 1;
-
-
PORTD.7 = 0;
-
-
-
-
// serial RS-232 setup for debugging using printf, etc.
-
-
UCSRB = 0x18;
-
-
UBRRL = 103;
-
-
-
-
// set up timer0 to sample a/d at about 100Hz
-
-
TCCR0 = 0b00000101;
-
-
TIMSK = 0b00000010;
-
-
OCR0 = 156;
-
-
-
-
// set up a/d for external Vref, channel 0
-
-
// channel zero / left adj / AVcc Reference
-
-
// A1=PULSE, A2=GSR, A3=BREATH
-
-
ADMUX = 0b01100001;
-
-
-
-
// enable ADC and set prescaler to 1/128*16MHz=125kHz
-
-
// and clear interupt enable
-
-
// and start a conversion
-
-
ADCSR = 0b11000111;
-
-
-
-
measure = PULSE;
-
-
_sei();
-
-
}
Oct 18 '09
10 32001
I have had this error and found that there was a ";" missing at the end of one of the statements in one of my .h files.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: jakkem |
last post by:
For example the following gives me error
"expected `(' before '{' token"
"expected asm body before '{' token "
etc.
int main()
{
asm { /* some asm-functions */ }
}
|
by: ritesh |
last post by:
Hi,
I'm compiling the following code on linux/cc and keep getting a
compiler error
"attrib.c:4: syntax error before '{' token"
I'm using the following options to compile -
cc -Wall -c attrib.c
#include "stdio.h"
|
by: creativeinspiration |
last post by:
Hey guys. I am trying to implement a system call in linux kernel. I usually use ubutntu, but this I am doing on Fedora. I am using kernel 2.6. Here is what I did:
1. Added a line to arch/i386/kernel/syscall_table.S:
.long sys_foo
2. Added a line to linux/include/asm-i386/unistd.h:
#define __NR_foo 324
|
by: m.selvakannan |
last post by:
hi
iam working with uclinux
i got errors while compilation..
/opt/uClinux/bfin-uclinux/bfin-uclinux/runtime/usr/include/asm/
system.h: In function 'long unsigned int __cmpxchg(volatile void*,
long unsigned int, long unsigned int)':
/opt/uClinux/bfin-uclinux/bfin-uclinux/runtime/usr/include/asm/
system.h:204: error: expected type-specifier before ')' token
|
by: entellus |
last post by:
I'm using gcc to compile the code listed below when I get the following error
error: expected '=', ',', ';', 'asm' or '__attribute__' before ' is_prime_number
/*
* What is the largest prime factor of the number 317584931803?
*/
#include <stdio.h>
| |
by: kya2 |
last post by:
I am not able to create following store procedure.
CREATE PROCEDURE DBSAMBA.InsertDeleteBatch(OUT norows INT )
RESULT SETS 1
LANGUAGE SQL
BEGIN part1
DECLARE TOTAL_LEFT INT DEFAULT 0;
SELECT COUNT(*)INTO TOTAL_LEFT FROM DBSAMBA.REPORTEDTRANSACTION_S;
WHILE (TOTAL_LEFT > 0)
DO
|
by: ...vagrahb |
last post by:
Hi,
I have the following structure
struct Format
{
char x;
unsigned char a;
unsigned char b;
unsigned char c;
char y;
|
by: singhPrabhat |
last post by:
Hi,
I am using gcc (GCC) 4.2.1 (SUSE Linux).
SUSE 10.3
While compiling a .c file I get following error ::::
CCWebConfiguration.h:70: error: expected =, ,, ;, asm or __attribute__ before extern
CCWebBrowser.c: In function main:
|
by: akhilesh.noida |
last post by:
I am trying to compile glibc-2.5 for ARM based board. But I am getting
errors while configuring it. Please check and give your inputs for
resolving this.
configure command :
$ ../glibc-2.5/configure --prefix=/mnt/new/Mars/glibc_HQ_test/GLIBC/
install/ --with-__thread
--enable-kernel=2.6.11 --enable-shared
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Duprι who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| | |