Sonsivri
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
March 19, 2024, 10:49:17 10:49


Login with username, password and session length


Pages: [1]
Print
Author Topic: Sine Look UP Table  (Read 15531 times)
0 Members and 1 Guest are viewing this topic.
king
Junior Member
**
Offline Offline

Posts: 84

Thank You
-Given: 2
-Receive: 21


Jack of All But Master of One


« on: May 25, 2009, 09:17:04 09: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 26, 2009, 03:22:44 03: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

The Demo of this algorithm can be downloaded at http://www.hotshare.net/file/143979-353940116c.html
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 Offline

Posts: 84

Thank You
-Given: 2
-Receive: 21


Jack of All But Master of One


« Reply #2 on: May 28, 2009, 11:13:56 11: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 Offline

Posts: 442

Thank You
-Given: 166
-Receive: 149



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

 Huh Roll Eyes


;*******************************************************************************
;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
   addwf   PCL,F

   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
*
Offline Offline

Posts: 22

Thank You
-Given: 11
-Receive: 7


« Reply #4 on: May 29, 2009, 11:00:28 11: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]
Print
Jump to:  


DISCLAIMER
WE DONT HOST ANY ILLEGAL FILES ON THE SERVER
USE CONTACT US TO REPORT ILLEGAL FILES
ADMINISTRATORS CANNOT BE HELD RESPONSIBLE FOR USERS POSTS AND LINKS

... Copyright © 2003-2999 Sonsivri.to ...
Powered by SMF 1.1.18 | SMF © 2006-2009, Simple Machines LLC | HarzeM Dilber MC