Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
robotis_tools
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
humanoides
robotis_tools
Commits
19ab9850
Commit
19ab9850
authored
11 years ago
by
Patrick John Grosch Obregon
Browse files
Options
Downloads
Patches
Plain Diff
rx28 firmware ctrl cycle work - multiple turns - PD controler - no space for PID
parent
7826de00
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
servo_firmware/rx28/src/main.c
+30
-26
30 additions, 26 deletions
servo_firmware/rx28/src/main.c
with
30 additions
and
26 deletions
servo_firmware/rx28/src/main.c
+
30
−
26
View file @
19ab9850
#include
<avr/io.h>
#include
<util/delay.h>
#include
<avr/interrupt.h>
//
#include <avr/eeprom.h>
#include
<avr/eeprom.h>
#include
"CFG_HW_Dynamixel.h"
//#include "TXRX_Dynamixel.h"
#include
"CTRL_Dynamixel.h"
...
...
@@ -18,26 +18,19 @@ ISR( TIMER0_OVF_vect) {
//cli(); // disable all interrupts just to make sure
TorqueEnable
=
Read_byte_Dynamixel_RAM
(
Torque_Enable
);
if
(
TorqueEnable
==
1
)
{
//if (0) {
//ENABLE_MOTOR;
DISABLE_MOTOR
;
ENABLE_MOTOR
;
count
++
;
count2
=
Read_Sensor
(
CTRL_Encoder_Port
);
//if (count == 1) {
if
(
count
>
count2
)
{
LedTOGGLE
;
//Control_Cycle();
//HW_Security();
//Write_Actuator();
count
=
0
;
}
if
(
count
==
1023
)
{
if
(
count
==
1
)
{
//LedTOGGLE;
Control_Cycle
();
HW_Security
();
Write_Actuator
();
count
=
0
;
}
}
else
{
DISABLE_MOTOR
;
SET_
C
CW_PWM_MOTOR
(
0
);
//PB1 => set PWM for X% duty cycle max 0x3ff o 1023 // funciona
SET_CW_PWM_MOTOR
(
0
);
//PB2 => set PWM for Y% duty cycle max 0x3ff o 1023 // funciona
SET_CW_PWM_MOTOR
(
0
);
//PB1 => set PWM for X% duty cycle max 0x3ff o 1023 // funciona
SET_
C
CW_PWM_MOTOR
(
0
);
//PB2 => set PWM for Y% duty cycle max 0x3ff o 1023 // funciona
//LedTOGGLE;
}
}
...
...
@@ -46,22 +39,21 @@ ISR( TIMER0_OVF_vect) {
int16_t
main
(
void
)
{
unsigned
char
data
[
128
],
id
,
length
,
instruction
,
answer
[
2
],
status
,
en_vector
,
i
,
j
;
uint16_t
ii
,
jj
;
// list of read only registers - to exclude from write
/*unsigned char read_only_vector[30] = { 0, 1, 2, 36, 37, 38, 39, 40, 41, 42,
43, 44, 45, 46, 67, 68, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 83,
84, 85, 86 };*/
// ini eeprom if first time after run reflash system
/*if (eeprom_read_byte((uint8_t*) Gate_Restore_Eeprom) != 0xCC) {
Restore_Eeprom_Factory_Values(); //once this procedure is held, no more initialization is performed
//blinkLedN(3);
}*/
// ini eeprom if first time after run reflash system
if
(
eeprom_read_byte
((
uint8_t
*
)
Gate_Restore_Eeprom
)
!=
0xCC
)
{
Restore_Eeprom_Factory_Values
();
//once this procedure is held, no more initialization is performed
}
//------EEPROM initial values-------------
/*Restore_EepromVAR();
//blinkLedN(5);
// get value of Motor ID
rs485_address = eepromVAR[ID];*/
//------EEPROM initial values-------------
Restore_EepromVAR
();
// get value of Motor ID
//rs485_address = eepromVAR[ID];
// configure AVR chip i/o
Config_Hardware
();
...
...
@@ -72,8 +64,20 @@ int16_t main(void) {
// end of inicialization
LedOFF
;
ii
=
0
;
jj
=
1
;
while
(
1
)
{
Write_word_Dynamixel_RAM
(
Goal_Position_L
,
ii
);
_delay_ms
(
500
);
// funciona
//ii=500;
ii
=
ii
+
100
*
jj
;
LedTOGGLE
;
if
(
ii
==
900
)
{
jj
=-
1
;}
if
(
ii
==
100
)
{
jj
=
1
;}
/*status = RxRS485Packet(&id, &instruction, &length, data);
if (status == CHECK_ERROR) {
TxRS485Packet(rs485_address, CHECKSUM_ERROR, 0, NULL);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment