Can someone help me identify why this simple program won't compile?


Closed Thread
Results 1 to 7 of 7
  1. #1
    Join Date
    Mar 2013
    Location
    Florida
    Posts
    7

    Default Can someone help me identify why this simple program won't compile?

    clear
    DEFINE OSC 4
    DEFINE LCD_DREG PORTD
    DEFINE LCD_DBIT 4
    DEFINE LCD_RSREG PORTE
    DEFINE LCD_RSIT 0
    DEFINE LCD_EREG PORTE
    DEFINE LCD_EBIT 1

    (It stops here with a syntax error on this > ) LOW PORTE.2
    (I have tried several other methods from the book that would all set port E, pin 2 to low, but for the life of me, I don't know what is going wrong. It loos so simple. I have the newest compiler, and I am trying to teach myself with a breadboard, and some book learning. Since the circuit isn't part of the problem, or even part of the question, this has to be about the syntax. I took this example code directly from a book by Harprit Singh Sandhu. I love his books, and the way he writes, and own a few of them. I considered that his book may be based on dated code, so I looked through the compiler manual and tried other ways to turn pin2 of PortE low. The compiler doesn't like anything I put place of Low PortE.2 It looks too simple, and I just don't get it, so you can imagine that I feel very ignorant to have to ask. The rest of the code follows, and maybe that will also generate syntax errors. What is the problem. Insults are Ok, I deserve them, but please make them constructive insults.


    TRISD = %00000000
    TRISE = %00000000
    ADCON1 = %00000111

    PAUSE 500

    LCDOUT $FE, 1
    LCDOUT "NOW IS THE TIME FOR"
    LCDOUT $FE, $C0
    LCDOUT "A CUP OF PEA SOUP"
    END


  2. #2
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,601


    Did you find this post helpful? Yes | No

    Default Re: Can someone help me identify why this simple program won't compile?

    What PIC, PBP version, ASM version?

    Can you post all your entire code?

    Have you tried just blinking an LED on port e.2?

    Robert

  3. #3
    Join Date
    Mar 2013
    Location
    Florida
    Posts
    7


    Did you find this post helpful? Yes | No

    Default Re: Can someone help me identify why this simple program won't compile?

    The PIC that this would be loaded to, if it ever got tested would be 16F877a

    I have Microcode Studio 5.0.0.3 Compiler 3.0.6.3 and whatever assembler came down when I downloaded this all together.
    If the ASM version is still important, you will have to direct me to where I find that bit of information.


    This code sample is complete, but if it does not look complete, that may be the problem. I took the code from the book to test the LCD.
    Thanks, Joe

  4. #4
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,521


    Did you find this post helpful? Yes | No

    Default Re: Can someone help me identify why this simple program won't compile?

    Hi,
    Make sure you select the correct target device in the drop down list in MicroCode Studio before compiling.
    If you're compiling for a chip which doesn't have a PortE (for example) then the compiler doesn't know what to do with the command LOW PortE.2 so it throws a Syntax Error.

    I've tried your code here, compiling ot for 16F877A, and it compiles without any errors.

    /Henrik.

  5. #5
    Join Date
    Mar 2013
    Location
    Florida
    Posts
    7


    Did you find this post helpful? Yes | No

    Default Re: Can someone help me identify why this simple program won't compile?

    OK, your questions led me back to my program. I previously used another product that started each project with a config window, the processor, and chip configuration settings were in it. I realized that I did not have the same in this software, and once I set the processor correctly, the compiler compiled fine. That made sense to me, the commands were easy, and I had to be referencing a port that did not exist, which it did not in the default chip that was selected.

    Thanks again, your questions led to my answers.

  6. #6
    Join Date
    Jan 2012
    Location
    Grid EN19MV
    Posts
    159


    Did you find this post helpful? Yes | No

    Default Re: Can someone help me identify why this simple program won't compile?

    Guess I should read ALL the posts - answered
    "I have noticed that even those who assert that everything is predestined and that
    we can change nothing about it still look both ways before they cross the street"


    -Stephen Hawking

  7. #7
    Join Date
    Mar 2013
    Location
    Florida
    Posts
    7


    Did you find this post helpful? Yes | No

    Default Re: Can someone help me identify why this simple program won't compile?

    But your willingness to help is deeply appreciated anyway.
    Quote Originally Posted by andywpg View Post
    Guess I should read ALL the posts - answered

Similar Threads

  1. Compile problems with simple RF remote control example
    By astouffer in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 18th July 2012, 05:22
  2. Can anyone compile a C program for me?
    By circuitpro in forum Off Topic
    Replies: 2
    Last Post: - 25th February 2012, 09:22
  3. ICD Compile Program in MicroCode Studio Plus
    By Mike2545 in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 5th December 2010, 16:29
  4. Compile and Program help using PICKit2
    By ozarkshermit in forum mel PIC BASIC Pro
    Replies: 15
    Last Post: - 10th March 2009, 14:51
  5. Problem to compile my program
    By wagner in forum Off Topic
    Replies: 5
    Last Post: - 7th July 2008, 20:17

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts