Programming with PicBasic Compiler


Closed Thread
Results 1 to 6 of 6
  1. #1
    Raycher's Avatar
    Raycher Guest

    Unhappy Programming with PicBasic Compiler

    Hi, Iam trying to compile code given for the insectronics bot with the pic basic compiler but only get error messages (new to programming chips).
    Eg. Here is the code:

    temp var byte ' initialize variables
    freq var byte
    m_servo var byte
    l_servo var byte
    r_servo var byte

    portb.7 = 0 ' set initial logic states to 0
    portb.6 = 0
    portb.5 = 0

    freq = 13 ' delay value

    start:

    m_servo = 140 ' set servo position values
    l_servo = 140
    r_servo = 140

    gosub servo

    goto start


    servo: ' servo positioning subroutine
    for temp = 1 to 10
    pulsout portb.7,m_servo
    pulsout portb.6,l_servo
    pulsout portb.5,r_servo
    pause freq ' set frequency between 50 - 60 Hz
    next temp
    return

    If I try to compile this is the error messages I get:

    error servo- ~1.bas,8:':'or '=' expected (token 'var')
    error servo- ~1.bas,9:':'or '=' expected (token 'var')
    error servo- ~1.bas,10:':'or '=' expected (token 'var')
    error servo- ~1.bas,11:':'or '=' expected (token 'var')
    error servo- ~1.bas,12:':'or '=' expected (token 'var')
    error servo- ~1.bas,14:'illegal character '.'
    error servo- ~1.bas,14:':'or '=' expected (token '7')
    etc....etc..etc

    I will appreciate any help
    PS I use a 16F84A chip.

    Regards

  2. #2
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    Actually your posted example code compiles without error with the command line...

    pbp -p16f84a test

    Code:
    	temp var byte ' initialize variables
    	freq var byte
    	m_servo var byte
    	l_servo var byte
    	r_servo var byte
    
    	portb.7 = 0 ' set initial logic states to 0
    	portb.6 = 0
    	portb.5 = 0
    
    	freq = 13 ' delay value
    
    start:
    
    	m_servo = 140 ' set servo position values
    	l_servo = 140
    	r_servo = 140
    
    	gosub servo
    
    	goto start
    
    
    servo: ' servo positioning subroutine 
    	for temp = 1 to 10
    		pulsout portb.7,m_servo
    		pulsout portb.6,l_servo
    		pulsout portb.5,r_servo
    		pause freq ' set frequency between 50 - 60 Hz
    		next temp
    		return
    Ahh... pain... just realised your using PBC not the pro version... you are going to have to go through your manual and assign your variable names and Pins to allowed variables and pins.

  3. #3
    Raycher's Avatar
    Raycher Guest


    Did you find this post helpful? Yes | No

    Smile re:Programming with PicBasic Compiler

    Thanks! I will try again.

  4. #4
    Join Date
    Sep 2005
    Location
    Malaysia
    Posts
    42


    Did you find this post helpful? Yes | No

    Default

    hi raycher, was just wondering what your codes was used for? kinda interested in similar projects to do with servomotors. i've only just recently built a walking gait robot using servo motors with the help of melanie.
    -·=»‡«=·- saturnX -·=»‡«=·-

  5. #5
    Join Date
    Nov 2004
    Location
    Saskatchewan Canada
    Posts
    189


    Did you find this post helpful? Yes | No

    Default

    Looks like the code from that book with the 3 servo walking robot that I mentioned in the other thread.

    That book is also written in PCB Pro so converting it to basic would take a little more effort.

    Everyone building robots these days?

    Bart

  6. #6
    Raycher's Avatar
    Raycher Guest


    Did you find this post helpful? Yes | No

    Default

    Hi, the code were used for a insec bot. I used the book called "Insectronics" by Karl Williams to built a six legged insec - works pretty well once one can program the chip.

    Regards
    r

Similar Threads

  1. Experimenting with the PicBasic Pro Compiler
    By polymer52 in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 17th May 2016, 19:17
  2. Replies: 7
    Last Post: - 17th May 2016, 19:03
  3. Picbasic Pro compiler 2.60 error
    By Luckyborg in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 22nd January 2010, 05:55
  4. Replies: 3
    Last Post: - 1st July 2008, 21:07
  5. Picbasic VS C Compiler
    By koossa in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 11th October 2005, 21:44

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