Hi, Thanks
It’s written for the public, but that’s not a promise yet.
It does go: user program, library, hardware driver... but it’s still less than a week into the software part.
Jerson, I want to mux the 8 data lines with a shift register next time, and slow it down to gain 6 pins,
but I don’t think it will suffer much. Part of the reason the final thing will be different, or configureable.
Ioannis, To rotate the objects, every pixel in the object has to be rotated on one axis or another.
Only one axis for 2D rotation. For the cubes, I was able to do that on the character display in PBP
because the points for the 3D cube were pre-generated on another platform first.
To draw the cube you only have to rotate it’s 8 points, and draw lines between the rotated points, so it’s not very costly.
The code to rotate one point in C reads like BASIC. The x,y input data is destroyed, and the x,y value a that end is the rotated value.
Rotated around a centre point approximation for 128x64 display. rotation is an integer input in degrees 0-359.
Code:
double d2r = 0.0174532925199433; // (PI / 180.0)
long double theta;
long double thetab;
int rotation;
int xx;
int yy;
int xnew;
int ynew;
int rx;
int ry;
int ox = 64; // screen centre pixel coordinates
int oy = 32; //
theta = rotation; // pre calculation
thetab = 360 - theta;
thetab = d2r * theta;
xx = x; yy = y;
rx = xx - ox; ry = yy - oy;
xnew = cos(thetab)*rx - sin(thetab)*ry;
ynew = sin(thetab)*rx + cos(thetab)*ry;
xnew = xnew + ox; ynew = ynew + oy;
x = xnew; y = ynew;
That was the only reason to use a dsPic and C30 for this.
The display isn’t written in sequential horizontal lines, so everything else in the software is
bit manipulation which would all be much better done with PBP/asm with a slower micro.
Bookmarks