Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > sci.electronics.design > #382719

Re: MPLAB build dies (linker prob)

From Robert Baer <robertbaer@localnet.com>
Newsgroups sci.electronics.design
Subject Re: MPLAB build dies (linker prob)
References <yhDWx.79926$pF6.30543@fx06.iad> <n0f63h$j8h$1@dont-email.me> <lUQWx.115281$756.50945@fx20.iad> <n0gs84$cq7$1@dont-email.me>
Message-ID <%EkXx.2095$0G6.183@fx17.iad> (permalink)
Date 2015-10-26 00:30 -0800

Show all headers | View raw


P E Schoen wrote:
> "Robert Baer" wrote in message news:lUQWx.115281$756.50945@fx20.iad...
>
>> Would like to have 5 tables filled with 1K RETLW <data>.
>> To linearly access using a pointer from 0 to 1023, one needs at least
>> 8 instructions for a call (or equivalent after a call to them).
>
>> I guess, after subtracting out necessary code space from 4096
>> locations, i might have 3840 locations or so.
>> That would leave me 768 data points per table,which is better than a
>> kick in the head.
>
>> If i assume i can have 3900 locations for data, that gives me 780 data
>> points per data table; add 8 each for code in the tables would take
>> 3940 leaving 156 locations for other support code.
>
>> Possible...
>
> Consider the fact that you have only 8 bits for waveform amplitude, so
> only 256 possible values. For a sine table, the values for 85 degrees to
> 95 degrees are 0.996 to 1.000, which vary only from 254 to 255. So,
> assuming that the table will be used for a repeating pattern, you would
> need at most 256 data points. You could construct a two-element table
> with one value for degrees and the other for amplitude. This could be
> done with 3*256 = 768 bytes, like this:
>
> Table:
> movlw 0 ;0 degrees
> movwf deg ;degrees
> retlw 0 ;Sin (0)
> movlw 1 ;1 degrees
> movwf deg ;degrees
> retlw 4 ;Sin (1)
> ...
> movlw 85 ;85 degrees
> movwf deg
> retlw d'254'
> movlw 90 ;90 degrees
> movwf deg
> retlw d'255'
>
> Notice that the lower part of the table shows a significant difference
> in value for the minimum angle of 1 degree. But at 85 degrees, the next
> significant change is at 90. Thus, for a sine table, where you really
> need only values from 0 to 90, you can implement the look-up in less
> than 90*3=270 bytes. And you could probably do the full 360 degrees by
> converting the angle to an 8 bit value where 360 = 0xff and 0x01 is
> actually 360/255= 1.41 degrees which happens to have a sine of 0.024 or
> an 8 bit representation of 0x06.
>
> The problem with a table like this is that you must first search for the
> angle by successive approximation, and then choose an angle that is
> closest to what you seek. And you must increment the call location by 3
> for each table entry.
>
> If the waveform you are trying to approximate is fairly smooth, you
> might get by with an ordinary look-up table for every five degrees, and
> use linear interpolation between data points. For a sine table, suppose
> you want the value at 3 degrees. The sin(0) is 0x00 and sin(5) is 0.087
> or d'22'. The interpolated value for sin(3) is (3/5)*(22-0) or 13, which
> corresponds to 0.0510, while the actual sin(3) = 0.0523. The error is
> less than 1 bit for an 8 bit amplitude value.
>
> HTH,
>
> Paul
>
   Well, for sin/cos one needs only the first 22.5 degrees; all else in 
the circle can easily be derived from that.

   And we are going to use arbitrary waveforms; the sin/triangle/square 
were for test purposes.

Back to sci.electronics.design | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

OT: MPLAB build dies (linker prob) Robert Baer <robertbaer@localnet.com> - 2015-10-23 20:54 -0700
  Re: OT: MPLAB build dies (linker prob) "P E Schoen" <paul@pstech-inc.com> - 2015-10-24 01:25 -0400
    Re: OT: MPLAB build dies (linker prob) Robert Baer <robertbaer@localnet.com> - 2015-10-24 11:43 -0700
      Re: OT: MPLAB build dies (linker prob) Martin Riddle <martin_ridd@verizon.net> - 2015-10-24 15:19 -0400
    Re: OT: MPLAB build dies (linker prob) Robert Baer <robertbaer@localnet.com> - 2015-10-26 00:27 -0800
  Re: OT: MPLAB build dies (linker prob) "P E Schoen" <paul@pstech-inc.com> - 2015-10-24 01:50 -0400
    Re: OT: MPLAB build dies (linker prob) Tauno Voipio <tauno.voipio@notused.fi.invalid> - 2015-10-24 11:07 +0300
    Re: OT: MPLAB build dies (linker prob) Robert Baer <robertbaer@localnet.com> - 2015-10-24 12:22 -0700
      Re: MPLAB build dies (linker prob) "P E Schoen" <paul@pstech-inc.com> - 2015-10-24 17:14 -0400
        Re: MPLAB build dies (linker prob) Robert Baer <robertbaer@localnet.com> - 2015-10-26 00:30 -0800
      Re: OT: MPLAB build dies (linker prob) M Philbrook <jamie_ka1lpa@charter.net> - 2015-10-24 21:35 -0400
        Re: OT: MPLAB build dies (linker prob) Robert Baer <robertbaer@localnet.com> - 2015-10-26 00:34 -0800
          Re: OT: MPLAB build dies (linker prob) Martin Brown <|||newspam|||@nezumi.demon.co.uk> - 2015-10-26 12:22 +0000
            Re: MPLAB build dies (linker prob) "P E Schoen" <paul@pstech-inc.com> - 2015-10-26 17:06 -0400
          Re: OT: MPLAB build dies (linker prob) M Philbrook <jamie_ka1lpa@charter.net> - 2015-10-26 20:31 -0500
            Re: MPLAB build dies (linker prob) "P E Schoen" <paul@pstech-inc.com> - 2015-10-26 21:15 -0400
              Re: MPLAB build dies (linker prob) M Philbrook <jamie_ka1lpa@charter.net> - 2015-10-26 21:35 -0500
  Re: OT: MPLAB build dies (linker prob) rickman <gnuarm@gmail.com> - 2015-10-27 03:07 -0400

csiph-web