bonjour,
je suis débutante, et j'aimerais controller ma camera (MTV 54g10), mais je suis coincé À tout les bouts.
le sequence de communication est:
controller camera
ENQ(05h)
------------------------------------------->
ACK(06h)
<-----------------------------------------
COMMAND
------------------------------------------->
ACK(06h)
<-----------------------------------------
RESPONSE
<-----------------------------------------
ACK(06h)
------------------------------------------>
le format de communication:
STX, command or response, control item, data-1, ..., data-13, EXT, CRC16, CRC16
crc16 = (calculation X16 +X15+X2+1) = 0x8005 et je le calcule avec ce code:
unsigned int calcCRC16r(unsigned int crc, unsigned int c, unsigned int mask)
{//mask=8005, crc = 0, c = E001
unsigned char i;
unsigned int m;
for(i=0;i<8;i++)
{
if((crc ^ c) & 1) { crc=(crc>>1)^mask; }
else crc>>=1;
c>>=1;
}
return (crc);
}
1.probleme
:
je veus vérifier si la communication entre mon controller et la camera À lieu
programme qui ne fonctionne pas:
int main(void)
{
char kommando; //[255];
// RS232 einschalten ...
setup_uart();
DDRB = 0xFF;
//ENQ setting
//sendet Anforderung (ENQ)
uart_putstring("05");
while( !(UCSRA & (1<<TXC)) );
kommando = UDR;
PORTB = atoi( kommando );
return 0;
}
2.Probleme
:
command envoyé cette commande, un brin de code pour m'orienter me ferais vraiment plaisir
pour une commande controller "l'iris"
mon format est:
0x02
0x21
0x48
0x02
0x00
0x00
0x00
0x00
0x00
0x00
0x00
0x00
0x00
0x00
0x00
0x00
0x03
0xBD
0xD3
merci de me venir en aide
salut