Entire Forum This board This topic Members Entire Site
 Pages: [1]
 Author Topic: Sine Look UP Table  (Read 13115 times) 0 Members and 1 Guest are viewing this topic.
king
Junior Member

Offline

Posts: 84

Thank You
-Given: 2

Jack of All But Master of One

 « on: May 25, 2009, 03:17:04 03:17 »

Hi!
The code provided by the microchip for 3 Phase Induction motor control ,in this code they are using Sine look up, but from the code I don't understand that how they are taking the values for 3 phase which are 120 degree apart from each other from single Sine Look Up table which is from 270 degree to 90 degree with 10 Degree Resolution.
They are using the 3 offset pointer for 3 phases but what is the method of taking 3 values with the help of offset register which are 120 degree apart from each other from single SIN look up Table.

Please explain me if anybody read this code from application note "AN889".

Any kind of help will be highly appreciated.

Regards

KING
 Logged
LabBoy
Guest
 « Reply #1 on: May 25, 2009, 09:22:44 21:22 »

I am not sure that I understood your question, and also I haven't read the AN889.
I think you mean that how to look up a sine-table for 3-phase sine wave, am I right?
If YES, this is my suggestion,

For 10 degrees resolution of 1-cycle (0-360 degree) of sine wave,
the sine-table can be generate from 36 points data as the code belows:

Code:
#define res  10 // 10-degree resulution
#define n    360/10 // 36 points in a cycle
#define PI   3.1415926536
int i;
float st[n]; //sine-table
for(i=0; i<n; i++)
st[i] = sin(2.0*PI*i/(n-1));
Now, we have 36 points in a table st, it is the sine-table.
Code:
p1[i] = st[i]; // 0 degree
p2[i] = st[(i+(n/3))%(n-1)]; // 120 degree
p3[i] = st[(i+(2*n/3))%(n-1)]; // 270 degree

It was written by my friend (Santi Nuratch, Thailand).
If you need more details, you can contact me directly.
Regards,
LB.

 Logged
king
Junior Member

Offline

Posts: 84

Thank You
-Given: 2

Jack of All But Master of One

 « Reply #2 on: May 28, 2009, 05:13:56 05:13 »

Hi!
Yes I really mean that how to look up a sine-table for 3-phase by the help of 19 values of Sin which starts from 270 degree and ends at 90 degree with 10 degree resolution.
;*******************************************************************************
;EQUATION USED FOR CALCULATION OF SINE TABLE ENTRIES = (SIN(ANGLE)+1)*FF/2
;ANGLES ARE FROM 270 DEG. TO 90 DEG. STEP SIZE = 10 DEG.
;*******************************************************************************
Sine Table:
RETLW   0X00
RETLW   0X01
RETLW   0X07
RETLW   0X11
RETLW   0X1D
RETLW   0X2D
RETLW   0X3F
RETLW   0X53
RETLW   0X69
RETLW   0X7F
RETLW   0X95
RETLW   0XAB
RETLW   0XBF
RETLW   0XD1
RETLW   0XE1
RETLW   0XED
RETLW   0XF7
RETLW   0XFD
RETLW   0XFF
Please explain me the method of taking "Set of 3 values of Sine" at a time, from the table given above, which are 120 Degree apart from each other without using trigonometric Sin function.

Posted on: May 28, 2009, 12:08:10 12:08 - Automerged

Hi!
These are the codes of 3 Phase induction Motor  and they are using Sine Look Up table  for taking "3 sin values" which are 120 degree apart from each other. Please have a look at this.

Regards

King
 Logged
sohel
Senior Member

Offline

Posts: 438

Thank You
-Given: 148

 « Reply #3 on: May 28, 2009, 12:57:03 12:57 »

;*******************************************************************************
;EQUATION USED FOR CALCULATION OF SINE TABLE ENTRIES = (SIN(ANGLE)+1)*FF/2
;Sine table has value corresponding to every 10 electrical degrees
;*******************************************************************************

TABLE
SINE_TABLE

RETLW   .2
RETLW   .4
RETLW   .8
RETLW   .16
RETLW   .24
RETLW   .34
RETLW   .50
RETLW   .64
RETLW   .80
RETLW   .96
RETLW   .112
RETLW   .128
RETLW   .144
RETLW   .156
RETLW   .168
RETLW   .178
RETLW   .184
RETLW   .188
RETLW   .190

;*******************************************************************************
;THIS ROUTINE INITIALIZES THE PARAMETERS REQUIRED FOR MOTOR INITIALIZATION.
;*******************************************************************************
INIT_MOTOR_PARAMETERS
#ifdef PSC_MOTOR_CONTROL

movlw   0x012            ;INITIALIZE THE TABLE OFFSET TO 3 REGISTERS
movwf   TABLE_OFFSET1         ;TO FORM 0-120-240 DEGREES

movlw   0x00
movwf   TABLE_OFFSET2

movlw   0x08
movwf   TABLE_OFFSET3

bcf      FLAGS,OFFSET1_FLAG      ;OFFSET FLAGS INITIALIZATION
bsf      FLAGS,OFFSET2_FLAG

btfsc   FLAGS1,FWD_REV
goto   INIT_MOT_REV
bsf      FLAGS,OFFSET3_FLAG      ;Offset3 initialized
goto   INIT_MOT_FREQ
INIT_MOT_REV
bcf      FLAGS,OFFSET3_FLAG
#endif
#ifdef THREE_PHASE_MOTOR_CONTROL
movlw   0x09         ;Initialize the table offset to 3 registers
movwf   TABLE_OFFSET1      ;to form 0-120-240 degrees
bsf   FLAGS,OFFSET1_FLAG   ;Offset flags initialization

btfsc   FLAGS1,FWD_REV
goto   INIT_MOT_REV

movlw   0x03
movwf   TABLE_OFFSET2
bcf   FLAGS,OFFSET2_FLAG

movlw   0x0F
movwf   TABLE_OFFSET3
bcf   FLAGS,OFFSET3_FLAG
goto   INIT_MOT_FREQ

INIT_MOT_REV
movlw   0x0F
movwf   TABLE_OFFSET2
bcf   FLAGS,OFFSET2_FLAG

movlw   0x03
movwf   TABLE_OFFSET3
bcf   FLAGS,OFFSET3_FLAG

#endif

INIT_MOT_FREQ
movlw   0xB1
movwf   TMR0
bsf      FLAGS,MOTOR_FREQ_COUNTER
RETURN
 Logged

santi_inc
Newbie

Muted
Offline

Posts: 22

Thank You
-Given: 11

 « Reply #4 on: May 29, 2009, 05:00:28 05:00 »

Hello Everybody,
I posted the new version of the 3-Phase Sine wave Generator/Simulator at http://www.sonsivri.com/forum/index.php?topic=22872.0

Regards,
santi_inc
 Logged
 Pages: [1]