patweadock
Member level 2
- Joined
- Feb 13, 2009
- Messages
- 42
- Helped
- 11
- Reputation
- 22
- Reaction score
- 7
- Trophy points
- 1,288
- Location
- Near Burlington, VT
- Activity points
- 1,616
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"
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"