by i-Bot » Tue Oct 31, 2006 5:33 pm
by i-Bot
Tue Oct 31, 2006 5:33 pm
It has been a while since we had any posts on this topic, so I thought I would give an update, and pause for a sanity check from Dan and others of what I have done to date.
We did see a new version of Robobasic, but the C3024 payload was the the same as before dated Oct 2005. !!Happy Birthday !!
I have entered the schematic, board and library into Eagle. I have not routed, and some of the library is still not quite right. I did not find the jack socket they use anywhere, and although I have data on the buzzer and the switch, I have found no supplier. I decided to do some more work on the firmware before making new boards, which was just as well, since things I found there have changed my board design. Specifically, I will drop the buzzer, the spare LED driver, and the RS232 driver. Since I use JTAG, I will need this, but consequently loose AD4 to AD7 and 2 gyros, Also I lose the Remote control unless I move to another pin. Also the serial port needs flow control if I use higher speeds and more than one character at a time, this is due to the large amount of hime the code spends in the interrupt routines. So I plan to use an FDTI 232R and go USB.
For the firmware I took the assembler routines from the C3024 code and made c functions of them. I did not bother with the music, LCD, EEPROM, Port I/0, and also I do not support AI motors. I added a few the resulting in the following:
extern uint8_t remocon(void); // AS C3024 REMOCON(), except only (1)
extern void c3024_init(void); // initialises the C3024
extern uint8_t rcin(uint8_t); // as C3024 RCIN()
extern uint16_t sonar(uint8_t); // as C3024 SONAR()
extern void pwm(uint8_t, uint8_t); // as C3024 PWM()
extern void fpwm(uint8_t, uint8_t, uint8_t); // as C3024 FPWM()
extern void erx_etx_open(uint8_t); // Open ERX and ETX at specified BAUD rate
extern void erx_etx_close(void); // Close ERX and ETX
extern uint8_t erx_char(void); // get char from ERX
extern void etx_char(uint8_t); // send char to ETX
extern uint8_t etx_ready(void); // ETX char sent ?
extern uint8_t erx_ready(void); // ERX char received ?
extern void srx_stx_open(uint8_t); // open SRX and STX at specified BAUD rate (this is PC port)
extern void srx_stx_close(void); // close SRX and STX
extern uint8_t srx_char(void); // get char from SRX
extern void stx_char(uint8_t); // send char to STX
extern uint8_t stx_ready(void); // STX char sent
extern uint8_t srx_ready(void); // SRX char received
extern void motion_init(void); // initialise the servo motion
extern uint8_t motorin(uint8_t); // as C3024 MOTORIN()
extern void dir(uint8_t, uint8_t, uint8_t); // as C3024 DIR()
extern void getmotorset(uint8_t, uint8_t, uint8_t *); // as C3024 GETMOTORSET()
extern void motor(uint8_t); // as C3024 MOTOR()
extern void motor_off(uint8_t); // as C3024 MOTOROFF()
extern void zero(uint8_t, uint8_t, uint8_t *) // as C3024 ZERO();
extern void ptp(uint8_t); // AS C3024 PTP SETon and SETOFF
extern void servo_ctl(uint8_t); // used to set PTP ALL ON
extern void speed(uint8_t); // as C3024 SPEED()
extern void servo(uint8_t, uint8_t); // as C3024 SERVO()
extern uint8_t move(uint8_t, uint8_t, uint8_t *); // as C3024 MOVE()
extern void delay_set(uint16_t); // sets the delay timer timer is interrupt based in mSec
extern void delay_busy(uint8_t); // check for end of delay
extern void delay_wait(void); // wait for end of delay
extern void gyro_set(uint8_t, uint8_t, uint8_t *); // as C3024 GYROSET()
extern void gyro_dir(uint8_t, uint8_t, uint8_t *); // as C3024 GYRODIR()
extern void gyro_sense(uint8_t, uint8_t, uint8_t *); // as C3024 GYROSENSE()
These together take about 10% of the code space and 12% of the data space available on the ATMega128. However they also take 50% of the processor cycles due to the way the servos are handled. A faster processor would still loose 50%, but there would be more cycles. I did not change processor, since there is a lot of time critical code in the C3024.
The above approach means I can almost replace Robobasic with function by function C equivalents.
For testing status, I have tested the non interrupt code including motorin, pwm, sonar, and Remocon. Also tested the initialisation and seting routines for the motion. Next step is the interrupt part, which is the motion, delays, and RCIN.
It has been a while since we had any posts on this topic, so I thought I would give an update, and pause for a sanity check from Dan and others of what I have done to date.
We did see a new version of Robobasic, but the C3024 payload was the the same as before dated Oct 2005. !!Happy Birthday !!
I have entered the schematic, board and library into Eagle. I have not routed, and some of the library is still not quite right. I did not find the jack socket they use anywhere, and although I have data on the buzzer and the switch, I have found no supplier. I decided to do some more work on the firmware before making new boards, which was just as well, since things I found there have changed my board design. Specifically, I will drop the buzzer, the spare LED driver, and the RS232 driver. Since I use JTAG, I will need this, but consequently loose AD4 to AD7 and 2 gyros, Also I lose the Remote control unless I move to another pin. Also the serial port needs flow control if I use higher speeds and more than one character at a time, this is due to the large amount of hime the code spends in the interrupt routines. So I plan to use an FDTI 232R and go USB.
For the firmware I took the assembler routines from the C3024 code and made c functions of them. I did not bother with the music, LCD, EEPROM, Port I/0, and also I do not support AI motors. I added a few the resulting in the following:
extern uint8_t remocon(void); // AS C3024 REMOCON(), except only (1)
extern void c3024_init(void); // initialises the C3024
extern uint8_t rcin(uint8_t); // as C3024 RCIN()
extern uint16_t sonar(uint8_t); // as C3024 SONAR()
extern void pwm(uint8_t, uint8_t); // as C3024 PWM()
extern void fpwm(uint8_t, uint8_t, uint8_t); // as C3024 FPWM()
extern void erx_etx_open(uint8_t); // Open ERX and ETX at specified BAUD rate
extern void erx_etx_close(void); // Close ERX and ETX
extern uint8_t erx_char(void); // get char from ERX
extern void etx_char(uint8_t); // send char to ETX
extern uint8_t etx_ready(void); // ETX char sent ?
extern uint8_t erx_ready(void); // ERX char received ?
extern void srx_stx_open(uint8_t); // open SRX and STX at specified BAUD rate (this is PC port)
extern void srx_stx_close(void); // close SRX and STX
extern uint8_t srx_char(void); // get char from SRX
extern void stx_char(uint8_t); // send char to STX
extern uint8_t stx_ready(void); // STX char sent
extern uint8_t srx_ready(void); // SRX char received
extern void motion_init(void); // initialise the servo motion
extern uint8_t motorin(uint8_t); // as C3024 MOTORIN()
extern void dir(uint8_t, uint8_t, uint8_t); // as C3024 DIR()
extern void getmotorset(uint8_t, uint8_t, uint8_t *); // as C3024 GETMOTORSET()
extern void motor(uint8_t); // as C3024 MOTOR()
extern void motor_off(uint8_t); // as C3024 MOTOROFF()
extern void zero(uint8_t, uint8_t, uint8_t *) // as C3024 ZERO();
extern void ptp(uint8_t); // AS C3024 PTP SETon and SETOFF
extern void servo_ctl(uint8_t); // used to set PTP ALL ON
extern void speed(uint8_t); // as C3024 SPEED()
extern void servo(uint8_t, uint8_t); // as C3024 SERVO()
extern uint8_t move(uint8_t, uint8_t, uint8_t *); // as C3024 MOVE()
extern void delay_set(uint16_t); // sets the delay timer timer is interrupt based in mSec
extern void delay_busy(uint8_t); // check for end of delay
extern void delay_wait(void); // wait for end of delay
extern void gyro_set(uint8_t, uint8_t, uint8_t *); // as C3024 GYROSET()
extern void gyro_dir(uint8_t, uint8_t, uint8_t *); // as C3024 GYRODIR()
extern void gyro_sense(uint8_t, uint8_t, uint8_t *); // as C3024 GYROSENSE()
These together take about 10% of the code space and 12% of the data space available on the ATMega128. However they also take 50% of the processor cycles due to the way the servos are handled. A faster processor would still loose 50%, but there would be more cycles. I did not change processor, since there is a lot of time critical code in the C3024.
The above approach means I can almost replace Robobasic with function by function C equivalents.
For testing status, I have tested the non interrupt code including motorin, pwm, sonar, and Remocon. Also tested the initialisation and seting routines for the motion. Next step is the interrupt part, which is the motion, delays, and RCIN.