Rules | Recent posts | topic RSS | Search | Register  | Log in

motor controlling PID IC


Goto page Previous  1, 2
Post new topic  Reply to topic    EDAboard.com Forum Index -> Industrial, Robotics and Automatics Forum -> motor controlling PID IC
Author Message
patweadock



Joined: 13 Feb 2009
Posts: 35
Helped: 3
Location: Near Burlington, VT


Post05 Mar 2009 4:19   

pid 1804 ic


I hope you remember that after writing the "1D" (reset interupts) command, you must check busy bit, then write "00" twice to reset all interupts. I think you should accept that C4 value for now and try to make a velocity or position move. If your write routine was not functioning, I think you would get a status indicating command error (C2). I don't write to the LM628 exactly the way the timing diagram shows, instead, I make CS low and PS hi (for data), then put the data on the pins, then strobe WRite low, then a short delay (at least 100nS), then WRite hi. In between each signal change, like CS and PS, I put a "NOP" (no operation) delay of one instruction cycle. I only load the filter value for proportion (Kp) in the LFIL command. Please let me know if you are successfull or other question. Pat
Back to top
inifinitrix



Joined: 30 Jul 2006
Posts: 80
Location: MALAYSIA


Post05 Mar 2009 6:32   

pid 4c06 ic


yeaa.. finally i get c0hex.. thanks pat.. but i had to put busy check between high byte and low byte.. is that ok? so now i can proceed to next subroutine..
Back to top
patweadock



Joined: 13 Feb 2009
Posts: 35
Helped: 3
Location: Near Burlington, VT


Post05 Mar 2009 16:21   

p i d controller ic


You should only need to check Busy Bit after instruction write or after second byte. Maybe you just needed a delay between 1st & 2nd bytes. Anyway, yea, go for the motion coding, I think you're on the fast track to success! The way I did it was to use + and - jogging keys that displayed position after key released and motor stopped. Please let me know .
Back to top
inifinitrix



Joined: 30 Jul 2006
Posts: 80
Location: MALAYSIA


Post06 Mar 2009 0:43   

motor encoder code asm


now i know why i put busy bit check and succeed,because it has 'PS=0' from RDSTAT condition.. so i just need to put PS=0 after write 1 byte data.what do you means by using + and - ? can you show me and explain the simplest program to move motor from encoder..
Back to top
patweadock



Joined: 13 Feb 2009
Posts: 35
Helped: 3
Location: Near Burlington, VT


Post06 Mar 2009 2:02   

picbasicpro pid routine


The "+" and "-" are keys on the keypad used to jog the motor in forward or reverse, this is how the robot is taught. I've attached the code for this with comments as usual. The first routine, "move" checks for + or _ key press and sends to cw or ccw routines, these initiate a velocity move and return to cwtst or ccwtst routines to wait for the key to not be pressed, then to stop routine, then to write position routine, then back to wait for another key pressed. The velocity and position move routines both load acceleration and velocity parameters. I realize this is not the simplest way to move , but it answers both of your questions. Please look this over and tell me if it's not clear enough. Pat


Sorry, but you need login in to view this attachment

Back to top
inifinitrix



Joined: 30 Jul 2006
Posts: 80
Location: MALAYSIA


Post08 Mar 2009 16:17   

pic basic pid motor pwm


pat,for lm628,what value for DAC port for forward and reverse.. so far the output for DAC port is 00000001 binary.. how do i know that i've succeed in write filter coefficient,acceleration,velocity n position..
Back to top
patweadock



Joined: 13 Feb 2009
Posts: 35
Helped: 3
Location: Near Burlington, VT


Post09 Mar 2009 1:09   

dual motor pid code -globalspec


From the datasheet;
"The LM628 DAC output port can be configured to provide
either a latched eight-bit parallel output or a multiplexed
12-bit output. The 8-bit output can be directly connected to a
flow-through (non-input-latching) D/A converter; the 12-bit
output can be easily demultiplexed using an external 6-bit
latch and an input-latching 12-bit D/A converter. The DAC
output data is offset-binary coded; the 8-bit code for zero is
80 hex and the 12-bit code for zero is 800 hex. Values less
than these cause a negative torque to be applied to the
motor and, conversely, larger values cause positive motor
torque."

So it should be binary 1000000, with the "1" on pin 18 (the Most Significant Bit) when commanded not to move. Binary 00000001 would mean maximum torque in the reverse direction... Unless it's configured for 12 bit mode...? I found that it defaults to 8 bit mode and never had to configure it either way, since I'm using 8 bit mode.
So if you're getting HEX 01 after commanding a reverse direction move, you probably are working correctly. If you're getting the 01 before a move command, maybe it's somehow configured itself into 12 bit mode? Does the status byte give any clues? like indicating command error, or trajectory complete?
Also, does the DAC you are using have differential outputs? like "out+" and "out-"? Because this is what the circuit assumes - that your DAC will have no current (0 Volts) between the outputs when binary 10000000 is apllied to the inputs.
Back to top
inifinitrix



Joined: 30 Jul 2006
Posts: 80
Location: MALAYSIA


Post09 Mar 2009 1:38   

ic 324 for dc motor


ooh.. sorry actually it is 1000000 binary.. like i told before,i just use another PiC to convert to pwm, before this i though 00000000 is motor off.. then it means that i still cannot move the motor.. i think my program failed to write Acceleration,Velocity and Position value..
Back to top
patweadock



Joined: 13 Feb 2009
Posts: 35
Helped: 3
Location: Near Burlington, VT


Post09 Mar 2009 22:01   

bord lm628


Here's the sequence for an "absolute velocity move";
1E ;load filter, PS = low for instruction
BB ;check busy bit
00 ;PS = hi for data
18 ;means Kp only to be loaded
BB ;PS is low to check busy bit
00 ;Kp hi byte, PS hi for data
80 ; Kp low byte = dec255
BB ;PS is low to check busy bit
04 ; UDF (update filter) PS is low for instruction
BB ;PS is low to check busy bit
1F ;LTRJ (load trajectory) PS low
BB ;PS is low to check busy bit
18 ;PS is hi, 18 means absolute velocity, forward
28 ;means velocity and acc to be loaded
BB ;PS is low to check busy bit
00 ; Acc hi word, hi byte, PS is hi for data
00 ;Acc hi word, lo byte
BB PS is low to check busy bit
00 ; Acc lo wrd, hi byte
08 ; lo wrd, lo byte
BB ;PS is low to check busy bit
00 ;Vel hi word, hi byte, PS is hi for data
00 ;VHL
BB
0A ;VLH
4A ;VLL
BB
01 ;STT (start trajectory), PS is lo for instruction.
These bytes must be loaded by routines that pay strict attention to timing and bit state. Review the previous post with the timing diagrams and code. Remember; The Port Select bit must be high for data and low for instructions, also, you must use the "BB" busy bit check routine after each instruction and after writing or reading two data bytes. If you write the status byte to the display when you check the busy bit, then delay for a couple of seconds so you can read it, you will be able to troubleshoot easily and see the status as you go. If you want, I could send you a DAC or two, free of charge. I could also write the "position move sequence" in a similiar way.
You could use bit #8 (pin 18 ) of the LM628 output as a direction bit and then use the remaining 7 bits as PWM magnitude if you really want to continue using the other PIC for PWM. Please let me know how it's going. Pat
Back to top
inifinitrix



Joined: 30 Jul 2006
Posts: 80
Location: MALAYSIA


Post12 Mar 2009 15:40   

motor pid


pat.. my motor still cannot move.. i try to change some of program but failed.. Sad i has load the value for velocity=00 00 01 42,but then i read from RDDV= 00 08 07 07.should they have same value? or something wrong with my program when read or write..
Back to top
patweadock



Joined: 13 Feb 2009
Posts: 35
Helped: 3
Location: Near Burlington, VT


Post13 Mar 2009 2:20   

lm324 pid


I've attached a .doc file that describes the code I use to read data from the LM628, maybe you will see something helpfull. The numbers you've recorded here may be correct. It's not supposed to read back the same numbers you write into it. The 07 07 is fractional value and the 08 may be the velocity it wants to start ramping at to reach your inputted velocity. It would probably be more helpfull to record the status byte and / or the "signals register" ( command "0C" - RDSIGS ) after writing the velocity move. Also, try reading the DAC output pins to see if they change from being "80" after velocity write. I'de like to take a look at the code you're using.
*Make sure you commanded a relative velocity
*Try "defining home" ( Command "02" - DFH ) , then read the position register (command 0A - RDRP ), this should come back as all zero's.
According to the datasheet, about the RDDV command ;
"This command reads the integer and fractional portions of
the instantaneous desired (current temporal ) velocity, as
used to generate the desired position profile. The bytes are
read in most-to-least significant order. The value read is
properly scaled for numerical comparison with the usersupplied
(commanded) velocity; however, because the two
least-significant bytes represent fractional velocity, only the
two most-significant bytes are appropriate for comparison
with the data obtained via command RDRV (see below).
Also note that, although the velocity input data is constrained
to positive numbers (see command LTRJ), the data returned
by command RDDV represents a signed quantity where
negative numbers represent operation in the reverse direction"



Sorry, but you need login in to view this attachment

Back to top
swakit



Joined: 02 Jun 2009
Posts: 4


Post02 Jun 2009 8:58   

dspic30f pid asm example


Hi Pat it seems you have a great knowledge about LM628
So i am writing this in a hope that you will help me
M using atmega128 lm629-6 and optical encoder without index o/p
i have connected control signals of lm629 ie cs ps rd wr etc to portA of mega128
data port is connected to portC
m operating lm629 at freq of 1.7MHz
till now i could successfully reset lm629 i also could reset its interrupts by RSTI and got status byte as CO hex
problem is after this i tried to load filter parameters i got no command error intrrupt then i loaded trajectory neither the motor moved nor could i read back parameters i loaded.
in filter i loaded jst Kp=10;
in trajectory i loaded velocity n position as 0x346E and 0x1F40 i also took care of loading higher siginificant word as0x0000 in both cases but when i read desired position through RDDP i get all zeros
wat can b the error M i making mistake while writin or while reading?
please help m wasting my time over that since 3 days
Back to top
patweadock



Joined: 13 Feb 2009
Posts: 35
Helped: 3
Location: Near Burlington, VT


Post02 Jun 2009 18:03   

lm628 + dc motor how to conect


I would need to see the code to check for errors. There are so many possible mistakes it would be difficult to guess. If you were able to RSTI then you must be switching the control signals (CS, PS, WR, RD) correctly. I assume you're checking the Busy Bit and using the LTRJ and STT commands correctly. It sounds like the wireing is good between the processor and LM629. Make sure pin 4 (brake) on the LMD18200 is low and toggle the PWM pin 5 to see if the outputs are switching. You may want to try a larger value for Kp until you get the bugs worked out. Good luck and please let me know how it's going. Pat
Back to top
swakit



Joined: 02 Jun 2009
Posts: 4


Post03 Jun 2009 7:13   

pid motor ic


Please dont laugh at me when I say this-
I had given just 7V to motor driver when i swithched it to 12V now its working.

Though its working (ie I am using it in velocity mode and i have fed values posted by you in this forum- Kp = 0x80, accln = 0x08 and velocity = 0x0A4A i have written higher bytes to 0 dnt worry about that) when i read velocity; what i read is desired velocity = 0x00000008 and real velocity = 0x0000
I am unable to understand this should not these values match with inputted values?

Thanx neways for your contribution.
Plz rply soon....
Back to top
swakit



Joined: 02 Jun 2009
Posts: 4


Post10 Jun 2009 11:07   

pid pwm ic


There is a good news and a bad news.
Good news is with the new hardware i was able to run motor both in vel as well as in positoin mode, motor ran accurately and precisely as per given values. So my day ended with a successful smile. today morning when i came back and just switched it on it is not working.
Not working means following:
1. I am able to reset LM629.
2. I am able to read from it as well as write into it.
3. I am entering some calculated values (which worked last day) for velocity accln and position etc and i am able to read them back from LM629 in spite of this my motor is running at top speed and is not even halting after specified count of position.
4. I am also able to read actual velocity and that seems right ie i think encoder o/p is fine and LM629 is also able to read it.
What can be the problem? I am unable to decipher it? Can you give me some clue?!

Well please check your mail i have messaged you.
Bye. please reply soon...

Added after 3 hours 48 minutes:

Yesss I got it.
I had connected my motor in reverse polarity so it was expecting different waveform at a and b and was getting opposite of that now i got it and it is working fine.
Back to top
swakit



Joined: 02 Jun 2009
Posts: 4


Post01 Jul 2009 11:05   

74138 keypad example


Pat,

Initially I started with crystal oscillator using schmitt trigger and not gate. Though i used crystal of 4MHz i could not get frequency more than 2MHz. My seniors told me that it is impossible to get anything better than that with that osc. So just to make my operation faster i decided to change my clocking source. I came across 89V51RD2; its ALE signal can be used for clocking. I checked it i am getting frequency of around 4MHz as expected but duty cycle is not 50% its 33.33%. I wanted to ask whether this will do for LM629 or not.

Can you please help or shed some light on clock specifications required by LM629. Will it work on clock with 30% duty cycle?

Please reply soon....
Back to top
Google
AdSense
Google Adsense




Post01 Jul 2009 11:05   

Ads




Back to top
Arabic versionBulgarian versionCatalan versionCzech versionDanish versionGerman versionGreek versionEnglish versionSpanish versionFinnish versionFrench versionHindi versionCroatian versionIndonesian versionItalian versionHebrew versionJapanese versionKorean versionLithuanian versionLatvian versionDutch versionNorwegian versionPolish versionPortuguese versionRomanian versionRussian versionSlovak versionSlovenian versionSerbian versionSwedish versionTagalog versionUkrainian versionVietnamese versionChinese version
Post new topic  Reply to topic    EDAboard.com Forum Index -> Industrial, Robotics and Automatics Forum -> motor controlling PID IC
Page 2 of 2 All times are GMT + 1 Hour
Goto page Previous  1, 2
Similar topics:
Controlling adc motor (1)
Hard Disk Motor Controlling (6)
controlling the motor speed!!!! (3)
controlling dc motor speed (2)
analog joystick controlling stepper motor (3)
Codes for controlling stepper motor (1)
Controlling Servo Motor using a PC (16)
controlling servo motor with 89C51 (1)
Controlling servo motor.. need help.. (3)
time controlling of dc motor (8)


Abuse || Administrator || Moderators || Support us || sitemap
topic RSS