1
0
mirror of https://github.com/halleysfifthinc/Toyota-AVC-LAN synced 2025-06-07 16:06:12 +00:00

Message read now works

This commit is contained in:
Allen Hill 2015-07-26 22:45:06 -07:00
parent 04077c8801
commit a1c2b1b6e4
15 changed files with 31013 additions and 16644 deletions

View File

@ -24,10 +24,13 @@ avclandrv.o: avclandrv.c GlobalDef.h com232.h avclandrv.h
GlobalDef.o: GlobalDef.c GlobalDef.h GlobalDef.o: GlobalDef.c GlobalDef.h
$(CC) $(CFLAGS) $(DEFS) GlobalDef.c $(CC) $(CFLAGS) $(DEFS) GlobalDef.c
clean: clean::
rm *.o *.hex *.elf @rm -f *.o *.hex *.elf
.PHONY: upload connect
upload: sniffer.hex upload: sniffer.hex
avrdude -C/home/allen/Programs/arduino-1.6.5/hardware/tools/avr/etc/avrdude.conf -v -patmega328p -carduino -P/dev/arduino -b57600 -D -Uflash:w:sniffer.hex:i avrdude -C/home/allen/Programs/arduino-1.6.5/hardware/tools/avr/etc/avrdude.conf -v -patmega328p -carduino -P/dev/arduino -b57600 -D -Uflash:w:sniffer.hex:i
.PHONY: upload connect:
@picocom --nolock -b 115200 /dev/arduino ||:

View File

@ -230,8 +230,8 @@ byte AVCLan_Read_Byte(byte length)
while (1) { while (1) {
while (INPUT_IS_CLEAR); while (INPUT_IS_CLEAR);
TCNT0 = 0; TCNT0 = 0;
while (INPUT_IS_SET); while (INPUT_IS_SET); // If input was set for less than a
if ( TCNT0 < 72 ) { if ( TCNT0 < 52 ) { // generous half period, bit was a 1
bite++; bite++;
parity_bit++; parity_bit++;
} }
@ -247,7 +247,9 @@ byte AVCLan_Send_StartBit()
{ {
AVC_SET_1(); AVC_SET_1();
TCNT0 = 0; TCNT0 = 0;
while( TCNT0 < 333 ); while( TCNT0 < 255 );
TCNT0 = 0;
while( TCNT0 < 76 );
AVC_SET_0(); AVC_SET_0();
TCNT0 = 0; TCNT0 = 0;
@ -266,7 +268,7 @@ void AVCLan_Send_Bit1()
AVC_SET_0(); AVC_SET_0();
TCNT0 = 0; TCNT0 = 0;
while( TCNT0 < 33 ); // 12-21 us while( TCNT0 < 38 ); // 12-21 us
} }
// DONE: Timing adjusted // DONE: Timing adjusted
@ -279,7 +281,7 @@ void AVCLan_Send_Bit0()
AVC_SET_0(); AVC_SET_0();
TCNT0 = 0; TCNT0 = 0;
while( TCNT0 < 9 ); // 00-09 us while( TCNT0 < 15 ); // 00-09 us
} }
// DONE: Timing adjusted. // DONE: Timing adjusted.
@ -292,14 +294,15 @@ byte AVCLan_Read_ACK()
AVC_SET_0(); AVC_SET_0();
TCNT0 = 0; TCNT0 = 0;
while( TCNT0 < 3 ); while( TCNT0 < 4 ); // Replace with AVC_ReleaseLine?
AVC_OUT_DIS(); // switch to read mode AVC_OUT_DIS(); // switch to read mode
TCNT0 = 1; TCNT0 = 1;
while(1) { while(1) {
if (INPUT_IS_SET && (TCNT0 > 2)) break; if (INPUT_IS_SET && (TCNT0 > 5)) break; // Make sure INPUT is not still set from us
if (TCNT0 > 41) return 1; // Not sure if this fix is intent correct // Line of experimentation: Try changing TCNT0 comparison value or remove check entirely
if (TCNT0 > 174 ) return 1; // Not sure if this fix is intent correct
} }
while(INPUT_IS_SET); while(INPUT_IS_SET);
@ -325,7 +328,7 @@ byte AVCLan_Send_ACK()
AVC_SET_0(); AVC_SET_0();
TCNT0 = 0; TCNT0 = 0;
while( TCNT0 < 9 ); //00-09 while( TCNT0 < 15 ); //00-09
AVC_OUT_DIS(); AVC_OUT_DIS();
@ -352,7 +355,7 @@ byte AVCLan_Send_Byte(byte bite, byte len)
} }
len--; len--;
if (!len) { if (!len) {
//if (INPUT_IS_SET) RS232_S((unsigned char)PSTR("SBER\n")); // Send Bit ERror //if (INPUT_IS_SET) RS232_Print_P(PSTR("SBER\n")); // Send Bit ERror
return 1; return 1;
} }
b = b << 1; b = b << 1;
@ -401,26 +404,28 @@ byte AVCLan_Read_Message()
byte i; byte i;
byte for_me = 0; byte for_me = 0;
//RS232_S((unsigned char)PSTR("$ ")); //RS232_Print_P(PSTR("$ "));
// TCCR1B |= (1 << CS11)|(1 << CS10); // Timer1 prescaler at 64
// check start bit // TCNT1 = 0;
TCNT0 = 0; // TCNT0 = 0;
while (INPUT_IS_SET) { // while (INPUT_IS_SET) {
if ( TCNT0 > 2286 ) { // Originally 254 // if ( TCNT0 > 255 ) { // 170 us
STARTEvent; // // TCCR1B = 0;
RS232_S((unsigned char)PSTR("LAN>T1\n")); // // TCCR1B |= (1 << WGM12)|(1 << CS12); // Set CTC, prescaler at 256
return 0; // STARTEvent;
} // RS232_Print_P(PSTR("LAN>T1\n"));
} // return 0;
// }
// }
if ( TCNT0 < 90 ) { // !!!!!!! 20 !!!!!!!!!!! (Originally 10) //
STARTEvent; // if ( TCNT0 < 20 ) { // 20 us
RS232_S((unsigned char)PSTR("LAN>T2\n")); // // TCCR1B = 0;
return 0; // // TCCR1B |= (1 << WGM12)|(1 << CS12);
} // STARTEvent;
// RS232_Print_P(PSTR("LAN>T2\n"));
// return 0;
// }
AVCLan_Read_Byte(1);
broadcast = AVCLan_Read_Byte(1); broadcast = AVCLan_Read_Byte(1);
@ -466,7 +471,7 @@ byte AVCLan_Read_Message()
else AVCLan_Read_Byte(1); else AVCLan_Read_Byte(1);
if (message_len > MAXMSGLEN) { if (message_len > MAXMSGLEN) {
// RS232_S((unsigned char)PSTR("LAN> Command error")); // RS232_Print_P(PSTR("LAN> Command error"));
STARTEvent; STARTEvent;
return 0; return 0;
} }
@ -562,7 +567,7 @@ byte AVCLan_SendData()
if (AVCLan_Read_ACK()) { if (AVCLan_Read_ACK()) {
AVC_OUT_DIS(); AVC_OUT_DIS();
STARTEvent; STARTEvent;
RS232_S((unsigned char)PSTR("E1\n")); RS232_Print_P(PSTR("Error ACK 1 (Transmission ACK)\n"));
return 1; return 1;
} }
@ -572,7 +577,7 @@ byte AVCLan_SendData()
if (AVCLan_Read_ACK()) { if (AVCLan_Read_ACK()) {
AVC_OUT_DIS(); AVC_OUT_DIS();
STARTEvent; STARTEvent;
RS232_S((unsigned char)PSTR("E2\n")); RS232_Print_P(PSTR("Error ACK 2 (COMMMAND WRITE)\n"));
return 2; return 2;
} }
@ -581,7 +586,7 @@ byte AVCLan_SendData()
if (AVCLan_Read_ACK()) { if (AVCLan_Read_ACK()) {
AVC_OUT_DIS(); AVC_OUT_DIS();
STARTEvent; STARTEvent;
RS232_S((unsigned char)PSTR("E3\n")); RS232_Print_P(PSTR("Error ACK 3 (Data Length)\n"));
return 3; return 3;
} }
@ -591,9 +596,9 @@ byte AVCLan_SendData()
if (AVCLan_Read_ACK()) { if (AVCLan_Read_ACK()) {
AVC_OUT_DIS(); AVC_OUT_DIS();
STARTEvent; STARTEvent;
RS232_S((unsigned char)PSTR("E4(")); RS232_Print_P(PSTR("Error ACK 4 (Data Byte: "));
RS232_PrintDec(i); RS232_PrintDec(i);
RS232_S((unsigned char)PSTR(")\n")); RS232_Print_P(PSTR(")\n"));
return 4; return 4;
} }
} }
@ -785,13 +790,13 @@ byte AVCLan_SendAnswer()
break; break;
case cmRegister: r = AVCLan_SendAnswerFrame((byte*)CMD_REGISTER); case cmRegister: r = AVCLan_SendAnswerFrame((byte*)CMD_REGISTER);
break; break;
case cmInit: //RS232_S((unsigned char)PSTR("INIT\n")); case cmInit: //RS232_Print_P(PSTR("INIT\n"));
r = AVCLan_SendInitCommands(); r = AVCLan_SendInitCommands();
break; break;
case cmCheck: r = AVCLan_SendAnswerFrame((byte*)CMD_CHECK); case cmCheck: r = AVCLan_SendAnswerFrame((byte*)CMD_CHECK);
check_timeout = 0; check_timeout = 0;
CMD_CHECK[6]++; CMD_CHECK[6]++;
RS232_S((unsigned char)PSTR("AVCCHK\n")); RS232_Print_P(PSTR("AVCCHK\n"));
break; break;
case cmPlayReq1: playMode = 0; case cmPlayReq1: playMode = 0;
r = AVCLan_SendAnswerFrame((byte*)CMD_PLAY_OK1); r = AVCLan_SendAnswerFrame((byte*)CMD_PLAY_OK1);
@ -803,7 +808,7 @@ byte AVCLan_SendAnswer()
CD_Mode = stPlay; CD_Mode = stPlay;
break; break;
case cmPlayIt: playMode = 1; case cmPlayIt: playMode = 1;
RS232_S((unsigned char)PSTR("PLAY\n")); RS232_Print_P(PSTR("PLAY\n"));
CMD_PLAY_OK4[7]=cd_Disc; CMD_PLAY_OK4[7]=cd_Disc;
CMD_PLAY_OK4[8]=cd_Track; CMD_PLAY_OK4[8]=cd_Track;
CMD_PLAY_OK4[9]=cd_Time_Min; CMD_PLAY_OK4[9]=cd_Time_Min;
@ -835,9 +840,9 @@ byte AVCLan_SendAnswer()
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void AVCLan_Register() void AVCLan_Register()
{ {
RS232_S((unsigned char)PSTR("REG_ST\n")); RS232_Print_P(PSTR("REG_ST\n"));
AVCLan_SendAnswerFrame((byte*)CMD_REGISTER); AVCLan_SendAnswerFrame((byte*)CMD_REGISTER);
RS232_S((unsigned char)PSTR("REG_END\n")); RS232_Print_P(PSTR("REG_END\n"));
//AVCLan_Command( cmRegister ); //AVCLan_Command( cmRegister );
AVCLan_Command( cmInit ); AVCLan_Command( cmInit );
} }
@ -851,9 +856,9 @@ byte AVCLan_Command(byte command)
answerReq = command; answerReq = command;
r = AVCLan_SendAnswer(); r = AVCLan_SendAnswer();
/* /*
RS232_S((unsigned char)PSTR("ret=")); RS232_Print_P(PSTR("ret="));
RS232_PrintHex8(r); RS232_PrintHex8(r);
RS232_S((unsigned char)PSTR("\n")); RS232_Print_P(PSTR("\n"));
*/ */
return r; return r;
} }
@ -900,24 +905,24 @@ void ShowInMessage()
AVC_HoldLine(); AVC_HoldLine();
RS232_S((unsigned char)PSTR("HU < (")); RS232_Print_P(PSTR("HU < ("));
if (broadcast==0) RS232_S((unsigned char)PSTR("bro) ")); if (broadcast==0) RS232_Print_P(PSTR("bro) "));
else RS232_S((unsigned char)PSTR("dir) ")); else RS232_Print_P(PSTR("dir) "));
RS232_PrintHex4(master1); RS232_PrintHex4(master1);
RS232_PrintHex8(master2); RS232_PrintHex8(master2);
RS232_S((unsigned char)PSTR("| ")); RS232_Print_P(PSTR("| "));
RS232_PrintHex4(slave1); RS232_PrintHex4(slave1);
RS232_PrintHex8(slave2); RS232_PrintHex8(slave2);
RS232_S((unsigned char)PSTR("| ")); RS232_Print_P(PSTR("| "));
byte i; byte i;
for (i=0;i<message_len;i++) { for (i=0;i<message_len;i++) {
RS232_PrintHex8(message[i]); RS232_PrintHex8(message[i]);
RS232_S((unsigned char)PSTR(" ")); RS232_Print_P(PSTR(" "));
} }
RS232_S((unsigned char)PSTR("\n")); RS232_Print_P(PSTR("\n"));
AVC_ReleaseLine(); AVC_ReleaseLine();
} }
@ -929,14 +934,63 @@ void ShowOutMessage()
AVC_HoldLine(); AVC_HoldLine();
RS232_S((unsigned char)PSTR("out > ")); RS232_Print_P(PSTR("out > "));
for (i=0; i<data_len; i++) { for (i=0; i<data_len; i++) {
RS232_PrintHex8(data[i]); RS232_PrintHex8(data[i]);
RS232_SendByte(' '); RS232_SendByte(' ');
} }
RS232_S((unsigned char)PSTR("\n")); RS232_Print_P(PSTR("\n"));
AVC_ReleaseLine(); AVC_ReleaseLine();
} }
void AVCLan_Measure()
{
STOPEvent;
word tmp, tmp1, tmp2, bit0, bit1;
word n = 0;
cbi(TCCR1B,CS12);
TCCR1B = _BV(CS10);
while ( n < 1000 )
{
while(INPUT_IS_CLEAR);
TCNT1 = 0;
while(INPUT_IS_SET);
tmp = TCNT1;
while(INPUT_IS_CLEAR);
tmp1 = TCNT1;
while(INPUT_IS_SET);
tmp2 = TCNT1;
bit0 = tmp1-tmp;
bit1 = tmp2-tmp1;
RS232_Print_P(PSTR("1,"));
RS232_PrintDec(bit1);
RS232_Print_P(PSTR("\n"));
RS232_Print_P(PSTR("0,"));
RS232_PrintDec(bit0);
RS232_Print_P(PSTR("\n"));
n++;
}
RS232_Print_P(PSTR("Done.\n"));
cbi(TCCR1B,CS10);
TCCR1B = _BV(CS12);
STARTEvent;
}
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------

View File

@ -122,13 +122,14 @@ extern byte cd_Time_Sec;
extern byte playMode; extern byte playMode;
byte AVCLan_SendMyData(byte *data_tmp, byte s_len); byte AVCLan_SendMyData(byte *data_tmp, byte s_len);
byte AVCLan_SendMyDataBroadcast(byte *data_tmp, byte s_len); byte AVCLan_SendMyDataBroadcast(byte *data_tmp, byte s_len);
void ShowInMessage(); void ShowInMessage();
void ShowOutMessage(); void ShowOutMessage();
void AVCLan_Measure();
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
extern byte answerReq; extern byte answerReq;
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------

View File

@ -44,7 +44,12 @@ void RS232_Init(void)
UCSR0A = 0; UCSR0A = 0;
UCSR0B = ((1<<RXCIE0) | (1<<RXEN0) | (1<<TXEN0)); // enable RxD/TxD and interrupts UCSR0B = ((1<<RXCIE0) | (1<<RXEN0) | (1<<TXEN0)); // enable RxD/TxD and interrupts
UCSR0C = ((1<<UCSZ01)|(1<<UCSZ00)); // 8N1 UCSR0C = ((1<<UCSZ01)|(1<<UCSZ00)); // 8N1
UBRR0L = 3; // baud rate 250000 UBRR0L = 8; // Baud Rate 9600 (3 for 250000)
// 103 => 9600
// 51 => 19200
// 25 => 38400
// 8 => 115200
// 3 => 250000
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
@ -60,7 +65,7 @@ void RS232_SendByte(byte Data)
UDR0 = Data; // send character UDR0 = Data; // send character
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void RS232_S(unsigned short str_addr) void RS232_Print_P(const char * str_addr)
{ {
register byte c; register byte c;
while ( (c = pgm_read_byte(str_addr++) ) ) while ( (c = pgm_read_byte(str_addr++) ) )
@ -71,7 +76,7 @@ void RS232_S(unsigned short str_addr)
} }
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void RS232_Print(char* pBuf) void RS232_Print(const char *pBuf)
{ {
register byte c; register byte c;
while ((c = *pBuf++)) while ((c = *pBuf++))

View File

@ -37,9 +37,9 @@ extern byte readkey;
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void RS232_Init(void); void RS232_Init(void);
extern void RS232_S(unsigned short str_addr); extern void RS232_Print_P(const char * str_addr);
extern void RS232_SendByte(byte Data); extern void RS232_SendByte(byte Data);
extern void RS232_Print(char* pBuf); extern void RS232_Print(const char *pBuf);
extern void RS232_PrintHex4(byte Data); extern void RS232_PrintHex4(byte Data);
extern void RS232_PrintHex8(byte Data); extern void RS232_PrintHex8(byte Data);
extern void RS232_PrintDec(byte Data); extern void RS232_PrintDec(byte Data);

6404
log.1.txt

File diff suppressed because it is too large Load Diff

BIN
log.circuit-old.tar.gz Normal file

Binary file not shown.

2990
log.txt

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -63,19 +63,18 @@ int main()
byte data_tmp[32]; byte data_tmp[32];
Setup(); Setup();
TCNT0 = 0;
while( TCNT0 < 250 );
TCNT0 = 0;
while( TCNT0 < 250 );
TCNT0 = 0;
while( TCNT0 < 250 );
RS232_S((unsigned char)PSTR("AVCLan reader 1.00\nReady\n\n")); RS232_Print("AVCLan reader 1.00\nReady\n\n");
LED_OFF(); LED_OFF();
RS232_S((unsigned char)PSTR("T - device id\n")); RS232_Print_P(PSTR("D - device id\nH - HU id\nS - read sequence\nW - send command\nQ - send broadcast\nL/l - log on/off\nK/k - seq. echo on/off\nR/r - register device\nB - Beep\nT - Measure interval\n"));
RS232_S((unsigned char)PSTR("H - HU id\n"));
RS232_S((unsigned char)PSTR("S - read sequence\n"));
RS232_S((unsigned char)PSTR("W - send command\n"));
RS232_S((unsigned char)PSTR("Q - send broadcast\n"));
RS232_S((unsigned char)PSTR("L/l - log on/off\n"));
RS232_S((unsigned char)PSTR("K/k - seq. echo on/off\n"));
RS232_S((unsigned char)PSTR("R/r - register device\n"));
@ -108,18 +107,18 @@ int main()
RS232_RxCharBegin = RS232_RxCharEnd = 0; // do reset Buffer RS232_RxCharBegin = RS232_RxCharEnd = 0; // do reset Buffer
sbi(UCSR0B, RXCIE0); // enable RX complete interrupt sbi(UCSR0B, RXCIE0); // enable RX complete interrupt
switch (readkey) { switch (readkey) {
case 'T': if (readSeq) { case 'D': if (readSeq) {
CD_ID_1 = data_tmp[0]; CD_ID_1 = data_tmp[0];
CD_ID_2 = data_tmp[1]; CD_ID_2 = data_tmp[1];
RS232_S((unsigned char)PSTR("DEV ID SET: 0x")); RS232_Print_P(PSTR("DEV ID SET: 0x"));
RS232_PrintHex8(CD_ID_1); RS232_PrintHex8(CD_ID_1);
RS232_PrintHex8(CD_ID_2); RS232_PrintHex8(CD_ID_2);
RS232_S((unsigned char)PSTR("\n")); RS232_Print_P(PSTR("\n"));
showLog = 1; showLog = 1;
readSeq=0; readSeq=0;
} else { } else {
showLog = 0; showLog = 0;
RS232_S((unsigned char)PSTR("DEV ID > \n")); RS232_Print_P(PSTR("DEV ID > \n"));
readSeq = 1; readSeq = 1;
s_len=0; s_len=0;
s_dig=0; s_dig=0;
@ -130,15 +129,15 @@ int main()
case 'H': if (readSeq) { case 'H': if (readSeq) {
HU_ID_1 = data_tmp[0]; HU_ID_1 = data_tmp[0];
HU_ID_2 = data_tmp[1]; HU_ID_2 = data_tmp[1];
RS232_S((unsigned char)PSTR("HU ID SET: 0x")); RS232_Print_P(PSTR("HU ID SET: 0x"));
RS232_PrintHex8(HU_ID_1); RS232_PrintHex8(HU_ID_1);
RS232_PrintHex8(HU_ID_2); RS232_PrintHex8(HU_ID_2);
RS232_S((unsigned char)PSTR("\n")); RS232_Print_P(PSTR("\n"));
showLog = 1; showLog = 1;
readSeq=0; readSeq=0;
} else { } else {
showLog = 0; showLog = 0;
RS232_S((unsigned char)PSTR("HU ID > \n")); RS232_Print_P(PSTR("HU ID > \n"));
readSeq = 1; readSeq = 1;
s_len=0; s_len=0;
s_dig=0; s_dig=0;
@ -147,7 +146,7 @@ int main()
break; break;
case 'S': showLog = 0; case 'S': showLog = 0;
RS232_S((unsigned char)PSTR("READ SEQUENCE > \n")); RS232_Print_P(PSTR("READ SEQUENCE > \n"));
readSeq = 1; readSeq = 1;
s_len=0; s_len=0;
s_dig=0; s_dig=0;
@ -163,7 +162,7 @@ int main()
break; break;
case 'R': RS232_S((unsigned char)PSTR("REGIST:\n")); case 'R': RS232_Print_P(PSTR("REGIST:\n"));
AVCLan_Command( cmRegister ); AVCLan_Command( cmRegister );
TCNT0 = 0; TCNT0 = 0;
while( TCNT0 < 135 ); while( TCNT0 < 135 );
@ -173,19 +172,31 @@ int main()
break; break;
case 'l': RS232_S((unsigned char)PSTR("Log OFF\n")); case 'l': RS232_Print_P(PSTR("Log OFF\n"));
showLog = 0; showLog = 0;
break; break;
case 'L': RS232_S((unsigned char)PSTR("Log ON\n")); case 'L': RS232_Print_P(PSTR("Log ON\n"));
showLog = 1; showLog = 1;
break; break;
case 'k': RS232_S((unsigned char)PSTR("str OFF\n")); case 'k': RS232_Print_P(PSTR("str OFF\n"));
showLog2 = 0; showLog2 = 0;
break; break;
case 'K': RS232_S((unsigned char)PSTR("str ON\n")); case 'K': RS232_Print_P(PSTR("str ON\n"));
showLog2 = 1; showLog2 = 1;
break; break;
case 'B':
data_tmp[0] = 0x00;
data_tmp[0] = 0x5E;
data_tmp[0] = 0x29;
data_tmp[0] = 0x60;
data_tmp[0] = 0x01;
s_len = 5;
AVCLan_SendMyData(data_tmp, s_len);
break;
case 'T':
AVCLan_Measure();
break;
default : default :
if (readSeq==1) { if (readSeq==1) {
@ -204,12 +215,12 @@ int main()
s_c[0]=s_c[1]=0; s_c[0]=s_c[1]=0;
} }
if (showLog2) { if (showLog2) {
RS232_S((unsigned char)PSTR("CURRENT SEQUENCE > ")); RS232_Print_P(PSTR("CURRENT SEQUENCE > "));
for (i=0; i<s_len; i++) { for (i=0; i<s_len; i++) {
RS232_PrintHex8(data_tmp[i]); RS232_PrintHex8(data_tmp[i]);
RS232_SendByte(' '); RS232_SendByte(' ');
} }
RS232_S((unsigned char)PSTR("\n")); RS232_Print_P(PSTR("\n"));
} }
} }
} // switch (readkey) } // switch (readkey)
@ -232,11 +243,11 @@ void Setup()
{ {
// GIMSK = 0; // (GICR ?) disable external interupts // GIMSK = 0; // (GICR ?) disable external interupts
CD_ID_1 = 0x02; CD_ID_1 = 0x03;
CD_ID_2 = 0x80; CD_ID_2 = 0x60;
HU_ID_1 = 0x01; HU_ID_1 = 0x01;
HU_ID_2 = 0x40; HU_ID_2 = 0x90;
showLog = 1; showLog = 1;
showLog2 = 1; showLog2 = 1;
@ -248,7 +259,6 @@ void Setup()
sbi(TIMSK1, OCIE1A); // Enable timer1 compare interrupt sbi(TIMSK1, OCIE1A); // Enable timer1 compare interrupt
TCCR1A = 0; TCCR1A = 0;
TCCR1B |= (1 << WGM12)|(1 << CS12); // Set CTC, prescaler at 256 TCCR1B |= (1 << WGM12)|(1 << CS12); // Set CTC, prescaler at 256
//TCNT1 = 0xFFFF - 0x7080;
OCR1A = 62499; // Compare match at 1sec intervals OCR1A = 62499; // Compare match at 1sec intervals

4000
timing,16MHz,1000-err0.csv Normal file

File diff suppressed because it is too large Load Diff

2000
timing,16MHz,1000.csv Normal file

File diff suppressed because it is too large Load Diff

4000
timing,16MHz,2000.csv Normal file

File diff suppressed because it is too large Load Diff

4000
timing,2MHz,2000.csv Normal file

File diff suppressed because it is too large Load Diff

16784
timing.csv Normal file

File diff suppressed because it is too large Load Diff