Floating point math and rand() help


JLS

Recommended Posts

Ok, here's a "libgcc.a" library fix for this.

 

http://alvie.com/zpuino/downloads/libgcc-fix-for-64bit-and-floatingpoint.zip

 

The zip file contains 4 libraries:

 

libgcc.a
fast/libgcc.a
small/libgcc.a
ludicrous/libgcc.a

 

Locate the "libgcc.a" installed in your system (should be four of them), they should be inside "hardware/tools/zpu/lib/gcc/zpu-elf/3.4.2/" for Windows and Mac. Make sure you don't overwrite AVR one instead.

Replace the four libraries in your system with the ones in the .zip file. If you're using linux, replace the ones in where you installed the toolchain.

 

If you only have one "libgcc.a", replace it with the fast version (fast/libgcc.a).

 

Let me know if this fixes all issues.

Link to comment
Share on other sites

Simple question. Im make chua oscillator sketch with deltasigma DAC. This working but dont understand how to write two independent DAC value. ( example DAC0 = x and DAC1 = y value )

 

 

#include <math.h>
      
  float x = 0.5;
  float y = 0.25;
  float z = 0.125;
  float oldx = 0;
  float oldy = 0;
  float oldz = 0;
  float h = 0;
  float dt = 0.005;
  float alpha = 15.6;
  float beta = 28.58;
  float a = -1.14286;
  float b = -0.714286;
  
  int outx,outy;
        
  int pindac0 = 0;
  int pindac1 = 1;
 
 
void setup() {
 
  pinMode(pindac0, OUTPUT);
  pinModePPS(pindac0, HIGH);
  outputPinForFunction(pindac0, 0);
  
  pinMode(pindac1, OUTPUT);
  pinModePPS(pindac1, HIGH);
  outputPinForFunction(pindac1, 0);
 
  
  SIGMADELTACTL = 0x03;
}
 
void loop(){
 
  oldx = x;
  oldy = y;
  oldz = z;
  
  h = (b * x) + (0.5 * ( a - b ) * (fabs(x+1) - fabs(x-1)));            
  x = oldx + dt * (alpha * (oldy - oldx - h));
  y = oldy + dt * (oldx - oldy + oldz);
  z = oldz + dt * (-beta * oldy);
        
  outx = 32768 + int(13500*x);
  outy = 32768 + 5 * int(13500*y);
   
  SIGMADELTADATA = outx;
 
 
 
Please help me with example two independent DAC.
 
Many thanks
 
Kamil
Link to comment
Share on other sites

sorry next few questions :-)

 

1. on your site is three different version bit file. Version with SID and VGA this two version not support deltasigma DAC ?

 

2. ZPUino support PWM on output PINs ? Please example thanks

 

3. Is possible make simple example how to basic run with SID POKEY and YM2149 ?

 

Many thanks help :-)

 

Kamil

Link to comment
Share on other sites

sorry next few questions :-)

 

1. on your site is three different version bit file. Version with SID and VGA this two version not support deltasigma DAC ?

 

2. ZPUino support PWM on output PINs ? Please example thanks

 

3. Is possible make simple example how to basic run with SID POKEY and YM2149 ?

Take a look at the RetroCade Sketch for examples and libraries for the SID and YM2149. POKEY to be added later, or maybe you might be interested in adding POKEY? Here is a RetroCade branch with POKEY.

 

 

Many thanks help :-)

 

Kamil

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.