assembly errors


Closed Thread
Results 1 to 4 of 4

Thread: assembly errors

  1. #1
    Join Date
    Feb 2005
    Location
    brookfield, ct, usa
    Posts
    24

    Default assembly errors

    Hello all

    I'm working on a way to monitor a quadrature encoder feeding back to a VFD to independantly verify that the drive and motor have decelerated when commanded to do so. My program, below, compiles but then I get the follow-wing error message "error decel~1.asm 96: [226] numeric constant or symbol name expected" as an assembler error. How do I find where my error is? I can't find anything in the manual or on the list.

    any help is appreciated.

    Take care

    Alec




    '************************************************* ***************
    '* Name : decel_check.pbp *
    '* Author : Alec Noble *
    '* Notice : Copyright (c) 2006 Alec Noble *
    '* : All Rights Reserved *
    '* Date : 7/11/2006 *
    '* Version : 1.0 *
    '* Notes : pic 16F628a *
    '* : *
    '************************************************* ***************
    DEFINE OSC 4 ' Set the Xtal frequency to 4mHz
    @ device pic16f628a, INTRC_OSC_NOCLKOUT,
    ' ** Declare LCDOUT Defines **

    DEFINE LCD_DREG PortB ' Set Data to PortB
    DEFINE LCD_DBIT 4 ' Set starting Data to Bit4
    DEFINE LCD_RSREG PortB ' Set Register Select to PortB
    DEFINE LCD_RSBIT 2 ' Set RS line to PORTB.2
    DEFINE LCD_EREG PortB ' Set Enable to PortB
    DEFINE LCD_EBIT 3 ' Set Enable line to PortB.3
    DEFINE LCD_BITS 4 ' Set for 4 bit Bus
    DEFINE LCD_LINES 4 ' Set number of lines to 2
    Define LCD_DATAUS 50 ' Data Delay (uS)
    ' ** Define LCD Control Constants **

    I Con 254 ' Control Byte
    Clr Con 1 ' Clear the display
    Line1 Con 128 ' Point to beginning of line 1
    Line2 Con 192 ' Point to beginning of line 2
    Line3 Con 148 ' Point to beginning of line 3
    Line4 Con 212 ' Point to beginning of line 4
    Cgram Con 64 ' Point to Cgram within LCD
    Shift_L Con 24 ' Shift display left
    Shift_R Con 28 ' Shift display right


    ' ** Declare I/O **

    up_btn var portb.0
    dn_btn var portb.1
    entr_btn var porta.4
    A var porta.0
    A_ var porta.1
    B var porta.2
    B_ var porta.3
    relay1 var porta.6
    relay2 var porta.7

    ' ** Declare the Variables **
    RPM var word 'Motor rpm
    setpoint1 var word
    setpoint2 var word
    freq var word
    ppr var word 'encoder pulse/rev
    ppr_index var byte 'index to make setting ppr easier

    ' ** initialize variables from RAM **

    read 0, ppr_index
    read 2, setpoint1.byte0
    read 3, setpoint1.byte1
    read 4, setpoint2.byte0
    read 5, setpoint2.byte1

    ' ** initialize variables **
    RPM = 0
    freq = 0
    PPR = 0

    ' ** initialize ouputs **
    relay1 = 0
    relay2 = 0

    ' ** Set Registers **

    cmcon = 7
    trisb = %00000011 'port b pins 0 and 1 input, 2 - 7 output
    trisa = %00111111 'port a pins 0 - 5 input, 6 and 7 output


    ' ** enable LCD display **

    pause 500 'allow lcd to wake up
    lcdout I, CLR 'clear lcd
    pause 50

    gosub banner 'toot my own horn - what the hell...

    ' ** Program starts here **

    main:

    if entr_btn = 0 then gosub configure
    lookup ppr_index,[4,8,16,32,64,128], ppr
    ppr = ppr * 16 'convert ppr_index lookup value to encoder ppr
    count A, 1000, freq 'read pulses from encoder for 1000 ms
    RPM = 60 * (freq / ppr) 'convert pulses/sec into RPM

    if rpm < setpoint1 then 'compare rpm to setpoint 1
    relay1 = 1 'if rpm less than setpoint energize relay 1
    else
    relay1 = 0 'if rpm greater than setpoint 1 turn relay 1 off
    endif

    if RPM < setpoint2 then 'compare rpm to setpoint 2
    relay2 = 1 'if rpm less than sepoint2 energize relay 2
    else
    relay2 = 0 'if rpm greater than setpoint2 turn relay 2 off
    endif


    lcdout I, line1, "DECEL CHECK"
    lcdout I, Line2, "RPM = ", dec4 rpm 'display current rpm
    if rpm<setpoint1 then
    lcdout I, line3, dec4 setpoint1, " relay1 on" 'display setpoint1, indicate relay 1 on
    else
    lcdout I, line3, dec4 setpoint1, " relay1 off" 'display setpoint1, indicate relay 1 off
    endif
    if rpm<setpoint2 then
    lcdout i,line4, dec4 setpoint2, " relay2 on" 'display setpoint2, indicate relay 2 on
    else
    lcdout I, line4, dec4 setpoint2, " relay2 off" 'display setpoint2, indicate relay 2 off
    endif
    goto main 'do it again, and again, and again...

    ' ** subroutines **

    Configure: 'routine to set ppr and rpm setpoints
    pause 10 'debounce
    if entr_btn = 1 then main
    pause 2000 'make sure enter button pushed for more than 2 seconds
    if entr_btn = 1 then main
    while entr_btn = 0 :wend 'wait until enter button released
    gosub set_ppr
    gosub set_setpoint1
    gosub set_setpoint2
    return

    set_ppr:
    for ppr_index = 0 to 5 'allow ppr_index to have values of 0 - 5
    lookup ppr_index, [4, 8, 16, 32, 64, 128], ppr'lookup ppr
    ppr = ppr * 16
    lcdout i, clr,I, line1, "PPR = ", dec4 ppr 'display ppr
    loop1:
    if entr_btn = 0 then pause 20'debounce enter button
    if entr_btn = 0 then getout1 'if enter button pressed get out of loop
    if up_btn = 1 then loop1 'stay in waiting loop until a button is pressed
    while up_btn = 0 :wend 'wait for up_btn to be released
    next ppr_index 'go to next ppr valu
    getout1:
    while entr_btn = 0 :wend 'wait for enter button to be released
    write 0, ppr_index 'write set value of ppr to rom
    return

    set_setpoint1:
    lcdout i, clr,I, line1, "setpoint1 = ", dec4 setpoint1 'display setpoint1
    if entr_btn = 0 then pause 20 'debounce enter button
    if entr_btn = 0 then
    while entr_btn = 0 :wend 'wait for enter button to be released
    write 2, setpoint1.byte0
    write 3, setpoint1.byte1
    return
    endif
    if up_btn = 0 then setpoint1 = setpoint1 + 10 'increment if up button pressed
    if dn_btn = 0 then setpoint1 = setpoint1 - 10 'decrement if down button pressed
    pause 100
    goto set_setpoint1


    set_setpoint2:
    lcdout i, clr,I, line1, "setpoint2 = ", dec4 setpoint2 'display setpoint2
    if entr_btn = 0 then pause 20 'debounce enter button
    if entr_btn = 0 then
    while entr_btn = 0 :wend 'wait for enter button to be relaesed
    write 4, setpoint2.byte0
    write 5, setpoint2.byte1
    return
    endif
    if up_btn = 0 then setpoint2 = setpoint2 + 10 'increment if up button pressed
    if dn_btn = 0 then setpoint2 = setpoint2 - 10 'decrement if down button pressed
    pause 100
    goto set_setpoint2

    Banner:
    lcdout i, clr, i, line1, "decelcheck mod"
    lcdout i, line2, "by alec noble"
    lcdout I, line3, "firmware rev0"
    lcdout i, line4, "hardware rev0"
    pause 10000
    return

  2. #2
    Join Date
    May 2004
    Location
    New England
    Posts
    164


    Did you find this post helpful? Yes | No

    Default

    Hi Alec,

    How do I find where my error is? I can't find anything in the manual or on the list.
    Assuming you're using PM (not MPASM), you can find a list of error descriptions in your PBP directory in a file called "pm.txt" (sometimes the descriptions don't help all that much).

    The error should be found on line 96 of your assembled "asm" file.

    Arch
    "Data sheets? I ain't got no data sheets. I don't need no data sheets. I don't have to read any stinking data sheets!"

  3. #3
    Join Date
    Feb 2005
    Location
    brookfield, ct, usa
    Posts
    24


    Did you find this post helpful? Yes | No

    Default

    Thanks Arch
    I dumped the .asm file into excel to get line numbers, and line 96 was blank, right after @ device pic16f628a, INTRC_OSC_NOCLKOUT. I'd had an exrta comma in the file - took that out and it compiled OK.
    I would never have seen that...
    Live and learn - lets see if we can make it work now that I've got a program that compiles...
    Thanks again - take care
    Alec

  4. #4
    Join Date
    May 2004
    Location
    New England
    Posts
    164


    Did you find this post helpful? Yes | No

    Default

    Good to hear you found the problem :-)
    I've never figured out why the line numbers don't match up, but the problem is usually nearby somewhere - as you found out.

    Arch
    "Data sheets? I ain't got no data sheets. I don't need no data sheets. I don't have to read any stinking data sheets!"

Similar Threads

  1. Compilation errors - strange
    By tetanus4 in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 24th October 2009, 19:04
  2. Picbasic Pro Demo assembly errors
    By mikeRho in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 2nd January 2008, 06:41
  3. Assembly Guru : Question
    By Archangel in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 20th May 2007, 03:51
  4. Microcode Studio Plus compile/assmebly errors
    By mikehagans in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 18th February 2006, 21:31
  5. How do you do this in Assembly
    By ice in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 10th May 2005, 06:47

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