Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Error: expression syntax

Status
Not open for further replies.

traxex

Newbie level 4
Joined
Jul 8, 2011
Messages
7
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,326
Hi. I'm using pic16f877. When i try to build project with this code, i get an error saying expression syntax where there is "PORTA=i". What does that mean? What is the mistake?


Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include <pic.h>
#include <delay.c>
main(void)
{
    unsigned char sequence[40];
    unsigned char i,a,column;
    signed int slide,value;
    unsigned const char text[]={
    0x00,0x00,0x1E,0x03,0x7E,0xCC,0x76,0x00, //a
    0x00,0x00,0x66,0x3B,0x33,0x60,0xC0,0x00,
    0x00,0x00,0x1E,0x33,0x60,0x66,0x3C,0x10,
    0x00,0x00,0x3E,0x63,0xFE,0xC0,0x78,0x00,
    0x0C,0x0C,0x18,0x18,0x30,0x30,0x70,0x00,
    0x06,0x00,0x18,0x18,0x30,0x30,0x60,0x00,
    0x18,0x18,0x33,0x36,0x7C,0x66,0xC3,0x00};
    column=50;
    TRISB=0;
    TRISA=0;
    ADCON1=0x07;
    PORTB=0x00;
    for(;;){
        for(i=0;i<=39;i++){
        sequence[i]=0;
        }
    for(slide=-38;slide<=column;slide++){
    for(i=0;i<=39;i++){
        value=i+slide;
        if(value<0)sequence[i]=0;
        if(value>=0&&value<=column-1)
        sequence[i]=text[value];
        if(value>column)sequence[i]=0;
        }
    for(a=0;a<40;a++){
        for(i=0;i<=15;i++){
            PORTB=sequence[i]
            PORTA=i;
            DelayUs(200);
            }}}
            }
            }

 

You forgot the semicolon in the previous line
PORTB=sequence;

Alex
 

Hi. I'm using pic16f877. When i try to build project with this code, i get an error saying expression syntax where there is "PORTA=i". What does that mean? What is the mistake?


Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include <pic.h>
#include <delay.c>
main(void)
{
    unsigned char sequence[40];
    unsigned char i,a,column;
    signed int slide,value;
    unsigned const char text[]={
    0x00,0x00,0x1E,0x03,0x7E,0xCC,0x76,0x00, //a
    0x00,0x00,0x66,0x3B,0x33,0x60,0xC0,0x00,
    0x00,0x00,0x1E,0x33,0x60,0x66,0x3C,0x10,
    0x00,0x00,0x3E,0x63,0xFE,0xC0,0x78,0x00,
    0x0C,0x0C,0x18,0x18,0x30,0x30,0x70,0x00,
    0x06,0x00,0x18,0x18,0x30,0x30,0x60,0x00,
    0x18,0x18,0x33,0x36,0x7C,0x66,0xC3,0x00};
    column=50;
    TRISB=0;
    TRISA=0;
    ADCON1=0x07;
    PORTB=0x00;
    for(;;){
        for(i=0;i<=39;i++){
        sequence[i]=0;
        }
    for(slide=-38;slide<=column;slide++){
    for(i=0;i<=39;i++){
        value=i+slide;
        if(value<0)sequence[i]=0;
        if(value>=0&&value<=column-1)
        sequence[i]=text[value];
        if(value>column)sequence[i]=0;
        }
    for(a=0;a<40;a++){
        for(i=0;i<=15;i++){
            PORTB=sequence[i][COLOR="#FF0000"]; //missing semicolon[/COLOR]
            PORTA=i;
            DelayUs(200);
            }}}
            }
            }



Actually, the line above is missing the semicolon, which is causing the compiler error.

PORTB=sequence; //missing semicolon
PORTA=i;



I just glanced at your code, so there maybe other syntax errors.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top