Menu

help! assembler errors.

Help
2009-09-14
2013-05-30
  • Andrei Cociuba

    Andrei Cociuba - 2009-09-14

    i have a pic12f675 controlling a motor. the motor has a separate isolated controller.
    one pin drives the motor one way
    the other pin drives the motor the other way.
    the motor spins a wheel via a gearbox and a rubber band.
    the wheel has two sensors: one goes high when the wheel is turned to maximum, the other when it is to minimum.

    the code:
    #chip 12F675, 4
    #config MCLRE = Off, Osc = Int 'Turn off MCLR, select internal osc.

    #DEFINE turnon GPIO.0
    #DEFINE turnoff GPIO.1

    dir gpio in

    main:

    gosub initialize
    epread(1,maxsteps)
    limit = maxsteps / 2
    for counter=1 to limit
    gosub stepon
    next

    goto main

    initialize:
    'first turn everything off
    dir turnoff out
    set turnoff on
    wait 5 s
    set turnoff off
    dir turnoff in

    'read input state
    gosub readstate

    'count steps to full on, starting when lower switch is released
    do until empty=0
    gosub readstate
    gosub stepon
    loop

    steps=0
    do until full=1
    gosub readstate
    gosub stepon
    steps=steps+1
    loop

    'write steps from empty to full into eeprom
    epwrite(1,steps)
    steps=0

    dir turnoff out
    set turnoff on
    wait 5 s
    set turnoff off
    dir turnoff in
    curstate=0
    return

    readstate:
    full=gpio.2
    empty=gpio.3
    return

    stepon:
    dir turnon out
    set turnon on
    wait 50 10ms
    set turnon off
    dir turnon in
    curstate=curstate+1
    return

    stepoff:
    dir turnoff out
    set turnoff on
    wait 50 10ms
    set turnoff on
    dir turnoff in
    curstate=curstate-1
    return

    the errors:
    Program compiled successfully!

    Assembling program …
    Assembly failed due to the following errors:

    compiled.asm:109:Error  Symbol not previously defined (SysWaitTempS).
    compiled.asm:151:Error  Symbol not previously defined (SysWaitTempS).
    compiled.asm:160:Error  Illegal Character (,)
    compiled.asm:160:Error  Missing argument(s).
    compiled.asm:162:Error  Illegal Character (,)
    compiled.asm:162:Error  Missing argument(s).
    compiled.asm:163:Error  Illegal Character (,)
    compiled.asm:163:Error  Missing argument(s).
    compiled.asm:165:Error  Illegal Character (,)
    compiled.asm:165:Error  Missing argument(s).
    compiled.asm:242:Error  Symbol not previously defined (SysWaitTempS).

    Press any key to continue

    please help!

     
  • kent_twt4

    kent_twt4 - 2009-09-14

    Looks like the Sourceforge team tackled the code tag problem already.  The new forum features are like a breath of fresh air.

    Mostly  a syntax thing going on with the code. If using a symbol with a semicolon, then a goto is going to be expected, like:

        Main:
        mysub  ;or use call mysub
        …
        …
        goto Main

    GCBasic is looking for something a little different for defining subroutines, like:

        sub mysub
        …
        …
        end sub  ;or use return if you like

    Generally speaking, one woulldn't want floating inputs, so best just to define those needed to start with, even if you change them later.  If you set internal pullups on, or have pull down/up resistors, then no problem. 

        dir GPIO b'001100'  ; make GPIO.2 and GPIO.3 inputs

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.