Can't send a Reserved Word to math coprocessor


Closed Thread
Results 1 to 4 of 4
  1. #1
    Join Date
    Dec 2008
    Posts
    16

    Default Can't send a Reserved Word to math coprocessor

    I am sending instructions from my 16f887 to a uM-FPU V3 32-bit floating point coprocessor. All works well until I try to do trig and must send commands that use the words SIN or COS. Since these are reserved words the program refuses to compile.

    The details:

    The instruction set I am trying to send from Pic to coprocessor:
    SHIFTOUT FpuOut, FpuClk, MSBFIRST, [SELECTA, p1, LEFT, FSET, Lon2, FSUB, Lon1, SIN, RIGHT, FSET0, LEFT, FSET, Lat2, COS, RIGHT, FMUL0]


    The problem is that the FPU chip needs "SIN" and "COS" as part of its instructions. Microcode studio gives me error 239 when compiling because these are reserved words.

    Does anyone see a workaround for this problem?

    Thanks.

  2. #2
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,520


    Did you find this post helpful? Yes | No

    Default

    Aren't all the commands just OPCodes, ie each command "name" is assigned a constant value at the beginning of the program, like:
    Code:
    SIN CON $47
    COS CON $48
    A workaround would be to simply rename the SIN and COS to SINUS and COSINUS and assign the correct OPCode to that name instead, like:
    Code:
    SINUS CON $47
    COSINUS CON $48
    Then you use SINUS and COSINUS in the Shiftout statment instead of SIN and COS

    Another workaround is to simply replace the the constants SIN and COS in the Shiftout statement with their respective OPCodes.

    /Henrik.
    Last edited by HenrikOlsson; - 5th October 2009 at 18:28.

  3. #3
    Join Date
    Dec 2008
    Posts
    16


    Did you find this post helpful? Yes | No

    Default

    Well, when you put it that way it just sounds so simple....

    Thanks for your help Henrik. I'm sure that'll work.

  4. #4
    camtmicromega's Avatar
    camtmicromega Guest


    Did you find this post helpful? Yes | No

    Default

    The support files for using the uM-FPU V3.1 chip with PicBasic Pro already have definitions for all the opcodes. Any opcode that conflicts with a reserved word has an F_ prefix. e.g. SIN is F_SIN, COS is F_COS, etc.

    See any of the support files for a full list of the opcode definitions.
    e.g. template-spi.bas or template-i2c.bas

    The PBP support files are at:
    http://www.micromegacorp.com/downloads.html

Similar Threads

  1. Active low input?
    By CosMecc in forum mel PIC BASIC Pro
    Replies: 14
    Last Post: - 8th August 2010, 20:31
  2. RF Modules
    By tonyfelloni in forum mel PIC BASIC Pro
    Replies: 44
    Last Post: - 26th June 2010, 17:42
  3. Minimizing code space
    By Tobias in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 30th May 2009, 07:25
  4. DS2760 Thermocouple Kit from Parallax in PicBasicPro
    By seanharmon in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 8th July 2008, 23:19
  5. calculation problem
    By nicolelawsc in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 31st March 2006, 15:23

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