Closed darylrichards closed 5 years ago
I'm not sure, if this makes sense. I want to be compatible to the original sdrive from Bob & Raster, and there was also the diode present. Otherways we are near the end of flash, so i won't waste any bytes not really needed.
This only adds 6 bytes to the code total. Having the diode in place does no harm with this change, and I feel that since anyone new has to add the diode and this removes that requirement, it's only a net benefit.
Also, I've already remove hundreds of bytes of unneeded code from the tree that I'm working on..
Interesting, i know there could be something optimized, it's mostly the original code from Bob & Raster, but hundred of bytes? Where have you found them?
The diode is only the half rate, the main issue is the 1K resistor in the line, which is between the USB2Serial converter. So i think it is not really wholesome to activate a second pull-up. The diode has the side effect to eliminate the pull-up.
The optimization comes from the fact that avr-gcc isn't always great at optimizing things. Restructuring code helps it a lot... As for the pull-up, it hasn't made a difference for me either way, but since I also moved the Command signal to INT0 (PORTD bit 2), it was easier for me to turn the pull ups all on. And the reason for moving Command is again, to save a couple bytes and a slight savings in interrupt latency..
But this Pin is also used for display data, you should always turn of interrupts on display activity at least. And when reading from display, this may conflict.
I close this issue now, because this is not the solution, and there are an other/better hardware solution based on 7407 now.
diff --git a/SDrive.c b/SDrive.c index 0590906..7b28795 100644 --- a/SDrive.c +++ b/SDrive.c @@ -374,6 +374,9 @@ int main(void) CMD_PORTREG |= 1 << CMD_PIN; // with pullup CMD_DDR &= ~(1 << CMD_PIN); // to input
@@ -746,6 +749,7 @@ ISR(PCINT1_vect)
UCSR0B = (1<<RXEN0); // turn off transmitter LED_GREEN_OFF(virtual_drive_number); // LED OFF
diff --git a/usart.c b/usart.c index 7d2927d..d33895c 100644 --- a/usart.c +++ b/usart.c @@ -65,7 +65,7 @@ void USART_Init ( u16 value ) { //UCSRA = (1<<UDRE);
UCSRB = (1<<RXEN); //|(1<<TXEN); / Set frame format: 8data, 1stop bit / UCSRC = (1<<URSEL)|(1<<UCSZ1)|(1<<UCSZ0); { @@ -75,6 +75,8 @@ void USART_Init ( u16 value ) { }
void USART_Transmit_Byte( unsigned char data ) {