Re: Airbus gauges for the MIP
OK, here is the final result:
http://www-public.tu-bs.de:8080/~y00...sindicator.jpg
As you can see it is unlighted on the picture and therefore the white areas are some kind of pink, which is the color of the sheet if it is off. If anyone likes, I can provide pictures when lighted, hope you like it already.
Re: Airbus gauges for the MIP
Hi,
I had lost track of this post and saw it back today but I cant download any of the PDF files?
Greetz Peter
Re: Airbus gauges for the MIP
Quote:
Originally Posted by
pdpo
I had lost track of this post and saw it back today but I cant download any of the PDF files?
Sorry, that was my mistake, I accidently deleted them from the server, I changed the links, it should work now, but I don't have the first pictures anymore, but I think the PDFs and the final result is enough, when I unfasten it the next time, I will take a picture from the side and upload it again, if anyone needs this.
Re: Airbus gauges for the MIP
Hi,
thanks very much, now ive downloaded the files ... this would make it posible to build the board for me too but the software is still missing. I am trying to learn from this since it would help me to understand how a communication between pc and atmel can be done.
I had already before taken up looking at the atmega64 and see what this can do all.
I had also downloaded already some bascom book but time is (as always) the limiting factor.
Anyway it would be nice if you could share that too but I would equally understand if you would not share it. I can just ask..you are free to refuse of course....:-)
Greetz Peter
Re: Airbus gauges for the MIP
Quote:
Originally Posted by
pdpo
thanks very much, now ive downloaded the files ... this would make it posible to build the board for me too but the software is still missing.
Would be nice if you do that based on this layout, I hope it works a second time. :-)
Quote:
Originally Posted by
pdpo
I am trying to learn from this since it would help me to understand how a communication between pc and atmel can be done.
Actually my concept is currently a very easy one way communication, from the computer to the µC without any confirmation of command reception or something like that.
Quote:
Originally Posted by
pdpo
I had already before taken up looking at the atmega64 and see what this can do all.
I had also downloaded already some bascom book but time is (as always) the limiting factor.
I didn't program with BASCOM but don't fear ASSEMBLER, I did it with C which is also very easy to understand compared with ASsEMBLER. The source code does nothing more than receiving and setting the servos, it has exactly 100 lines.
Quote:
Originally Posted by
pdpo
Anyway it would be nice if you could share that too but I would equally understand if you would not share it. I can just ask..you are free to refuse of course....:-)
Well I think it is okay to share the code for the firmware, but I'd like to state again that I don't want that any part of my idea is being commercialized without my knowledge and approval.
And another thing would be great: If anyone here is programming a driver for the gauge, please also make it open source or at least send it to me, because mine is actually very worse.
Here is the code, comments are all in German, but it should be easy to translate or you can ask here.
Code:
// Vordefinieren der Taktfrequenz F_CPU in Herz für delay.h
#ifndef F_CPU
#define F_CPU 8000000UL
#endif
// Baudrate
#define BAUD 9600UL // Definition
#define UBRR_VAL ((F_CPU+BAUD*8)/(BAUD*16)-1) // Berechnungen
#define BAUD_REAL (F_CPU/(16*(UBRR_VAL+1)))
#define BAUD_ERROR ((BAUD_REAL*1000)/BAUD)
#if ((BAUD_ERROR<990) || (BAUD_ERROR>1010)) //Fehlermeldung
#error Systematischer Fehler der Baudrate grösser 1%
#endif
//Einbinden der Bibliotheken
#include <avr/io.h>
#include <avr/interrupt.h>
#include <util/delay.h>
// Servoabhängige Optionen, eingestellt für CMS digital Servo
#define basetime 0.9 // Minimalzeit eines Impulses in ms
#define steptime 4 // Auflösung der 250 Schritte in us
#define waittime 0 // Wartezeit zwischen Ausgabesignalen in ms
// Variablendeklaration
volatile uint8_t servo[4]={125,125,125,125}, kanal, i; // Servopositionen, Schleifen
uint8_t buffer, bytenummer, auswahl; // Datenübertragung
ISR (USART_RXC_vect) // Interruptroutine bei Zeichenempfang
{
buffer=UDR; // Zwischenspeichern
switch(bytenummer) // Abfrage der Bytenummer
{
case 0: // Steuerbyte (muss 255 sein)
if(buffer==255) bytenummer=1;
break;
case 1: // Auswahlbyte (25x, x=Servonummer)
if( (buffer>=251) && (buffer<=254) )
{
auswahl=buffer-251;
bytenummer=2;
}
else
{
bytenummer=0;
}
break;
case 2: // Datenbyte (0 bis 250)
if(buffer<=250)
{
servo[auswahl]=buffer; break;
}
bytenummer=0;
break;
}
}
int main (void) // Hauptprogramm
{
// Ausgänge setzen (4 Servos an PC0-PC3)
DDRB=0x00;
DDRC=0x0F;
DDRD=0x00;
// Alle Ports auf 0 setzen
PORTB=0;
PORTC=0;
PORTD=0;
// UART Baudrate setzen
UBRRH = UBRR_VAL >> 8;
UBRRL = UBRR_VAL & 0xFF;
// UART Receive und Interrupt Enable
sei();
UCSRB |= ( 1 << RXEN );
UCSRB |= ( 1 << RXCIE );
while(1)
{
cli();
PORTC|=(1<<kanal);
_delay_ms(basetime);
for (i=0;i<servo[kanal];i++)
{
_delay_us(steptime);
asm volatile ("nop");
}
PORTC=0;
kanal++;
sei();
_delay_ms(waittime);
if(kanal>3)
{
kanal=0;
}
}
}
Re: Airbus gauges for the MIP
Hi,
again thanks fro the next part of the puzzle.
One more auestion though. Does the FDTI chip act as a serial port for a PC
program? How does a PC program talk to this chip?
Greetings Peter
Re: Airbus gauges for the MIP
Quote:
Originally Posted by
pdpo
One more auestion though.
But you asked to questions.:p
Quote:
Originally Posted by
pdpo
Does the FDTI chip act as a serial port for a PC program?
The driver of the FTDI chip supports two modes, one is an emulated COM port, the other one is a direct USB support, which is in my eyes easier to use, because you don't have to care for the port, only for the name of the device and you need only 4 commands from the SDK or so.
Quote:
Originally Posted by
pdpo
How does a PC program talk to this chip?
As you can see in the code above, the reception of commands is done in the ISR (USART_RXC_vect) subroutine.
And to get this thing to work, you need to transmit the control character 255, then the number of the servo which position is following plus 250 (251 for servo 1, 254 for servo 4). The third and last parameter is then the desired position from 0-250.
What you have to do in the firmware code is adopting the values to your servo, because I recognized that several servos need different timing. These are the basetime, steptime and waittime parameters. basetime is the time that is always a logical one, steptime is multiplied with 0-250 and then added to the basetime and waittime is the time that the µC waits after sending four commands to the servos to accomodate some manufacturer specifications.
If you use the CMS digital Servo from Carson, everything should be fine, if you choose a different one, I would recommend also a digital servo, the smallest you can find and the price should be around 10-15 Euro.
Re: Airbus gauges for the MIP
Well,
I cannot thank you enought for the detailed info. When time permits I'll have take a look at this and see if I can accomplish something too.
Just one more thing... out of your explanation I understand there is some driver available for this usb chip and there is an SDK to talk with it, correct?
Greetings Peter